From 4bf824d8e0aae65aff52b416f0f8b5d2d5cdc535 Mon Sep 17 00:00:00 2001 From: fern-api <115122769+fern-api[bot]@users.noreply.github.com> Date: Wed, 2 Apr 2025 17:42:10 +0000 Subject: [PATCH] SDK regeneration --- poetry.lock | 14 ++--- pyproject.toml | 2 +- reference.md | 60 ++----------------- src/credal/__init__.py | 6 ++ src/credal/copilots/__init__.py | 6 ++ src/credal/copilots/client.py | 50 ---------------- src/credal/copilots/types/__init__.py | 6 ++ src/credal/copilots/types/error_chunk.py | 20 +++++++ src/credal/copilots/types/error_chunk_data.py | 19 ++++++ src/credal/copilots/types/streaming_chunk.py | 16 +++++ src/credal/core/client_wrapper.py | 2 +- src/credal/document_catalog/client.py | 20 ------- src/credal/document_collections/client.py | 10 ---- src/credal/permissions_service/client.py | 20 ------- src/credal/search/client.py | 6 -- 15 files changed, 86 insertions(+), 171 deletions(-) create mode 100644 src/credal/copilots/types/error_chunk.py create mode 100644 src/credal/copilots/types/error_chunk_data.py diff --git a/poetry.lock b/poetry.lock index fe9ec46..2e40b52 100644 --- a/poetry.lock +++ b/poetry.lock @@ -155,13 +155,13 @@ all = ["flake8 (>=7.1.1)", "mypy (>=1.11.2)", "pytest (>=8.3.2)", "ruff (>=0.6.2 [[package]] name = "iniconfig" -version = "2.0.0" +version = "2.1.0" description = "brain-dead simple config-ini parsing" optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "iniconfig-2.0.0-py3-none-any.whl", hash = "sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374"}, - {file = "iniconfig-2.0.0.tar.gz", hash = "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3"}, + {file = "iniconfig-2.1.0-py3-none-any.whl", hash = "sha256:9deba5723312380e77435581c6bf4935c94cbfab9b1ed33ef8d238ea168eb760"}, + {file = "iniconfig-2.1.0.tar.gz", hash = "sha256:3abbd2e30b36733fee78f9c7f7308f2d0050e88f0087fd25c2645f63c773e1c7"}, ] [[package]] @@ -536,13 +536,13 @@ files = [ [[package]] name = "typing-extensions" -version = "4.12.2" +version = "4.13.0" description = "Backported and Experimental Type Hints for Python 3.8+" optional = false python-versions = ">=3.8" files = [ - {file = "typing_extensions-4.12.2-py3-none-any.whl", hash = "sha256:04e5ca0351e0f3f85c6853954072df659d0d13fac324d0072316b67d7794700d"}, - {file = "typing_extensions-4.12.2.tar.gz", hash = "sha256:1a7ead55c7e559dd4dee8856e3a88b41225abfe1ce8df57b7c13915fe121ffb8"}, + {file = "typing_extensions-4.13.0-py3-none-any.whl", hash = "sha256:c8dd92cc0d6425a97c18fbb9d1954e5ff92c1ca881a309c45f06ebc0b79058e5"}, + {file = "typing_extensions-4.13.0.tar.gz", hash = "sha256:0a4ac55a5820789d87e297727d229866c9650f6521b64206413c4fbada24d95b"}, ] [metadata] diff --git a/pyproject.toml b/pyproject.toml index 368bea9..07e01a1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ name = "credal" [tool.poetry] name = "credal" -version = "0.0.24" +version = "0.0.25" description = "" readme = "README.md" authors = [] diff --git a/reference.md b/reference.md index a1f5bd2..401f13b 100644 --- a/reference.md +++ b/reference.md @@ -59,7 +59,6 @@ client.copilots.create_copilot(
**name:** `str` — A descriptive name for the copilot. -
@@ -68,7 +67,6 @@ client.copilots.create_copilot(
**description:** `str` — An in depth name for the copilot's function. Useful for routing requests to the right copilot. -
@@ -77,7 +75,6 @@ client.copilots.create_copilot(
**collaborators:** `typing.Sequence[Collaborator]` — A list of collaborator emails and roles that will have access to the copilot. -
@@ -153,7 +150,6 @@ client.copilots.create_conversation(
**agent_id:** `uuid.UUID` — Credal-generated Copilot ID to specify which agent to route the request to. -
@@ -162,7 +158,6 @@ client.copilots.create_conversation(
**user_email:** `str` — End-user for the conversation. -
@@ -233,7 +228,6 @@ client.copilots.provide_message_feedback(
**agent_id:** `uuid.UUID` — Credal-generated Copilot ID to specify which agent to route the request to. -
@@ -242,7 +236,6 @@ client.copilots.provide_message_feedback(
**user_email:** `str` — The user profile you want to use when providing feedback. -
@@ -251,7 +244,6 @@ client.copilots.provide_message_feedback(
**message_id:** `uuid.UUID` — The message ID for which feedback is being provided. -
@@ -260,7 +252,6 @@ client.copilots.provide_message_feedback(
**message_feedback:** `MessageFeedback` — The feedback provided by the user. -
@@ -345,7 +336,6 @@ client.copilots.send_message(
**agent_id:** `uuid.UUID` — Credal-generated Copilot ID to specify which agent to route the request to. -
@@ -354,7 +344,6 @@ client.copilots.send_message(
**message:** `str` — The message you want to send to your copilot. -
@@ -363,7 +352,6 @@ client.copilots.send_message(
**user_email:** `str` — The user profile you want to use when sending the message. -
@@ -372,7 +360,6 @@ client.copilots.send_message(
**conversation_id:** `typing.Optional[uuid.UUID]` — Credal-generated conversation ID for sending follow up messages. Conversation ID is returned after initial message. Optional, to be left off for first messages on new conversations. -
@@ -381,7 +368,6 @@ client.copilots.send_message(
**input_variables:** `typing.Optional[typing.Sequence[InputVariable]]` — Optional input variables to be used in the message. Map the name of the variable to a list of urls. -
@@ -438,16 +424,16 @@ client = CredalApi( ) response = client.copilots.stream_message( copilot_id=uuid.UUID( - "82e4b12a-6990-45d4-8ebd-85c00e030c24", + "82e4b12a-6990-45d4-8ebd-85c00e030c25", ), - message="Is this user eligible for benefits based on their date of birth?", + message="Is Credal SOC 2 compliant?", email="ravin@credal.ai", input_variables=[ InputVariable( name="input1", ids=[ uuid.UUID( - "82e4b12a-6990-45d4-8ebd-85c00e030c26", + "82e4b12a-6990-45d4-8ebd-85c00e030c24", ) ], ), @@ -458,7 +444,7 @@ response = client.copilots.stream_message( "82e4b12a-6990-45d4-8ebd-85c00e030c25", ), uuid.UUID( - "82e4b12a-6990-45d4-8ebd-85c00e030c24", + "82e4b12a-6990-45d4-8ebd-85c00e030c26", ), ], ), @@ -482,7 +468,6 @@ for chunk in response:
**copilot_id:** `uuid.UUID` — Credal-generated Copilot ID to specify which agent to route the request to. -
@@ -491,7 +476,6 @@ for chunk in response:
**message:** `str` — The message you want to send to your copilot. -
@@ -500,7 +484,6 @@ for chunk in response:
**email:** `str` — The user profile you want to use when sending the message. -
@@ -509,7 +492,6 @@ for chunk in response:
**conversation_id:** `typing.Optional[uuid.UUID]` — Credal-generated conversation ID for sending follow up messages. Conversation ID is returned after initial message. Optional, to be left off for first messages on new conversations. -
@@ -518,7 +500,6 @@ for chunk in response:
**input_variables:** `typing.Optional[typing.Sequence[InputVariable]]` — Optional input variables to be used in the message. Map the name of the variable to a list of urls. -
@@ -596,7 +577,6 @@ client.copilots.add_collection_to_copilot(
**copilot_id:** `uuid.UUID` — Credal-generated copilot ID to add the collection to. -
@@ -605,7 +585,6 @@ client.copilots.add_collection_to_copilot(
**collection_id:** `uuid.UUID` — Credal-generated collection ID to add. -
@@ -683,7 +662,6 @@ client.copilots.remove_collection_from_copilot(
**copilot_id:** `uuid.UUID` — Credal-generated copilot ID to add the collection to. -
@@ -692,7 +670,6 @@ client.copilots.remove_collection_from_copilot(
**collection_id:** `uuid.UUID` — Credal-generated collection ID to add. -
@@ -777,7 +754,6 @@ client.copilots.update_configuration(
**copilot_id:** `uuid.UUID` — Credal-generated copilot ID to add the collection to. -
@@ -907,7 +883,6 @@ client.document_catalog.upload_document_contents(
**document_name:** `str` — The name of the document you want to upload. -
@@ -916,7 +891,6 @@ client.document_catalog.upload_document_contents(
**document_contents:** `str` — The full LLM-formatted text contents of the document you want to upload. -
@@ -925,7 +899,6 @@ client.document_catalog.upload_document_contents(
**allowed_users_email_addresses:** `typing.Sequence[str]` — Users allowed to access the document. Unlike Credal's out of the box connectors which reconcile various permissions models from 3rd party software, for custom uploads the caller is responsible for specifying who can access the document and currently flattening groups if applicable. Documents can also be marked as internal public. -
@@ -934,7 +907,6 @@ client.document_catalog.upload_document_contents(
**upload_as_user_email:** `str` — [Legacy] The user on behalf of whom the document should be uploaded. In most cases, this can simply be the email of the developer making the API call. This field will be removed in the future in favor of purely specifying permissions via allowedUsersEmailAddresses. -
@@ -943,7 +915,6 @@ client.document_catalog.upload_document_contents(
**document_external_id:** `str` — The external ID of the document. This is typically the ID as it exists in its original external system. Uploads to the same external ID will update the document in Credal. -
@@ -952,7 +923,6 @@ client.document_catalog.upload_document_contents(
**document_external_url:** `typing.Optional[str]` — The external URL of the document you want to upload. If provided Credal will link to this URL. -
@@ -961,7 +931,6 @@ client.document_catalog.upload_document_contents(
**custom_metadata:** `typing.Optional[typing.Optional[typing.Any]]` — Optional JSON representing any custom metdata for this document -
@@ -970,7 +939,6 @@ client.document_catalog.upload_document_contents(
**collection_id:** `typing.Optional[str]` — If specified, document will also be added to a particular document collection -
@@ -979,7 +947,6 @@ client.document_catalog.upload_document_contents(
**force_update:** `typing.Optional[bool]` — If specified, document contents will be re-uploaded and re-embedded even if the document already exists in Credal -
@@ -988,7 +955,6 @@ client.document_catalog.upload_document_contents(
**internal_public:** `typing.Optional[bool]` — If specified, document will be accessible to everyone within the organization of the uploader -
@@ -1258,7 +1224,6 @@ client.document_collections.add_documents_to_collection(
**resource_identifiers:** `typing.Sequence[ResourceIdentifier]` — The set of resource identifier for which you want to add to the collection. -
@@ -1352,7 +1317,6 @@ client.document_collections.remove_documents_from_collection(
**resource_identifiers:** `typing.Sequence[ResourceIdentifier]` — The set of resource identifier for which you want to remove from the collection -
@@ -1431,7 +1395,6 @@ client.document_collections.create_collection(
**name:** `str` — A descriptive name for the collection. -
@@ -1440,7 +1403,6 @@ client.document_collections.create_collection(
**description:** `str` — An in depth name for the copilot's function. Useful for routing requests to the right copilot. -
@@ -1449,7 +1411,6 @@ client.document_collections.create_collection(
**collaborators:** `typing.Sequence[Collaborator]` — A list of collaborator emails and roles that will have access to the copilot. -
@@ -1814,7 +1775,6 @@ client.permissions_service.check_resource_authorization_for_user(
**resource_identifier:** `ResourceIdentifier` — The resource identifier for which you want to check authorization. -
@@ -1823,7 +1783,6 @@ client.permissions_service.check_resource_authorization_for_user(
**user_email:** `str` — The user email to check authorization for. -
@@ -1832,7 +1791,6 @@ client.permissions_service.check_resource_authorization_for_user(
**disable_cache:** `typing.Optional[bool]` — If specified, Credal will bypass the permissions cache and check current permissions for this resource -
@@ -1916,7 +1874,6 @@ client.permissions_service.check_bulk_resources_authorization_for_user(
**resource_identifiers:** `typing.Sequence[ResourceIdentifier]` — The set of resource identifier for which you want to check authorization. Currently limited to 20 resources. -
@@ -1925,7 +1882,6 @@ client.permissions_service.check_bulk_resources_authorization_for_user(
**user_email:** `str` — The user email to check authorization for. -
@@ -1934,7 +1890,6 @@ client.permissions_service.check_bulk_resources_authorization_for_user(
**disable_cache:** `typing.Optional[bool]` — If specified, Credal will bypass the permissions cache and check current permissions for all resources specified. -
@@ -2005,7 +1960,6 @@ client.permissions_service.list_cached_authorized_resources_for_user(
**user_email:** `str` — The user email to list authorized resources for. -
@@ -2014,7 +1968,6 @@ client.permissions_service.list_cached_authorized_resources_for_user(
**resource_type:** `typing.Optional[ResourceType]` — The type of resource you want to list. If not specified, all resource types will be listed. -
@@ -2023,7 +1976,6 @@ client.permissions_service.list_cached_authorized_resources_for_user(
**limit:** `typing.Optional[int]` — The maximum number of resources to return. Defaults to 100. -
@@ -2032,7 +1984,6 @@ client.permissions_service.list_cached_authorized_resources_for_user(
**offset:** `typing.Optional[int]` — The offset to use for pagination. If not specified, the first page of results will be returned. -
@@ -2142,7 +2093,6 @@ client.search.search_document_collection(
**user_email:** `str` — The email of the user making the search request for permissions reduction. -
@@ -2151,7 +2101,6 @@ client.search.search_document_collection(
**structured_query_filters:** `typing.Optional[typing.Sequence[SingleFieldFilter]]` — The structured query filters to apply to the search query. -
@@ -2168,7 +2117,6 @@ client.search.search_document_collection(
**metadata_filter_expression:** `typing.Optional[str]` — Legacy metadata filter expression to apply to the search query. Use structuredQueryFilters instead. -
diff --git a/src/credal/__init__.py b/src/credal/__init__.py index 8bc95ee..bb02902 100644 --- a/src/credal/__init__.py +++ b/src/credal/__init__.py @@ -26,6 +26,8 @@ DatetimeFieldSchema, DeleteCopilotResponse, EndOfMessageChunk, + ErrorChunk, + ErrorChunkData, FeedbackEnum, Filter, Filter_Boolean, @@ -51,6 +53,7 @@ StreamingChunk_Blocked, StreamingChunk_DataChunk, StreamingChunk_EndOfMessage, + StreamingChunk_ErrorChunk, StreamingChunk_FinalChunk, StreamingChunk_Initial, StringFieldSchema, @@ -123,6 +126,8 @@ "DocumentMetadataPatch", "DocumentMetadataPatchRequest", "EndOfMessageChunk", + "ErrorChunk", + "ErrorChunkData", "ExternalResourceId", "FeedbackEnum", "Filter", @@ -167,6 +172,7 @@ "StreamingChunk_Blocked", "StreamingChunk_DataChunk", "StreamingChunk_EndOfMessage", + "StreamingChunk_ErrorChunk", "StreamingChunk_FinalChunk", "StreamingChunk_Initial", "StringFieldSchema", diff --git a/src/credal/copilots/__init__.py b/src/credal/copilots/__init__.py index f25d792..c186a3c 100644 --- a/src/credal/copilots/__init__.py +++ b/src/credal/copilots/__init__.py @@ -13,6 +13,8 @@ DatetimeFieldSchema, DeleteCopilotResponse, EndOfMessageChunk, + ErrorChunk, + ErrorChunkData, FeedbackEnum, Filter, Filter_Boolean, @@ -38,6 +40,7 @@ StreamingChunk_Blocked, StreamingChunk_DataChunk, StreamingChunk_EndOfMessage, + StreamingChunk_ErrorChunk, StreamingChunk_FinalChunk, StreamingChunk_Initial, StringFieldSchema, @@ -57,6 +60,8 @@ "DatetimeFieldSchema", "DeleteCopilotResponse", "EndOfMessageChunk", + "ErrorChunk", + "ErrorChunkData", "FeedbackEnum", "Filter", "Filter_Boolean", @@ -82,6 +87,7 @@ "StreamingChunk_Blocked", "StreamingChunk_DataChunk", "StreamingChunk_EndOfMessage", + "StreamingChunk_ErrorChunk", "StreamingChunk_FinalChunk", "StreamingChunk_Initial", "StringFieldSchema", diff --git a/src/credal/copilots/client.py b/src/credal/copilots/client.py index 6f18c8a..029bab8 100644 --- a/src/credal/copilots/client.py +++ b/src/credal/copilots/client.py @@ -45,15 +45,12 @@ def create_copilot( name : str A descriptive name for the copilot. - description : str An in depth name for the copilot's function. Useful for routing requests to the right copilot. - collaborators : typing.Sequence[Collaborator] A list of collaborator emails and roles that will have access to the copilot. - request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -118,11 +115,9 @@ def create_conversation( agent_id : uuid.UUID Credal-generated Copilot ID to specify which agent to route the request to. - user_email : str End-user for the conversation. - request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -185,19 +180,15 @@ def provide_message_feedback( agent_id : uuid.UUID Credal-generated Copilot ID to specify which agent to route the request to. - user_email : str The user profile you want to use when providing feedback. - message_id : uuid.UUID The message ID for which feedback is being provided. - message_feedback : MessageFeedback The feedback provided by the user. - request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -268,23 +259,18 @@ def send_message( agent_id : uuid.UUID Credal-generated Copilot ID to specify which agent to route the request to. - message : str The message you want to send to your copilot. - user_email : str The user profile you want to use when sending the message. - conversation_id : typing.Optional[uuid.UUID] Credal-generated conversation ID for sending follow up messages. Conversation ID is returned after initial message. Optional, to be left off for first messages on new conversations. - input_variables : typing.Optional[typing.Sequence[InputVariable]] Optional input variables to be used in the message. Map the name of the variable to a list of urls. - request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -378,23 +364,18 @@ def stream_message( copilot_id : uuid.UUID Credal-generated Copilot ID to specify which agent to route the request to. - message : str The message you want to send to your copilot. - email : str The user profile you want to use when sending the message. - conversation_id : typing.Optional[uuid.UUID] Credal-generated conversation ID for sending follow up messages. Conversation ID is returned after initial message. Optional, to be left off for first messages on new conversations. - input_variables : typing.Optional[typing.Sequence[InputVariable]] Optional input variables to be used in the message. Map the name of the variable to a list of urls. - request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -403,7 +384,6 @@ def stream_message( typing.Iterator[StreamingChunk] This endpoint returns a stream of server sent events. These can be in two formats - one is an initial event, followed by multiple data chunks, followed by a final chunk, or the other format is just one blocked event. See the examples for more details. - Examples -------- import uuid @@ -496,11 +476,9 @@ def add_collection_to_copilot( copilot_id : uuid.UUID Credal-generated copilot ID to add the collection to. - collection_id : uuid.UUID Credal-generated collection ID to add. - request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -559,11 +537,9 @@ def remove_collection_from_copilot( copilot_id : uuid.UUID Credal-generated copilot ID to add the collection to. - collection_id : uuid.UUID Credal-generated collection ID to add. - request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -622,7 +598,6 @@ def update_configuration( copilot_id : uuid.UUID Credal-generated copilot ID to add the collection to. - configuration : Configuration request_options : typing.Optional[RequestOptions] @@ -752,15 +727,12 @@ async def create_copilot( name : str A descriptive name for the copilot. - description : str An in depth name for the copilot's function. Useful for routing requests to the right copilot. - collaborators : typing.Sequence[Collaborator] A list of collaborator emails and roles that will have access to the copilot. - request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -833,11 +805,9 @@ async def create_conversation( agent_id : uuid.UUID Credal-generated Copilot ID to specify which agent to route the request to. - user_email : str End-user for the conversation. - request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -907,19 +877,15 @@ async def provide_message_feedback( agent_id : uuid.UUID Credal-generated Copilot ID to specify which agent to route the request to. - user_email : str The user profile you want to use when providing feedback. - message_id : uuid.UUID The message ID for which feedback is being provided. - message_feedback : MessageFeedback The feedback provided by the user. - request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -997,23 +963,18 @@ async def send_message( agent_id : uuid.UUID Credal-generated Copilot ID to specify which agent to route the request to. - message : str The message you want to send to your copilot. - user_email : str The user profile you want to use when sending the message. - conversation_id : typing.Optional[uuid.UUID] Credal-generated conversation ID for sending follow up messages. Conversation ID is returned after initial message. Optional, to be left off for first messages on new conversations. - input_variables : typing.Optional[typing.Sequence[InputVariable]] Optional input variables to be used in the message. Map the name of the variable to a list of urls. - request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -1114,23 +1075,18 @@ async def stream_message( copilot_id : uuid.UUID Credal-generated Copilot ID to specify which agent to route the request to. - message : str The message you want to send to your copilot. - email : str The user profile you want to use when sending the message. - conversation_id : typing.Optional[uuid.UUID] Credal-generated conversation ID for sending follow up messages. Conversation ID is returned after initial message. Optional, to be left off for first messages on new conversations. - input_variables : typing.Optional[typing.Sequence[InputVariable]] Optional input variables to be used in the message. Map the name of the variable to a list of urls. - request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -1139,7 +1095,6 @@ async def stream_message( typing.AsyncIterator[StreamingChunk] This endpoint returns a stream of server sent events. These can be in two formats - one is an initial event, followed by multiple data chunks, followed by a final chunk, or the other format is just one blocked event. See the examples for more details. - Examples -------- import asyncio @@ -1239,11 +1194,9 @@ async def add_collection_to_copilot( copilot_id : uuid.UUID Credal-generated copilot ID to add the collection to. - collection_id : uuid.UUID Credal-generated collection ID to add. - request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -1309,11 +1262,9 @@ async def remove_collection_from_copilot( copilot_id : uuid.UUID Credal-generated copilot ID to add the collection to. - collection_id : uuid.UUID Credal-generated collection ID to add. - request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -1379,7 +1330,6 @@ async def update_configuration( copilot_id : uuid.UUID Credal-generated copilot ID to add the collection to. - configuration : Configuration request_options : typing.Optional[RequestOptions] diff --git a/src/credal/copilots/types/__init__.py b/src/credal/copilots/types/__init__.py index 9b30138..9ea357d 100644 --- a/src/credal/copilots/types/__init__.py +++ b/src/credal/copilots/types/__init__.py @@ -12,6 +12,8 @@ from .datetime_field_schema import DatetimeFieldSchema from .delete_copilot_response import DeleteCopilotResponse from .end_of_message_chunk import EndOfMessageChunk +from .error_chunk import ErrorChunk +from .error_chunk_data import ErrorChunkData from .feedback_enum import FeedbackEnum from .filter import Filter, Filter_Boolean, Filter_Datetime, Filter_Number, Filter_String from .final_chunk import FinalChunk @@ -36,6 +38,7 @@ StreamingChunk_Blocked, StreamingChunk_DataChunk, StreamingChunk_EndOfMessage, + StreamingChunk_ErrorChunk, StreamingChunk_FinalChunk, StreamingChunk_Initial, ) @@ -55,6 +58,8 @@ "DatetimeFieldSchema", "DeleteCopilotResponse", "EndOfMessageChunk", + "ErrorChunk", + "ErrorChunkData", "FeedbackEnum", "Filter", "Filter_Boolean", @@ -80,6 +85,7 @@ "StreamingChunk_Blocked", "StreamingChunk_DataChunk", "StreamingChunk_EndOfMessage", + "StreamingChunk_ErrorChunk", "StreamingChunk_FinalChunk", "StreamingChunk_Initial", "StringFieldSchema", diff --git a/src/credal/copilots/types/error_chunk.py b/src/credal/copilots/types/error_chunk.py new file mode 100644 index 0000000..a79c4ea --- /dev/null +++ b/src/credal/copilots/types/error_chunk.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +from ...core.pydantic_utilities import UniversalBaseModel +from .error_chunk_data import ErrorChunkData +from ...core.pydantic_utilities import IS_PYDANTIC_V2 +import typing +import pydantic + + +class ErrorChunk(UniversalBaseModel): + error: ErrorChunkData + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/credal/copilots/types/error_chunk_data.py b/src/credal/copilots/types/error_chunk_data.py new file mode 100644 index 0000000..d8a71ff --- /dev/null +++ b/src/credal/copilots/types/error_chunk_data.py @@ -0,0 +1,19 @@ +# This file was auto-generated by Fern from our API Definition. + +from ...core.pydantic_utilities import UniversalBaseModel +from ...core.pydantic_utilities import IS_PYDANTIC_V2 +import typing +import pydantic + + +class ErrorChunkData(UniversalBaseModel): + message: str + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/credal/copilots/types/streaming_chunk.py b/src/credal/copilots/types/streaming_chunk.py index a4a7435..053f640 100644 --- a/src/credal/copilots/types/streaming_chunk.py +++ b/src/credal/copilots/types/streaming_chunk.py @@ -12,6 +12,7 @@ from .referenced_source import ReferencedSource import uuid from .policy_trigger import PolicyTrigger +from .error_chunk_data import ErrorChunkData class StreamingChunk_Initial(UniversalBaseModel): @@ -91,10 +92,25 @@ class Config: extra = pydantic.Extra.allow +class StreamingChunk_ErrorChunk(UniversalBaseModel): + event: typing.Literal["error_chunk"] = "error_chunk" + error: ErrorChunkData + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow + + StreamingChunk = typing.Union[ StreamingChunk_Initial, StreamingChunk_DataChunk, StreamingChunk_EndOfMessage, StreamingChunk_FinalChunk, StreamingChunk_Blocked, + StreamingChunk_ErrorChunk, ] diff --git a/src/credal/core/client_wrapper.py b/src/credal/core/client_wrapper.py index 2b4bd91..7c29724 100644 --- a/src/credal/core/client_wrapper.py +++ b/src/credal/core/client_wrapper.py @@ -22,7 +22,7 @@ def get_headers(self) -> typing.Dict[str, str]: headers: typing.Dict[str, str] = { "X-Fern-Language": "Python", "X-Fern-SDK-Name": "credal", - "X-Fern-SDK-Version": "0.0.24", + "X-Fern-SDK-Version": "0.0.25", } headers["Authorization"] = f"Bearer {self._get_api_key()}" return headers diff --git a/src/credal/document_catalog/client.py b/src/credal/document_catalog/client.py index 6a0044d..44f2d2f 100644 --- a/src/credal/document_catalog/client.py +++ b/src/credal/document_catalog/client.py @@ -41,43 +41,33 @@ def upload_document_contents( document_name : str The name of the document you want to upload. - document_contents : str The full LLM-formatted text contents of the document you want to upload. - allowed_users_email_addresses : typing.Sequence[str] Users allowed to access the document. Unlike Credal's out of the box connectors which reconcile various permissions models from 3rd party software, for custom uploads the caller is responsible for specifying who can access the document and currently flattening groups if applicable. Documents can also be marked as internal public. - upload_as_user_email : str [Legacy] The user on behalf of whom the document should be uploaded. In most cases, this can simply be the email of the developer making the API call. This field will be removed in the future in favor of purely specifying permissions via allowedUsersEmailAddresses. - document_external_id : str The external ID of the document. This is typically the ID as it exists in its original external system. Uploads to the same external ID will update the document in Credal. - document_external_url : typing.Optional[str] The external URL of the document you want to upload. If provided Credal will link to this URL. - custom_metadata : typing.Optional[typing.Optional[typing.Any]] Optional JSON representing any custom metdata for this document - collection_id : typing.Optional[str] If specified, document will also be added to a particular document collection - force_update : typing.Optional[bool] If specified, document contents will be re-uploaded and re-embedded even if the document already exists in Credal - internal_public : typing.Optional[bool] If specified, document will be accessible to everyone within the organization of the uploader - request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -285,43 +275,33 @@ async def upload_document_contents( document_name : str The name of the document you want to upload. - document_contents : str The full LLM-formatted text contents of the document you want to upload. - allowed_users_email_addresses : typing.Sequence[str] Users allowed to access the document. Unlike Credal's out of the box connectors which reconcile various permissions models from 3rd party software, for custom uploads the caller is responsible for specifying who can access the document and currently flattening groups if applicable. Documents can also be marked as internal public. - upload_as_user_email : str [Legacy] The user on behalf of whom the document should be uploaded. In most cases, this can simply be the email of the developer making the API call. This field will be removed in the future in favor of purely specifying permissions via allowedUsersEmailAddresses. - document_external_id : str The external ID of the document. This is typically the ID as it exists in its original external system. Uploads to the same external ID will update the document in Credal. - document_external_url : typing.Optional[str] The external URL of the document you want to upload. If provided Credal will link to this URL. - custom_metadata : typing.Optional[typing.Optional[typing.Any]] Optional JSON representing any custom metdata for this document - collection_id : typing.Optional[str] If specified, document will also be added to a particular document collection - force_update : typing.Optional[bool] If specified, document contents will be re-uploaded and re-embedded even if the document already exists in Credal - internal_public : typing.Optional[bool] If specified, document will be accessible to everyone within the organization of the uploader - request_options : typing.Optional[RequestOptions] Request-specific configuration. diff --git a/src/credal/document_collections/client.py b/src/credal/document_collections/client.py index e5b36bf..4f95afd 100644 --- a/src/credal/document_collections/client.py +++ b/src/credal/document_collections/client.py @@ -42,7 +42,6 @@ def add_documents_to_collection( resource_identifiers : typing.Sequence[ResourceIdentifier] The set of resource identifier for which you want to add to the collection. - request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -114,7 +113,6 @@ def remove_documents_from_collection( resource_identifiers : typing.Sequence[ResourceIdentifier] The set of resource identifier for which you want to remove from the collection - request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -184,15 +182,12 @@ def create_collection( name : str A descriptive name for the collection. - description : str An in depth name for the copilot's function. Useful for routing requests to the right copilot. - collaborators : typing.Sequence[Collaborator] A list of collaborator emails and roles that will have access to the copilot. - request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -494,7 +489,6 @@ async def add_documents_to_collection( resource_identifiers : typing.Sequence[ResourceIdentifier] The set of resource identifier for which you want to add to the collection. - request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -573,7 +567,6 @@ async def remove_documents_from_collection( resource_identifiers : typing.Sequence[ResourceIdentifier] The set of resource identifier for which you want to remove from the collection - request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -650,15 +643,12 @@ async def create_collection( name : str A descriptive name for the collection. - description : str An in depth name for the copilot's function. Useful for routing requests to the right copilot. - collaborators : typing.Sequence[Collaborator] A list of collaborator emails and roles that will have access to the copilot. - request_options : typing.Optional[RequestOptions] Request-specific configuration. diff --git a/src/credal/permissions_service/client.py b/src/credal/permissions_service/client.py index 22bcb3b..8d6767f 100644 --- a/src/credal/permissions_service/client.py +++ b/src/credal/permissions_service/client.py @@ -38,15 +38,12 @@ def check_resource_authorization_for_user( resource_identifier : ResourceIdentifier The resource identifier for which you want to check authorization. - user_email : str The user email to check authorization for. - disable_cache : typing.Optional[bool] If specified, Credal will bypass the permissions cache and check current permissions for this resource - request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -113,15 +110,12 @@ def check_bulk_resources_authorization_for_user( resource_identifiers : typing.Sequence[ResourceIdentifier] The set of resource identifier for which you want to check authorization. Currently limited to 20 resources. - user_email : str The user email to check authorization for. - disable_cache : typing.Optional[bool] If specified, Credal will bypass the permissions cache and check current permissions for all resources specified. - request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -197,19 +191,15 @@ def list_cached_authorized_resources_for_user( user_email : str The user email to list authorized resources for. - resource_type : typing.Optional[ResourceType] The type of resource you want to list. If not specified, all resource types will be listed. - limit : typing.Optional[int] The maximum number of resources to return. Defaults to 100. - offset : typing.Optional[int] The offset to use for pagination. If not specified, the first page of results will be returned. - request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -275,15 +265,12 @@ async def check_resource_authorization_for_user( resource_identifier : ResourceIdentifier The resource identifier for which you want to check authorization. - user_email : str The user email to check authorization for. - disable_cache : typing.Optional[bool] If specified, Credal will bypass the permissions cache and check current permissions for this resource - request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -358,15 +345,12 @@ async def check_bulk_resources_authorization_for_user( resource_identifiers : typing.Sequence[ResourceIdentifier] The set of resource identifier for which you want to check authorization. Currently limited to 20 resources. - user_email : str The user email to check authorization for. - disable_cache : typing.Optional[bool] If specified, Credal will bypass the permissions cache and check current permissions for all resources specified. - request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -450,19 +434,15 @@ async def list_cached_authorized_resources_for_user( user_email : str The user email to list authorized resources for. - resource_type : typing.Optional[ResourceType] The type of resource you want to list. If not specified, all resource types will be listed. - limit : typing.Optional[int] The maximum number of resources to return. Defaults to 100. - offset : typing.Optional[int] The offset to use for pagination. If not specified, the first page of results will be returned. - request_options : typing.Optional[RequestOptions] Request-specific configuration. diff --git a/src/credal/search/client.py b/src/credal/search/client.py index 64b8485..97168e0 100644 --- a/src/credal/search/client.py +++ b/src/credal/search/client.py @@ -44,17 +44,14 @@ def search_document_collection( user_email : str The email of the user making the search request for permissions reduction. - structured_query_filters : typing.Optional[typing.Sequence[SingleFieldFilter]] The structured query filters to apply to the search query. - search_options : typing.Optional[DocumentCollectionSearchOptions] metadata_filter_expression : typing.Optional[str] Legacy metadata filter expression to apply to the search query. Use structuredQueryFilters instead. - request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -155,17 +152,14 @@ async def search_document_collection( user_email : str The email of the user making the search request for permissions reduction. - structured_query_filters : typing.Optional[typing.Sequence[SingleFieldFilter]] The structured query filters to apply to the search query. - search_options : typing.Optional[DocumentCollectionSearchOptions] metadata_filter_expression : typing.Optional[str] Legacy metadata filter expression to apply to the search query. Use structuredQueryFilters instead. - request_options : typing.Optional[RequestOptions] Request-specific configuration.