vellum-ai 0.8.11__py3-none-any.whl → 0.8.13__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
vellum/core/__init__.py CHANGED
@@ -3,7 +3,7 @@
3
3
  from .api_error import ApiError
4
4
  from .client_wrapper import AsyncClientWrapper, BaseClientWrapper, SyncClientWrapper
5
5
  from .datetime_utils import serialize_datetime
6
- from .file import File, convert_file_dict_to_httpx_tuples
6
+ from .file import File, convert_file_dict_to_httpx_tuples, with_content_type
7
7
  from .http_client import AsyncHttpClient, HttpClient
8
8
  from .jsonable_encoder import jsonable_encoder
9
9
  from .pydantic_utilities import (
@@ -43,4 +43,5 @@ __all__ = [
43
43
  "universal_field_validator",
44
44
  "universal_root_validator",
45
45
  "update_forward_refs",
46
+ "with_content_type",
46
47
  ]
@@ -17,7 +17,7 @@ class BaseClientWrapper:
17
17
  headers: typing.Dict[str, str] = {
18
18
  "X-Fern-Language": "Python",
19
19
  "X-Fern-SDK-Name": "vellum-ai",
20
- "X-Fern-SDK-Version": "0.8.11",
20
+ "X-Fern-SDK-Version": "0.8.13",
21
21
  }
22
22
  headers["X_API_KEY"] = self.api_key
23
23
  return headers
vellum/core/file.py CHANGED
@@ -1,30 +1,30 @@
1
1
  # This file was auto-generated by Fern from our API Definition.
2
2
 
3
- import typing
3
+ from typing import IO, Dict, List, Mapping, Optional, Tuple, Union, cast
4
4
 
5
5
  # File typing inspired by the flexibility of types within the httpx library
6
6
  # https://github.com/encode/httpx/blob/master/httpx/_types.py
7
- FileContent = typing.Union[typing.IO[bytes], bytes, str]
8
- File = typing.Union[
7
+ FileContent = Union[IO[bytes], bytes, str]
8
+ File = Union[
9
9
  # file (or bytes)
10
10
  FileContent,
11
11
  # (filename, file (or bytes))
12
- typing.Tuple[typing.Optional[str], FileContent],
12
+ Tuple[Optional[str], FileContent],
13
13
  # (filename, file (or bytes), content_type)
14
- typing.Tuple[typing.Optional[str], FileContent, typing.Optional[str]],
14
+ Tuple[Optional[str], FileContent, Optional[str]],
15
15
  # (filename, file (or bytes), content_type, headers)
16
- typing.Tuple[
17
- typing.Optional[str],
16
+ Tuple[
17
+ Optional[str],
18
18
  FileContent,
19
- typing.Optional[str],
20
- typing.Mapping[str, str],
19
+ Optional[str],
20
+ Mapping[str, str],
21
21
  ],
22
22
  ]
23
23
 
24
24
 
25
25
  def convert_file_dict_to_httpx_tuples(
26
- d: typing.Dict[str, typing.Union[File, typing.List[File]]],
27
- ) -> typing.List[typing.Tuple[str, File]]:
26
+ d: Dict[str, Union[File, List[File]]],
27
+ ) -> List[Tuple[str, File]]:
28
28
  """
29
29
  The format we use is a list of tuples, where the first element is the
30
30
  name of the file and the second is the file object. Typically HTTPX wants
@@ -41,3 +41,22 @@ def convert_file_dict_to_httpx_tuples(
41
41
  else:
42
42
  httpx_tuples.append((key, file_like))
43
43
  return httpx_tuples
44
+
45
+
46
+ def with_content_type(*, file: File, content_type: str) -> File:
47
+ """ """
48
+ if isinstance(file, tuple):
49
+ if len(file) == 2:
50
+ filename, content = cast(Tuple[Optional[str], FileContent], file) # type: ignore
51
+ return (filename, content, content_type)
52
+ elif len(file) == 3:
53
+ filename, content, _ = cast(Tuple[Optional[str], FileContent, Optional[str]], file) # type: ignore
54
+ return (filename, content, content_type)
55
+ elif len(file) == 4:
56
+ filename, content, _, headers = cast( # type: ignore
57
+ Tuple[Optional[str], FileContent, Optional[str], Mapping[str, str]], file
58
+ )
59
+ return (filename, content, content_type, headers)
60
+ else:
61
+ raise ValueError(f"Unexpected tuple length: {len(file)}")
62
+ return (None, file, content_type)
@@ -183,11 +183,11 @@ def encode_by_type(o: typing.Any) -> typing.Any:
183
183
  return encoder(o)
184
184
 
185
185
 
186
- def update_forward_refs(model: typing.Type["Model"]) -> None:
186
+ def update_forward_refs(model: typing.Type["Model"], **localns: typing.Any) -> None:
187
187
  if IS_PYDANTIC_V2:
188
188
  model.model_rebuild(raise_errors=False) # type: ignore # Pydantic v2
189
189
  else:
190
- model.update_forward_refs()
190
+ model.update_forward_refs(**localns)
191
191
 
192
192
 
193
193
  # Mirrors Pydantic's internal typing
@@ -29,6 +29,10 @@ class ChatMessagePromptBlockPropertiesRequest(UniversalBaseModel):
29
29
  extra = pydantic.Extra.allow
30
30
 
31
31
 
32
+ from .chat_message_prompt_block_request import ChatMessagePromptBlockRequest # noqa: E402
32
33
  from .prompt_block_request import PromptBlockRequest # noqa: E402
33
34
 
35
+ update_forward_refs(
36
+ ChatMessagePromptBlockRequest, ChatMessagePromptBlockPropertiesRequest=ChatMessagePromptBlockPropertiesRequest
37
+ )
34
38
  update_forward_refs(ChatMessagePromptBlockPropertiesRequest)
@@ -33,4 +33,7 @@ class ChatMessagePromptBlockRequest(UniversalBaseModel):
33
33
 
34
34
  from .chat_message_prompt_block_properties_request import ChatMessagePromptBlockPropertiesRequest # noqa: E402
35
35
 
36
+ update_forward_refs(
37
+ ChatMessagePromptBlockPropertiesRequest, ChatMessagePromptBlockRequest=ChatMessagePromptBlockRequest
38
+ )
36
39
  update_forward_refs(ChatMessagePromptBlockRequest)
@@ -17,7 +17,7 @@ class JsonInputRequest(UniversalBaseModel):
17
17
  """
18
18
 
19
19
  type: typing.Literal["JSON"] = "JSON"
20
- value: typing.Dict[str, typing.Optional[typing.Any]]
20
+ value: typing.Optional[typing.Any] = None
21
21
 
22
22
  if IS_PYDANTIC_V2:
23
23
  model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
@@ -1,12 +1,14 @@
1
1
  # This file was auto-generated by Fern from our API Definition.
2
2
 
3
+ from __future__ import annotations
3
4
  from ..core.pydantic_utilities import UniversalBaseModel
5
+ from .metadata_filter_rule_request import MetadataFilterRuleRequest
4
6
  import typing
5
7
  from .metadata_filter_rule_combinator import MetadataFilterRuleCombinator
6
- from .metadata_filter_rule_request import MetadataFilterRuleRequest
7
8
  from .logical_operator import LogicalOperator
8
9
  from ..core.pydantic_utilities import IS_PYDANTIC_V2
9
10
  import pydantic
11
+ from ..core.pydantic_utilities import update_forward_refs
10
12
 
11
13
 
12
14
  class MetadataFilterConfigRequest(UniversalBaseModel):
@@ -25,3 +27,6 @@ class MetadataFilterConfigRequest(UniversalBaseModel):
25
27
  frozen = True
26
28
  smart_union = True
27
29
  extra = pydantic.Extra.allow
30
+
31
+
32
+ update_forward_refs(MetadataFilterRuleRequest, MetadataFilterConfigRequest=MetadataFilterConfigRequest)
@@ -1,10 +1,13 @@
1
1
  # This file was auto-generated by Fern from our API Definition.
2
2
 
3
+ from __future__ import annotations
3
4
  from ..core.pydantic_utilities import UniversalBaseModel
5
+ from .metadata_filter_rule_request import MetadataFilterRuleRequest
4
6
  import typing
5
7
  import pydantic
6
8
  from .metadata_filter_config_request import MetadataFilterConfigRequest
7
9
  from ..core.pydantic_utilities import IS_PYDANTIC_V2
10
+ from ..core.pydantic_utilities import update_forward_refs
8
11
 
9
12
 
10
13
  class SearchFiltersRequest(UniversalBaseModel):
@@ -26,3 +29,6 @@ class SearchFiltersRequest(UniversalBaseModel):
26
29
  frozen = True
27
30
  smart_union = True
28
31
  extra = pydantic.Extra.allow
32
+
33
+
34
+ update_forward_refs(MetadataFilterRuleRequest, SearchFiltersRequest=SearchFiltersRequest)
@@ -1,12 +1,15 @@
1
1
  # This file was auto-generated by Fern from our API Definition.
2
2
 
3
+ from __future__ import annotations
3
4
  from ..core.pydantic_utilities import UniversalBaseModel
5
+ from .metadata_filter_rule_request import MetadataFilterRuleRequest
4
6
  import typing
5
7
  import pydantic
6
8
  from .search_weights_request import SearchWeightsRequest
7
9
  from .search_result_merging_request import SearchResultMergingRequest
8
10
  from .search_filters_request import SearchFiltersRequest
9
11
  from ..core.pydantic_utilities import IS_PYDANTIC_V2
12
+ from ..core.pydantic_utilities import update_forward_refs
10
13
 
11
14
 
12
15
  class SearchRequestOptionsRequest(UniversalBaseModel):
@@ -38,3 +41,6 @@ class SearchRequestOptionsRequest(UniversalBaseModel):
38
41
  frozen = True
39
42
  smart_union = True
40
43
  extra = pydantic.Extra.allow
44
+
45
+
46
+ update_forward_refs(MetadataFilterRuleRequest, SearchRequestOptionsRequest=SearchRequestOptionsRequest)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: vellum-ai
3
- Version: 0.8.11
3
+ Version: 0.8.13
4
4
  Summary:
5
5
  License: MIT
6
6
  Requires-Python: >=3.8,<4.0
@@ -1,13 +1,13 @@
1
1
  vellum/__init__.py,sha256=ZjILSZ1gKX9YUZjjOzr0wngRMV7aYaCvuCXgoxt7n2o,30148
2
2
  vellum/client.py,sha256=tsLLtZbwPASP8Cdh1RF19pOuNmZbBKFkUiplU9X190Q,101256
3
- vellum/core/__init__.py,sha256=FzSvKbXjuM18Hdk3iGK-jsGY_DfouyRS659thZV5c1Y,1394
3
+ vellum/core/__init__.py,sha256=SQ85PF84B9MuKnBwHNHWemSGuy-g_515gFYNFhvEE0I,1438
4
4
  vellum/core/api_error.py,sha256=RE8LELok2QCjABadECTvtDp7qejA1VmINCh6TbqPwSE,426
5
- vellum/core/client_wrapper.py,sha256=GuFARnrNjOwr3CF3jArBZgkSP0O7K4e0MLMHBAXkbkg,1898
5
+ vellum/core/client_wrapper.py,sha256=rsTOZjk7z3mQIFC1nDTnTmM5L8SZWvNAx974kSd7ktQ,1898
6
6
  vellum/core/datetime_utils.py,sha256=nBys2IsYrhPdszxGKCNRPSOCwa-5DWOHG95FB8G9PKo,1047
7
- vellum/core/file.py,sha256=vliNmlB7PbDfi4EKiVPNq5QaGXJ4zlDBGupv7Qciy7g,1520
7
+ vellum/core/file.py,sha256=X9IbmkZmB2bB_DpmZAO3crWdXagOakAyn6UCOCImCPg,2322
8
8
  vellum/core/http_client.py,sha256=rZSidd9LazCjduvdBhZ7GDs4iGfn-OAfRGsDXB1z8f4,18882
9
9
  vellum/core/jsonable_encoder.py,sha256=qaF1gtgH-kQZb4kJskETwcCsOPUof-NnYVdszHkb-dM,3656
10
- vellum/core/pydantic_utilities.py,sha256=h_XylfOhkKxX6ZxL5CVfXylOzR4oc5AjCVC5yTsR4aU,9138
10
+ vellum/core/pydantic_utilities.py,sha256=mrrWV91fMWAertBxn2shhHQDm_i2WrbQrqXskVEVKHg,9170
11
11
  vellum/core/query_encoder.py,sha256=ekulqNd0j8TgD7ox-Qbz7liqX8-KP9blvT9DsRCenYM,2144
12
12
  vellum/core/remove_none_from_dict.py,sha256=EU9SGgYidWq7SexuJbNs4-PZ-5Bl3Vppd864mS6vQZw,342
13
13
  vellum/core/request_options.py,sha256=5cCGt5AEGgtP5xifDl4oVQUmSjlIA8FmRItAlJawM18,1417
@@ -93,8 +93,8 @@ vellum/types/chat_history_input_request.py,sha256=0dmWfRWN9lOGEorQ3P1jKPAQtcXVex
93
93
  vellum/types/chat_message.py,sha256=EOA8v5Ebx2KS9BtwBBGbuvSK-pn4xWYZiioHuuPWvzw,916
94
94
  vellum/types/chat_message_content.py,sha256=2Fd2Ek-lO3rdfAXFc1eJlwisMVQwbESAcRHFedkeF3A,501
95
95
  vellum/types/chat_message_content_request.py,sha256=609nXvgmv65ZohV2B4Kh3cr30Tez69BdDidBYhiREP4,609
96
- vellum/types/chat_message_prompt_block_properties_request.py,sha256=CRLQ3e288O5hSKIucbPRgzwJX-bj6BAZrDjKmrWZ54A,1117
97
- vellum/types/chat_message_prompt_block_request.py,sha256=fcnX_2Op9cED0i6AAktPi0kY6bzQp4JfrUAcyplbdSA,1295
96
+ vellum/types/chat_message_prompt_block_properties_request.py,sha256=lMBVwR5hnBykjVpcptjBJLj4QhUpomtxdj-E2Th8iYw,1346
97
+ vellum/types/chat_message_prompt_block_request.py,sha256=osPqtdZOG9NW_Iqcv0CyvkU2cHZzPeVVIWQUGvnB-Dw,1423
98
98
  vellum/types/chat_message_request.py,sha256=r2EW1pfnvNYx2fo6mBqU5HQrUzp67WXuE5G-XK281E4,945
99
99
  vellum/types/chat_message_role.py,sha256=-i0Jrcbwf72MkMoaFTGyxRduvlN7f5Y9ULhCXR5KNdA,182
100
100
  vellum/types/code_execution_node_array_result.py,sha256=IpqOekJZVY1F1ecCuDmda6BldzG8VzPtXNd2Kx02wJw,746
@@ -198,7 +198,7 @@ vellum/types/instructor_vectorizer_config_request.py,sha256=6LGFFQKntMfX7bdetUqE
198
198
  vellum/types/iteration_state_enum.py,sha256=83JSh842OJgQiLtNn1KMimy6RlEYRVH3mDmYWS6Ewzo,180
199
199
  vellum/types/jinja_prompt_block_properties_request.py,sha256=2nb9gp224ADPi0aNTKNMaOe159EDB8JSHzDkMzR0QxI,719
200
200
  vellum/types/jinja_prompt_block_request.py,sha256=VQPrZOZJaEw2ILrebKT53CM8hRyQ5RuUeZZt0mzRd3Q,1097
201
- vellum/types/json_input_request.py,sha256=37JriRoVx8QPmCpEaDzaIhaHOQMFS8HlWuoSSvuf_o4,810
201
+ vellum/types/json_input_request.py,sha256=pnOWSzeBSz1pYtQPxYrUVFGW1_8bQAH_VpAQLjGEdj4,799
202
202
  vellum/types/json_variable_value.py,sha256=X7eBEWxuozfvIdqD5sIZ5L-L77Ou6IIsZaQVNXh5G2k,634
203
203
  vellum/types/json_vellum_value.py,sha256=8irlw6NkRRVafysfTc1Q5BFFhRrWJYzdwrDYTdJK4JY,689
204
204
  vellum/types/json_vellum_value_request.py,sha256=IUlkdwFGgBeLl9sCmAJhoaxomWiEMpWgRcLa_WnlK8g,696
@@ -208,7 +208,7 @@ vellum/types/map_node_result.py,sha256=e2YqEP-aKig2TbbZIlfn5LCeVEVhEJJBR7o7xTBKX
208
208
  vellum/types/map_node_result_data.py,sha256=3xJXC1JrS9lo3-3_u1S79sYwLxMknNntDyspN24vQzY,699
209
209
  vellum/types/merge_node_result.py,sha256=h8iEDQgiEjVASom_lAyIi9iErh9rU0_Am7awyzIarnc,742
210
210
  vellum/types/merge_node_result_data.py,sha256=BM3bmwFhTDiY5HchT-5uRl0o6qmJ5KH-NHRb9huGRoA,640
211
- vellum/types/metadata_filter_config_request.py,sha256=k8wbfv-Tl3QJrtfzn_W2kAdUJ3-BkPj7ET7fQMTEbTM,1061
211
+ vellum/types/metadata_filter_config_request.py,sha256=Vg9Yd2VJltbiVYadCk55RTHcaW-3hBYtAe_Ksqs_WeM,1260
212
212
  vellum/types/metadata_filter_rule_combinator.py,sha256=3Vpp1Mnv3As7efkxWTeV8qd4gdJ6OLoLhz_UeVBHAX8,165
213
213
  vellum/types/metadata_filter_rule_request.py,sha256=Pcs0TsU7CRnsEUoH0DWb-c9DTP2UW67lJKXlsTLXV48,1135
214
214
  vellum/types/metric_node_result.py,sha256=YdKq1DZiBD1RBtjyMejImylv3BqrwY8B_UF4Ij-6_64,660
@@ -312,10 +312,10 @@ vellum/types/scenario_input.py,sha256=caC8p5ZnuXhv2ZiHvzTvKL3Ebtr4NXP9Q8UcJEVB8-
312
312
  vellum/types/scenario_input_chat_history_variable_value.py,sha256=ihgJktmZpz_12wx2yPtyrSrBjcBcSg9fby7h_eLoXgI,835
313
313
  vellum/types/scenario_input_json_variable_value.py,sha256=aKbQK2Q8IPOZq9QyjhECLqR1y42eqtddmkvH-jzPEhk,752
314
314
  vellum/types/scenario_input_string_variable_value.py,sha256=Y9UtkeqM-oBtPXGw_RXbgZNcmQiLvSUH8utTiv0a2qo,753
315
- vellum/types/search_filters_request.py,sha256=ZOndZxC2aL16zIt8F0iwHwhhXdzMsA_EMnmlUZ2XGQY,918
315
+ vellum/types/search_filters_request.py,sha256=gAE5CHxGUNR1-fu5M5L1gYll0NXE8j5fwD2wriCRJUk,1171
316
316
  vellum/types/search_node_result.py,sha256=eJaAWXzEZ-CzySXXlI51MEgdO35H7bK5NTPFJ6zLbJ0,749
317
317
  vellum/types/search_node_result_data.py,sha256=IWal6uJbfP6JpKXxeiNsKCyqjrwkN2XUxH-Bz-n6uAg,846
318
- vellum/types/search_request_options_request.py,sha256=2xcVoswjl2ry0xCnhreOYOOLN63l-50bpAXN_ZP5DHM,1316
318
+ vellum/types/search_request_options_request.py,sha256=U-71mBhO105e_fLDYMrys9VKXAuIWkAM1aMXzQUv5eM,1583
319
319
  vellum/types/search_response.py,sha256=b5301wpC3L7QUBLYAHya_JJy2BdmDvFWA0UluNJc1ig,750
320
320
  vellum/types/search_result.py,sha256=kixaodfGe19x9UFF2Axe2xawmxhnTGWXq3zE6jrkGgE,1194
321
321
  vellum/types/search_result_document.py,sha256=sbhpvfZ2wgvZx2auwOFRn92i5JZEiB2HJVPr9KGRSg0,1177
@@ -484,7 +484,7 @@ vellum/types/workflow_result_event_output_data_search_results.py,sha256=U34IK7Zv
484
484
  vellum/types/workflow_result_event_output_data_string.py,sha256=tM3kgh6tEhD0dFEb_7UU0-UspeN4pUdINCcCrD64W74,1228
485
485
  vellum/types/workflow_stream_event.py,sha256=Wn3Yzuy9MqWAeo8tEaXDTKDEbJoA8DdYdMVq8EKuhu8,361
486
486
  vellum/version.py,sha256=jq-1PlAYxN9AXuaZqbYk9ak27SgE2lw9Ia5gx1b1gVI,76
487
- vellum_ai-0.8.11.dist-info/LICENSE,sha256=CcaljEIoOBaU-wItPH4PmM_mDCGpyuUY0Er1BGu5Ti8,1073
488
- vellum_ai-0.8.11.dist-info/METADATA,sha256=bmY3g2ROKUYfMAtFjosT39W1Yd57tC6R5qFcr_ZZjjs,4395
489
- vellum_ai-0.8.11.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
490
- vellum_ai-0.8.11.dist-info/RECORD,,
487
+ vellum_ai-0.8.13.dist-info/LICENSE,sha256=CcaljEIoOBaU-wItPH4PmM_mDCGpyuUY0Er1BGu5Ti8,1073
488
+ vellum_ai-0.8.13.dist-info/METADATA,sha256=rqpR6maCbemvdA9jmQ2YPnoTEVKONY7EIwozIZ_yMfg,4395
489
+ vellum_ai-0.8.13.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
490
+ vellum_ai-0.8.13.dist-info/RECORD,,