From e54d72456ba499ff54a557a84bb69ec6a338c5a9 Mon Sep 17 00:00:00 2001 From: opper-bot Date: Fri, 27 Jun 2025 12:51:58 +0000 Subject: [PATCH 1/2] chore: update SDK via automated generation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Run speakeasy generation - Apply parameter name fixes - Apply schema conversion patches Generated on: 2025-06-27 12:51:58 UTC 🤖 This PR was created automatically by the SDK generation workflow. --- .speakeasy/gen.lock | 41 +++++++++---- .speakeasy/gen.yaml | 2 +- .speakeasy/workflow.lock | 11 ++-- README.md | 18 +++--- USAGE.md | 4 +- ...knowledgeknowledgebaseidaddpostrequest.md} | 2 +- docs/models/addrequest.md | 12 ++-- docs/models/fileprocessconfiguration.md | 10 ---- docs/models/pdfprocessorname.md | 8 --- docs/models/registerfileuploadrequest.md | 12 ++-- docs/models/textprocessingconfiguration.md | 9 +++ docs/models/updatespanrequest.md | 4 +- docs/sdks/datasets/README.md | 2 +- docs/sdks/embeddings/README.md | 2 +- docs/sdks/entries/README.md | 2 +- docs/sdks/functions/README.md | 8 +-- docs/sdks/knowledge/README.md | 38 ++++++------ docs/sdks/opper/README.md | 4 +- docs/sdks/spans/README.md | 8 +-- pyproject.toml | 2 +- src/opperai/_version.py | 4 +- src/opperai/datasets.py | 8 +-- src/opperai/embeddings.py | 8 +-- src/opperai/entries.py | 8 +-- src/opperai/functions.py | 60 ++++++++++++++----- src/opperai/knowledge.py | 42 ++++++------- src/opperai/models/__init__.py | 33 +++++----- ...knowledge_knowledge_base_id_add_postop.py} | 4 +- src/opperai/models/addrequest.py | 10 ++-- .../models/fileprocessconfiguration.py | 21 ------- src/opperai/models/pdfprocessorname.py | 8 --- .../models/registerfileuploadrequest.py | 10 ++-- .../models/textprocessingconfiguration.py | 26 ++++++++ src/opperai/sdk.py | 44 +++++++++++--- src/opperai/spans.py | 32 +++++----- .../sdk/models/components/addrequest.go | 4 +- .../components/fileprocessconfiguration.go | 45 -------------- .../sdk/models/components/pdfprocessorname.go | 31 ---------- .../components/registerfileuploadrequest.go | 4 +- .../components/textprocessingconfiguration.go | 39 ++++++++++++ ... => addknowledgeknowledgebaseidaddpost.go} | 12 ++-- 41 files changed, 337 insertions(+), 315 deletions(-) rename docs/models/{addknowledgeknowledgebaseidindexpostrequest.md => addknowledgeknowledgebaseidaddpostrequest.md} (94%) delete mode 100644 docs/models/fileprocessconfiguration.md delete mode 100644 docs/models/pdfprocessorname.md create mode 100644 docs/models/textprocessingconfiguration.md rename src/opperai/models/{add_knowledge_knowledge_base_id_index_postop.py => add_knowledge_knowledge_base_id_add_postop.py} (85%) delete mode 100644 src/opperai/models/fileprocessconfiguration.py delete mode 100644 src/opperai/models/pdfprocessorname.py create mode 100644 src/opperai/models/textprocessingconfiguration.py delete mode 100644 tests/mockserver/internal/sdk/models/components/fileprocessconfiguration.go delete mode 100644 tests/mockserver/internal/sdk/models/components/pdfprocessorname.go create mode 100644 tests/mockserver/internal/sdk/models/components/textprocessingconfiguration.go rename tests/mockserver/internal/sdk/models/operations/{addknowledgeknowledgebaseidindexpost.go => addknowledgeknowledgebaseidaddpost.go} (61%) diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 897c0f0..44736fc 100644 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,12 +1,12 @@ lockVersion: 2.0.0 id: c75567cf-9def-4617-8ae7-65af6f367b68 management: - docChecksum: b257fe397b830f66ca9655441beb6bbb + docChecksum: 13be598dda17c8e41e2eae5c2a468111 docVersion: 2.0.0 speakeasyVersion: 1.570.2 generationVersion: 2.638.5 - releaseVersion: 1.0.0 - configChecksum: 5c696518717cf88e97b25602d10ac86a + releaseVersion: 1.0.1 + configChecksum: 8ecbcaa4f87221d7c6c138e9953c2432 features: python: additionalDependencies: 1.0.0 @@ -48,7 +48,7 @@ generatedFiles: - docs/errors/notfounderror.md - docs/errors/requestvalidationerror.md - docs/errors/unauthorizederror.md - - docs/models/addknowledgeknowledgebaseidindexpostrequest.md + - docs/models/addknowledgeknowledgebaseidaddpostrequest.md - docs/models/addrequest.md - docs/models/annotation.md - docs/models/annotationurlcitation.md @@ -143,7 +143,6 @@ generatedFiles: - docs/models/examplein.md - docs/models/file.md - docs/models/filefile.md - - docs/models/fileprocessconfiguration.md - docs/models/filter_.md - docs/models/finishreason.md - docs/models/functioncallconfiguration.md @@ -213,7 +212,6 @@ generatedFiles: - docs/models/paginatedresponselistspanmetricsresponse.md - docs/models/paginatedresponselisttracesresponse.md - docs/models/payload.md - - docs/models/pdfprocessorname.md - docs/models/prompttokensdetails.md - docs/models/querydatasetentriesdatasetsdatasetidentriesquerypostrequest.md - docs/models/querydatasetentriesresponse.md @@ -243,6 +241,7 @@ generatedFiles: - docs/models/streamfunctionrevisionfunctionsfunctionidcallstreamrevisionidpostrequest.md - docs/models/streamfunctionrevisionfunctionsfunctionidcallstreamrevisionidpostresponse.md - docs/models/streamfunctionrevisionfunctionsfunctionidcallstreamrevisionidpostresponsebody.md + - docs/models/textprocessingconfiguration.md - docs/models/tmodel.md - docs/models/tmodel1.md - docs/models/toplogprob.md @@ -311,7 +310,7 @@ generatedFiles: - src/opperai/knowledge.py - src/opperai/language_models.py - src/opperai/models/__init__.py - - src/opperai/models/add_knowledge_knowledge_base_id_index_postop.py + - src/opperai/models/add_knowledge_knowledge_base_id_add_postop.py - src/opperai/models/addrequest.py - src/opperai/models/annotation.py - src/opperai/models/annotationurlcitation.py @@ -376,7 +375,6 @@ generatedFiles: - src/opperai/models/examplein.py - src/opperai/models/file.py - src/opperai/models/filefile.py - - src/opperai/models/fileprocessconfiguration.py - src/opperai/models/filter_.py - src/opperai/models/function_output.py - src/opperai/models/function_stream_call_stream_postop.py @@ -439,7 +437,6 @@ generatedFiles: - src/opperai/models/paginatedresponse_listlanguagemodelsresponse_.py - src/opperai/models/paginatedresponse_listspanmetricsresponse_.py - src/opperai/models/paginatedresponse_listtracesresponse_.py - - src/opperai/models/pdfprocessorname.py - src/opperai/models/prompttokensdetails.py - src/opperai/models/query_dataset_entries_datasets_dataset_id_entries_query_postop.py - src/opperai/models/query_knowledge_base_knowledge_knowledge_base_id_query_postop.py @@ -462,6 +459,7 @@ generatedFiles: - src/opperai/models/spanschema.py - src/opperai/models/stream_function_functions_function_id_call_stream_postop.py - src/opperai/models/stream_function_revision_functions_function_id_call_stream_revision_id_postop.py + - src/opperai/models/textprocessingconfiguration.py - src/opperai/models/tmodel.py - src/opperai/models/toplogprob.py - src/opperai/models/update_custom_model_models_custom_model_id_patchop.py @@ -584,7 +582,6 @@ generatedFiles: - tests/mockserver/internal/sdk/models/components/examplein.go - tests/mockserver/internal/sdk/models/components/file.go - tests/mockserver/internal/sdk/models/components/filefile.go - - tests/mockserver/internal/sdk/models/components/fileprocessconfiguration.go - tests/mockserver/internal/sdk/models/components/filter.go - tests/mockserver/internal/sdk/models/components/functioncallconfiguration.go - tests/mockserver/internal/sdk/models/components/functioncallinput.go @@ -627,7 +624,6 @@ generatedFiles: - tests/mockserver/internal/sdk/models/components/paginatedresponselistlanguagemodelsresponse.go - tests/mockserver/internal/sdk/models/components/paginatedresponselistspanmetricsresponse.go - tests/mockserver/internal/sdk/models/components/paginatedresponselisttracesresponse.go - - tests/mockserver/internal/sdk/models/components/pdfprocessorname.go - tests/mockserver/internal/sdk/models/components/prompttokensdetails.go - tests/mockserver/internal/sdk/models/components/querydatasetentriesresponse.go - tests/mockserver/internal/sdk/models/components/queryknowledgebaserequest.go @@ -644,6 +640,7 @@ generatedFiles: - tests/mockserver/internal/sdk/models/components/spandata.go - tests/mockserver/internal/sdk/models/components/spanmetricdata.go - tests/mockserver/internal/sdk/models/components/spanschema.go + - tests/mockserver/internal/sdk/models/components/textprocessingconfiguration.go - tests/mockserver/internal/sdk/models/components/tmodel.go - tests/mockserver/internal/sdk/models/components/toplogprob.go - tests/mockserver/internal/sdk/models/components/updatecustommodelrequest.go @@ -659,7 +656,7 @@ generatedFiles: - tests/mockserver/internal/sdk/models/components/websearchoptions.go - tests/mockserver/internal/sdk/models/components/websearchoptionsuserlocation.go - tests/mockserver/internal/sdk/models/components/websearchoptionsuserlocationapproximate.go - - tests/mockserver/internal/sdk/models/operations/addknowledgeknowledgebaseidindexpost.go + - tests/mockserver/internal/sdk/models/operations/addknowledgeknowledgebaseidaddpost.go - tests/mockserver/internal/sdk/models/operations/callfunctionfunctionsfunctionidcallpost.go - tests/mockserver/internal/sdk/models/operations/callfunctionrevisionfunctionsfunctionidcallrevisionidpost.go - tests/mockserver/internal/sdk/models/operations/chatcompletionsopenaichatcompletionspost.go @@ -997,7 +994,7 @@ examples: path: span_id: "77b258a2-45c1-4b87-a50c-9116bc8ed1d6" requestBody: - application/json: {"name": "my span", "start_time": "2025-06-27T08:51:47.800056Z", "type": "email_tool", "end_time": "2025-06-27T08:51:47.800118Z", "input": "Hello, world!", "output": "Hello, world!", "error": "Exception: This is an error message", "meta": {"key": "value"}, "score": 10} + application/json: {"name": "my span", "start_time": "2025-06-27T11:37:21.302644Z", "type": "email_tool", "end_time": "2025-06-27T11:37:21.302704Z", "input": "Hello, world!", "output": "Hello, world!", "error": "Exception: This is an error message", "meta": {"key": "value"}, "score": 10} responses: "200": application/json: {"name": "my span", "start_time": "2024-03-20T10:00:00+00:00", "id": "84d9ffc8-336c-4953-b92f-fe05d5405951", "trace_id": "123e4567-e89b-12d3-a456-426614174000", "parent_id": "123e4567-e89b-12d3-a456-426614174000", "type": "email_tool", "end_time": "2024-03-20T10:00:10+00:00", "input": "Hello, world!", "output": "Hello, world!", "error": "Exception: This is an error message", "meta": {"key": "value"}, "score": 10} @@ -1832,5 +1829,23 @@ examples: application/json: {"type": "NotFoundError", "message": "The resource was not found", "detail": "Span 123e4567-e89b-12d3-a456-426614174000 not found"} "422": application/json: {"type": "RequestValidationError", "message": "The request is invalid", "detail": {"input": "input value", "loc": ["path", "to", "error"], "msg": "error message", "type": "type of error"}} + add_knowledge__knowledge_base_id__add_post: + speakeasy-default-add-knowledge-knowledge-base-id-add-post: + parameters: + path: + knowledge_base_id: "c441b497-32db-4e24-8f41-ab160e1329fc" + requestBody: + application/json: {"key": "paris_123", "content": "The capital of France is Paris", "metadata": {"category": "product", "price": 100}} + responses: + "201": + application/json: "" + "400": + application/json: {"type": "BadRequestError", "message": "The request is invalid", "detail": "The request is invalid"} + "401": + application/json: {"type": "UnauthorizedError", "message": "The request is unauthorized", "detail": "The API key is invalid"} + "404": + application/json: {"type": "NotFoundError", "message": "The resource was not found", "detail": "Span 123e4567-e89b-12d3-a456-426614174000 not found"} + "422": + application/json: {"type": "RequestValidationError", "message": "The request is invalid", "detail": {"input": "input value", "loc": ["path", "to", "error"], "msg": "error message", "type": "type of error"}} examplesVersion: 1.0.2 generatedTests: {} diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index eaf9fd3..d4636df 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -25,7 +25,7 @@ generation: generateNewTests: false skipResponseBodyAssertions: false python: - version: 1.0.0 + version: 1.0.1 additionalDependencies: dev: {} main: {} diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index cfbff96..7a672dc 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -2,19 +2,20 @@ speakeasyVersion: 1.570.2 sources: FastAPI: sourceNamespace: fast-api - sourceRevisionDigest: sha256:66206b6c88c3c61ce2ba62b8badc9b6d792a1f3b2bb3b53ffe56ebb6e33c0e6f - sourceBlobDigest: sha256:c589aa220d2edd1ec19274af5a82e4f42afba6ee13c29b7b94ea86c6c6750669 + sourceRevisionDigest: sha256:c8cd765eeb0a507cc8000e72d1d9513bc651616bfecf5cf84ff5d6864f888c51 + sourceBlobDigest: sha256:46c3eaf6d76d253f805f2e4bb527f5a3e1ee391f78222af96eebb199446604b1 tags: - latest + - main - 2.0.0 targets: opper: source: FastAPI sourceNamespace: fast-api - sourceRevisionDigest: sha256:66206b6c88c3c61ce2ba62b8badc9b6d792a1f3b2bb3b53ffe56ebb6e33c0e6f - sourceBlobDigest: sha256:c589aa220d2edd1ec19274af5a82e4f42afba6ee13c29b7b94ea86c6c6750669 + sourceRevisionDigest: sha256:c8cd765eeb0a507cc8000e72d1d9513bc651616bfecf5cf84ff5d6864f888c51 + sourceBlobDigest: sha256:46c3eaf6d76d253f805f2e4bb527f5a3e1ee391f78222af96eebb199446604b1 codeSamplesNamespace: fast-api-python-code-samples - codeSamplesRevisionDigest: sha256:222418eb8b09f35c79d23b886cb48984f58f7d5f3c9cbc4f8064c707cee1783a + codeSamplesRevisionDigest: sha256:8f938ea91138da9e592845d3d2818d17700b8d7179a856eecbb02daadb87e78a workflow: workflowVersion: 1.0.0 speakeasyVersion: latest diff --git a/README.md b/README.md index ce13bc1..163f6b1 100644 --- a/README.md +++ b/README.md @@ -156,7 +156,7 @@ with Opper( ], "title": "OpperOutputExample", "type": "object", - }, input_={ + }, input={ "x": 4, "y": 5, }, examples=[ @@ -223,7 +223,7 @@ async def main(): ], "title": "OpperOutputExample", "type": "object", - }, input_={ + }, input={ "x": 4, "y": 5, }, examples=[ @@ -299,7 +299,7 @@ with Opper( ], "title": "OpperOutputExample", "type": "object", - }, input_={ + }, input={ "x": 4, "y": 5, }, examples=[ @@ -379,7 +379,7 @@ with Opper( * [register_file_upload](docs/sdks/knowledge/README.md#register_file_upload) - Register File Upload * [delete_file](docs/sdks/knowledge/README.md#delete_file) - Delete File From Knowledge Base * [query](docs/sdks/knowledge/README.md#query) - Query Knowledge Base -* [add](docs/sdks/knowledge/README.md#add) - Add +* [add_knowledge_knowledge_base_id_add_post](docs/sdks/knowledge/README.md#add_knowledge_knowledge_base_id_add_post) - Add ### [language_models](docs/sdks/languagemodels/README.md) @@ -474,7 +474,7 @@ with Opper( ], "title": "OpperOutputExample", "type": "object", - }, input_={ + }, input={ "x": 4, "y": 5, }, examples=[ @@ -550,7 +550,7 @@ with Opper( ], "title": "OpperOutputExample", "type": "object", - }, input_={ + }, input={ "x": 4, "y": 5, }, examples=[ @@ -616,7 +616,7 @@ with Opper( ], "title": "OpperOutputExample", "type": "object", - }, input_={ + }, input={ "x": 4, "y": 5, }, examples=[ @@ -707,7 +707,7 @@ with Opper( ], "title": "OpperOutputExample", "type": "object", - }, input_={ + }, input={ "x": 4, "y": 5, }, examples=[ @@ -792,7 +792,7 @@ with Opper( ], "title": "OpperOutputExample", "type": "object", - }, input_={ + }, input={ "x": 4, "y": 5, }, examples=[ diff --git a/USAGE.md b/USAGE.md index fb05c92..abece1d 100644 --- a/USAGE.md +++ b/USAGE.md @@ -38,7 +38,7 @@ with Opper( ], "title": "OpperOutputExample", "type": "object", - }, input_={ + }, input={ "x": 4, "y": 5, }, examples=[ @@ -105,7 +105,7 @@ async def main(): ], "title": "OpperOutputExample", "type": "object", - }, input_={ + }, input={ "x": 4, "y": 5, }, examples=[ diff --git a/docs/models/addknowledgeknowledgebaseidindexpostrequest.md b/docs/models/addknowledgeknowledgebaseidaddpostrequest.md similarity index 94% rename from docs/models/addknowledgeknowledgebaseidindexpostrequest.md rename to docs/models/addknowledgeknowledgebaseidaddpostrequest.md index e1f9925..4af2d92 100644 --- a/docs/models/addknowledgeknowledgebaseidindexpostrequest.md +++ b/docs/models/addknowledgeknowledgebaseidaddpostrequest.md @@ -1,4 +1,4 @@ -# AddKnowledgeKnowledgeBaseIDIndexPostRequest +# AddKnowledgeKnowledgeBaseIDAddPostRequest ## Fields diff --git a/docs/models/addrequest.md b/docs/models/addrequest.md index e36ff91..5cc07e7 100644 --- a/docs/models/addrequest.md +++ b/docs/models/addrequest.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | -| `key` | *OptionalNullable[str]* | :heavy_minus_sign: | The key of the document | paris_123 | -| `content` | *str* | :heavy_check_mark: | N/A | The capital of France is Paris | -| `metadata` | Dict[str, *Any*] | :heavy_minus_sign: | The metadata of the document | {
"category": "product",
"price": 100
} | -| `configuration` | [OptionalNullable[models.FileProcessConfiguration]](../models/fileprocessconfiguration.md) | :heavy_minus_sign: | The configuration for the document | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | +| `key` | *OptionalNullable[str]* | :heavy_minus_sign: | The key of the document | paris_123 | +| `content` | *str* | :heavy_check_mark: | N/A | The capital of France is Paris | +| `metadata` | Dict[str, *Any*] | :heavy_minus_sign: | The metadata of the document | {
"category": "product",
"price": 100
} | +| `configuration` | [OptionalNullable[models.TextProcessingConfiguration]](../models/textprocessingconfiguration.md) | :heavy_minus_sign: | The configuration for the document | | \ No newline at end of file diff --git a/docs/models/fileprocessconfiguration.md b/docs/models/fileprocessconfiguration.md deleted file mode 100644 index cce13e2..0000000 --- a/docs/models/fileprocessconfiguration.md +++ /dev/null @@ -1,10 +0,0 @@ -# FileProcessConfiguration - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | -| `chunk_size` | *Optional[int]* | :heavy_minus_sign: | N/A | -| `chunk_overlap` | *Optional[int]* | :heavy_minus_sign: | N/A | -| `pdf_processor` | [Optional[models.PdfProcessorName]](../models/pdfprocessorname.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/pdfprocessorname.md b/docs/models/pdfprocessorname.md deleted file mode 100644 index 9f079ad..0000000 --- a/docs/models/pdfprocessorname.md +++ /dev/null @@ -1,8 +0,0 @@ -# PdfProcessorName - - -## Values - -| Name | Value | -| ------- | ------- | -| `PYPDF` | pypdf | \ No newline at end of file diff --git a/docs/models/registerfileuploadrequest.md b/docs/models/registerfileuploadrequest.md index 62579cb..6a73b78 100644 --- a/docs/models/registerfileuploadrequest.md +++ b/docs/models/registerfileuploadrequest.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | -| `filename` | *str* | :heavy_check_mark: | The filename of the file to register | example.pdf | -| `file_id` | *str* | :heavy_check_mark: | The id of the file to register | | -| `content_type` | *str* | :heavy_check_mark: | The content type of the file to register | application/pdf | -| `configuration` | [OptionalNullable[models.FileProcessConfiguration]](../models/fileprocessconfiguration.md) | :heavy_minus_sign: | The configuration for the file to register | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | +| `filename` | *str* | :heavy_check_mark: | The filename of the file to register | example.pdf | +| `file_id` | *str* | :heavy_check_mark: | The id of the file to register | | +| `content_type` | *str* | :heavy_check_mark: | The content type of the file to register | application/pdf | +| `configuration` | [OptionalNullable[models.TextProcessingConfiguration]](../models/textprocessingconfiguration.md) | :heavy_minus_sign: | The configuration for the file to register | | \ No newline at end of file diff --git a/docs/models/textprocessingconfiguration.md b/docs/models/textprocessingconfiguration.md new file mode 100644 index 0000000..e4cf7a5 --- /dev/null +++ b/docs/models/textprocessingconfiguration.md @@ -0,0 +1,9 @@ +# TextProcessingConfiguration + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- | +| `text_processing_chunk_size` | *Optional[int]* | :heavy_minus_sign: | The chunk size to use for the document. This is the number of characters to use for the chunk. The default is 2000 characters. | +| `text_processing_chunk_overlap` | *Optional[int]* | :heavy_minus_sign: | The chunk overlap to use for the document. This is the number of characters to overlap between chunks. The default is 200 characters. | \ No newline at end of file diff --git a/docs/models/updatespanrequest.md b/docs/models/updatespanrequest.md index 7b969aa..287b198 100644 --- a/docs/models/updatespanrequest.md +++ b/docs/models/updatespanrequest.md @@ -6,9 +6,9 @@ | Field | Type | Required | Description | Example | | --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | | `name` | *OptionalNullable[str]* | :heavy_minus_sign: | The name of the span, something descriptive about the span that will be used to identify it when querying | my span | -| `start_time` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_minus_sign: | The start time of the span in UTC | 2025-06-27T08:51:47.800056Z | +| `start_time` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_minus_sign: | The start time of the span in UTC | 2025-06-27T11:37:21.302644Z | | `type` | *OptionalNullable[str]* | :heavy_minus_sign: | The type of the span | email_tool | -| `end_time` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_minus_sign: | The end time of the span in UTC | 2025-06-27T08:51:47.800118Z | +| `end_time` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_minus_sign: | The end time of the span in UTC | 2025-06-27T11:37:21.302704Z | | `input` | *OptionalNullable[str]* | :heavy_minus_sign: | The input of the span | Hello, world! | | `output` | *OptionalNullable[str]* | :heavy_minus_sign: | The output of the span | Hello, world! | | `error` | *OptionalNullable[str]* | :heavy_minus_sign: | In case of an error, the error message | Exception: This is an error message | diff --git a/docs/sdks/datasets/README.md b/docs/sdks/datasets/README.md index 7bb7ef8..e049ed9 100644 --- a/docs/sdks/datasets/README.md +++ b/docs/sdks/datasets/README.md @@ -26,7 +26,7 @@ with Opper( http_bearer=os.getenv("OPPER_HTTP_BEARER", ""), ) as opper: - res = opper.datasets.create_entry(dataset_id="50c15d18-6e79-449b-9e59-30324da6de5f", input_={ + res = opper.datasets.create_entry(dataset_id="50c15d18-6e79-449b-9e59-30324da6de5f", input={ "x": 4, "y": 5, }, output={ diff --git a/docs/sdks/embeddings/README.md b/docs/sdks/embeddings/README.md index bb9f8ac..4736118 100644 --- a/docs/sdks/embeddings/README.md +++ b/docs/sdks/embeddings/README.md @@ -22,7 +22,7 @@ with Opper( http_bearer=os.getenv("OPPER_HTTP_BEARER", ""), ) as opper: - res = opper.embeddings.create(input_="Hello, world!") + res = opper.embeddings.create(input="Hello, world!") # Handle response print(res) diff --git a/docs/sdks/entries/README.md b/docs/sdks/entries/README.md index c4a3171..69568d0 100644 --- a/docs/sdks/entries/README.md +++ b/docs/sdks/entries/README.md @@ -22,7 +22,7 @@ with Opper( http_bearer=os.getenv("OPPER_HTTP_BEARER", ""), ) as opper: - res = opper.datasets.entries.update(dataset_id="df57581c-3364-4ee6-a9f8-7de20cb937ff", entry_id="2789b25b-1a98-4360-96ee-67e9af98c53f", input_="Given this input, what is the output?", output="This is the output to the dataset entry", expected="This `was` the output to the dataset entry", comment="This is an example of how one can edit the output") + res = opper.datasets.entries.update(dataset_id="df57581c-3364-4ee6-a9f8-7de20cb937ff", entry_id="2789b25b-1a98-4360-96ee-67e9af98c53f", input="Given this input, what is the output?", output="This is the output to the dataset entry", expected="This `was` the output to the dataset entry", comment="This is an example of how one can edit the output") # Handle response print(res) diff --git a/docs/sdks/functions/README.md b/docs/sdks/functions/README.md index c23d264..97457ac 100644 --- a/docs/sdks/functions/README.md +++ b/docs/sdks/functions/README.md @@ -409,7 +409,7 @@ with Opper( http_bearer=os.getenv("OPPER_HTTP_BEARER", ""), ) as opper: - res = opper.functions.call(function_id="864c5880-3d87-4091-828c-33cc2c7219a9", input_={ + res = opper.functions.call(function_id="864c5880-3d87-4091-828c-33cc2c7219a9", input={ "x": 4, "y": 5, }, examples=[ @@ -486,7 +486,7 @@ with Opper( http_bearer=os.getenv("OPPER_HTTP_BEARER", ""), ) as opper: - res = opper.functions.stream(function_id="e35c595b-59f2-40b8-bc8a-d6f71ebd3c63", input_={ + res = opper.functions.stream(function_id="e35c595b-59f2-40b8-bc8a-d6f71ebd3c63", input={ "x": 4, "y": 5, }, examples=[ @@ -551,7 +551,7 @@ with Opper( http_bearer=os.getenv("OPPER_HTTP_BEARER", ""), ) as opper: - res = opper.functions.call_revision(function_id="b7391b0d-f115-4145-ae29-a136ae2d6a7a", revision_id="de9b5cac-c926-4aa1-a5ab-dc3aa3cd539c", input_={ + res = opper.functions.call_revision(function_id="b7391b0d-f115-4145-ae29-a136ae2d6a7a", revision_id="de9b5cac-c926-4aa1-a5ab-dc3aa3cd539c", input={ "x": 4, "y": 5, }, examples=[ @@ -629,7 +629,7 @@ with Opper( http_bearer=os.getenv("OPPER_HTTP_BEARER", ""), ) as opper: - res = opper.functions.stream_revision(function_id="d69e8466-7dba-4eaf-983c-ee6573398ae7", revision_id="c5701ae3-acaf-40b6-95f8-5c1192d84640", input_={ + res = opper.functions.stream_revision(function_id="d69e8466-7dba-4eaf-983c-ee6573398ae7", revision_id="c5701ae3-acaf-40b6-95f8-5c1192d84640", input={ "x": 4, "y": 5, }, examples=[ diff --git a/docs/sdks/knowledge/README.md b/docs/sdks/knowledge/README.md index ddc6c9b..95fa539 100644 --- a/docs/sdks/knowledge/README.md +++ b/docs/sdks/knowledge/README.md @@ -14,7 +14,7 @@ * [register_file_upload](#register_file_upload) - Register File Upload * [delete_file](#delete_file) - Delete File From Knowledge Base * [query](#query) - Query Knowledge Base -* [add](#add) - Add +* [add_knowledge_knowledge_base_id_add_post](#add_knowledge_knowledge_base_id_add_post) - Add ## create @@ -306,14 +306,14 @@ with Opper( ### Parameters -| Parameter | Type | Required | Description | Example | -| --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | -| `knowledge_base_id` | *str* | :heavy_check_mark: | The id of the knowledge base to register the file for | | -| `filename` | *str* | :heavy_check_mark: | The filename of the file to register | example.pdf | -| `file_id` | *str* | :heavy_check_mark: | The id of the file to register | | -| `content_type` | *str* | :heavy_check_mark: | The content type of the file to register | application/pdf | -| `configuration` | [OptionalNullable[models.FileProcessConfiguration]](../../models/fileprocessconfiguration.md) | :heavy_minus_sign: | The configuration for the file to register | | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | +| Parameter | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | +| `knowledge_base_id` | *str* | :heavy_check_mark: | The id of the knowledge base to register the file for | | +| `filename` | *str* | :heavy_check_mark: | The filename of the file to register | example.pdf | +| `file_id` | *str* | :heavy_check_mark: | The id of the file to register | | +| `content_type` | *str* | :heavy_check_mark: | The content type of the file to register | application/pdf | +| `configuration` | [OptionalNullable[models.TextProcessingConfiguration]](../../models/textprocessingconfiguration.md) | :heavy_minus_sign: | The configuration for the file to register | | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | ### Response @@ -431,7 +431,7 @@ with Opper( | errors.RequestValidationError | 422 | application/json | | errors.APIError | 4XX, 5XX | \*/\* | -## add +## add_knowledge_knowledge_base_id_add_post Add data to a knowledge base @@ -446,7 +446,7 @@ with Opper( http_bearer=os.getenv("OPPER_HTTP_BEARER", ""), ) as opper: - res = opper.knowledge.add(knowledge_base_id="b07d062e-0da0-4feb-9181-eefc10945b3a", content="The capital of France is Paris", key="paris_123", metadata={ + res = opper.knowledge.add_knowledge_knowledge_base_id_add_post(knowledge_base_id="c441b497-32db-4e24-8f41-ab160e1329fc", content="The capital of France is Paris", key="paris_123", metadata={ "category": "product", "price": 100, }) @@ -458,14 +458,14 @@ with Opper( ### Parameters -| Parameter | Type | Required | Description | Example | -| --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | -| `knowledge_base_id` | *str* | :heavy_check_mark: | The id of the knowledge base to add the data to | | -| `content` | *str* | :heavy_check_mark: | N/A | The capital of France is Paris | -| `key` | *OptionalNullable[str]* | :heavy_minus_sign: | The key of the document | paris_123 | -| `metadata` | Dict[str, *Any*] | :heavy_minus_sign: | The metadata of the document | {
"category": "product",
"price": 100
} | -| `configuration` | [OptionalNullable[models.FileProcessConfiguration]](../../models/fileprocessconfiguration.md) | :heavy_minus_sign: | The configuration for the document | | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | +| Parameter | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | +| `knowledge_base_id` | *str* | :heavy_check_mark: | The id of the knowledge base to add the data to | | +| `content` | *str* | :heavy_check_mark: | N/A | The capital of France is Paris | +| `key` | *OptionalNullable[str]* | :heavy_minus_sign: | The key of the document | paris_123 | +| `metadata` | Dict[str, *Any*] | :heavy_minus_sign: | The metadata of the document | {
"category": "product",
"price": 100
} | +| `configuration` | [OptionalNullable[models.TextProcessingConfiguration]](../../models/textprocessingconfiguration.md) | :heavy_minus_sign: | The configuration for the document | | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | ### Response diff --git a/docs/sdks/opper/README.md b/docs/sdks/opper/README.md index 2e3808b..ba2f525 100644 --- a/docs/sdks/opper/README.md +++ b/docs/sdks/opper/README.md @@ -52,7 +52,7 @@ with Opper( ], "title": "OpperOutputExample", "type": "object", - }, input_={ + }, input={ "x": 4, "y": 5, }, examples=[ @@ -167,7 +167,7 @@ with Opper( ], "title": "OpperOutputExample", "type": "object", - }, input_={ + }, input={ "x": 4, "y": 5, }, examples=[ diff --git a/docs/sdks/spans/README.md b/docs/sdks/spans/README.md index 212ed0f..a2e5e5f 100644 --- a/docs/sdks/spans/README.md +++ b/docs/sdks/spans/README.md @@ -27,7 +27,7 @@ with Opper( http_bearer=os.getenv("OPPER_HTTP_BEARER", ""), ) as opper: - res = opper.spans.create(name="my span", start_time=parse_datetime("2024-03-20T10:00:00+00:00"), id="123e4567-e89b-12d3-a456-426614174000", trace_id="123e4567-e89b-12d3-a456-426614174000", parent_id="123e4567-e89b-12d3-a456-426614174000", type_="email_tool", end_time=parse_datetime("2024-03-20T10:00:10+00:00"), input_="Hello, world!", output="Hello, world!", error="Exception: This is an error message", meta={ + res = opper.spans.create(name="my span", start_time=parse_datetime("2024-03-20T10:00:00+00:00"), id="123e4567-e89b-12d3-a456-426614174000", trace_id="123e4567-e89b-12d3-a456-426614174000", parent_id="123e4567-e89b-12d3-a456-426614174000", type="email_tool", end_time=parse_datetime("2024-03-20T10:00:10+00:00"), input="Hello, world!", output="Hello, world!", error="Exception: This is an error message", meta={ "key": "value", }, score=10) @@ -127,7 +127,7 @@ with Opper( http_bearer=os.getenv("OPPER_HTTP_BEARER", ""), ) as opper: - res = opper.spans.update(span_id="77b258a2-45c1-4b87-a50c-9116bc8ed1d6", name="my span", start_time=parse_datetime("2025-06-27T08:51:47.800056Z"), type_="email_tool", end_time=parse_datetime("2025-06-27T08:51:47.800118Z"), input_="Hello, world!", output="Hello, world!", error="Exception: This is an error message", meta={ + res = opper.spans.update(span_id="77b258a2-45c1-4b87-a50c-9116bc8ed1d6", name="my span", start_time=parse_datetime("2025-06-27T11:37:21.302644Z"), type="email_tool", end_time=parse_datetime("2025-06-27T11:37:21.302704Z"), input="Hello, world!", output="Hello, world!", error="Exception: This is an error message", meta={ "key": "value", }, score=10) @@ -142,9 +142,9 @@ with Opper( | --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | | `span_id` | *str* | :heavy_check_mark: | The ID of the span to update | | | `name` | *OptionalNullable[str]* | :heavy_minus_sign: | The name of the span, something descriptive about the span that will be used to identify it when querying | my span | -| `start_time` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_minus_sign: | The start time of the span in UTC | 2025-06-27T08:51:47.800056Z | +| `start_time` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_minus_sign: | The start time of the span in UTC | 2025-06-27T11:37:21.302644Z | | `type` | *OptionalNullable[str]* | :heavy_minus_sign: | The type of the span | email_tool | -| `end_time` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_minus_sign: | The end time of the span in UTC | 2025-06-27T08:51:47.800118Z | +| `end_time` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_minus_sign: | The end time of the span in UTC | 2025-06-27T11:37:21.302704Z | | `input` | *OptionalNullable[str]* | :heavy_minus_sign: | The input of the span | Hello, world! | | `output` | *OptionalNullable[str]* | :heavy_minus_sign: | The output of the span | Hello, world! | | `error` | *OptionalNullable[str]* | :heavy_minus_sign: | In case of an error, the error message | Exception: This is an error message | diff --git a/pyproject.toml b/pyproject.toml index 7224251..6e5098c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "opperai" -version = "1.0.0" +version = "1.0.1" description = "Python Client SDK Generated by Speakeasy." authors = [{ name = "Speakeasy" },] readme = "README.md" diff --git a/src/opperai/_version.py b/src/opperai/_version.py index b0d3688..0b5d3fa 100644 --- a/src/opperai/_version.py +++ b/src/opperai/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "opperai" -__version__: str = "1.0.0" +__version__: str = "1.0.1" __openapi_doc_version__: str = "2.0.0" __gen_version__: str = "2.638.5" -__user_agent__: str = "speakeasy-sdk/python 1.0.0 2.638.5 2.0.0 opperai" +__user_agent__: str = "speakeasy-sdk/python 1.0.1 2.638.5 2.0.0 opperai" try: if __package__ is not None: diff --git a/src/opperai/datasets.py b/src/opperai/datasets.py index 8eb5c93..2a67fd0 100644 --- a/src/opperai/datasets.py +++ b/src/opperai/datasets.py @@ -25,7 +25,7 @@ def create_entry( self, *, dataset_id: str, - input_: Any, + input: Any, output: Any, expected: OptionalNullable[Any] = UNSET, comment: OptionalNullable[str] = UNSET, @@ -59,7 +59,7 @@ def create_entry( request = models.CreateDatasetEntryDatasetsDatasetIDPostRequest( dataset_id=dataset_id, create_dataset_entry_request=models.CreateDatasetEntryRequest( - input=input_, + input=input, output=output, expected=expected, comment=comment, @@ -161,7 +161,7 @@ async def create_entry_async( self, *, dataset_id: str, - input_: Any, + input: Any, output: Any, expected: OptionalNullable[Any] = UNSET, comment: OptionalNullable[str] = UNSET, @@ -195,7 +195,7 @@ async def create_entry_async( request = models.CreateDatasetEntryDatasetsDatasetIDPostRequest( dataset_id=dataset_id, create_dataset_entry_request=models.CreateDatasetEntryRequest( - input=input_, + input=input, output=output, expected=expected, comment=comment, diff --git a/src/opperai/embeddings.py b/src/opperai/embeddings.py index 0c27e77..f1fcc0d 100644 --- a/src/opperai/embeddings.py +++ b/src/opperai/embeddings.py @@ -12,7 +12,7 @@ class Embeddings(BaseSDK): def create( self, *, - input_: Union[models.Input, models.InputTypedDict], + input: Union[models.Input, models.InputTypedDict], model: OptionalNullable[Union[models.TModel, models.TModelTypedDict]] = UNSET, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, @@ -42,7 +42,7 @@ def create( request = models.CreateEmbeddingRequest( model=utils.get_pydantic_model(model, OptionalNullable[models.TModel]), - input=input_, + input=input, ) req = self._build_request( @@ -134,7 +134,7 @@ def create( async def create_async( self, *, - input_: Union[models.Input, models.InputTypedDict], + input: Union[models.Input, models.InputTypedDict], model: OptionalNullable[Union[models.TModel, models.TModelTypedDict]] = UNSET, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, @@ -164,7 +164,7 @@ async def create_async( request = models.CreateEmbeddingRequest( model=utils.get_pydantic_model(model, OptionalNullable[models.TModel]), - input=input_, + input=input, ) req = self._build_request_async( diff --git a/src/opperai/entries.py b/src/opperai/entries.py index 943de1e..8c63a54 100644 --- a/src/opperai/entries.py +++ b/src/opperai/entries.py @@ -14,7 +14,7 @@ def update( *, dataset_id: str, entry_id: str, - input_: OptionalNullable[Any] = UNSET, + input: OptionalNullable[Any] = UNSET, output: OptionalNullable[Any] = UNSET, expected: OptionalNullable[Any] = UNSET, comment: OptionalNullable[str] = UNSET, @@ -50,7 +50,7 @@ def update( dataset_id=dataset_id, entry_id=entry_id, update_dataset_entry_request=models.UpdateDatasetEntryRequest( - input=input_, + input=input, output=output, expected=expected, comment=comment, @@ -153,7 +153,7 @@ async def update_async( *, dataset_id: str, entry_id: str, - input_: OptionalNullable[Any] = UNSET, + input: OptionalNullable[Any] = UNSET, output: OptionalNullable[Any] = UNSET, expected: OptionalNullable[Any] = UNSET, comment: OptionalNullable[str] = UNSET, @@ -189,7 +189,7 @@ async def update_async( dataset_id=dataset_id, entry_id=entry_id, update_dataset_entry_request=models.UpdateDatasetEntryRequest( - input=input_, + input=input, output=output, expected=expected, comment=comment, diff --git a/src/opperai/functions.py b/src/opperai/functions.py index 5dc83a3..66ac939 100644 --- a/src/opperai/functions.py +++ b/src/opperai/functions.py @@ -67,6 +67,13 @@ def create( else: base_url = self._get_url(base_url, url_variables) + # region convert-pydantic-schemas + if input_schema is not UNSET and hasattr(input_schema, 'model_json_schema'): + input_schema = input_schema.model_json_schema() + if output_schema is not UNSET and hasattr(output_schema, 'model_json_schema'): + output_schema = output_schema.model_json_schema() + # endregion convert-pydantic-schemas + request = models.CreateFunctionRequest( name=name, description=description, @@ -215,6 +222,13 @@ async def create_async( else: base_url = self._get_url(base_url, url_variables) + # region convert-pydantic-schemas + if input_schema is not UNSET and hasattr(input_schema, 'model_json_schema'): + input_schema = input_schema.model_json_schema() + if output_schema is not UNSET and hasattr(output_schema, 'model_json_schema'): + output_schema = output_schema.model_json_schema() + # endregion convert-pydantic-schemas + request = models.CreateFunctionRequest( name=name, description=description, @@ -842,6 +856,13 @@ def update( else: base_url = self._get_url(base_url, url_variables) + # region convert-pydantic-schemas + if input_schema is not UNSET and hasattr(input_schema, 'model_json_schema'): + input_schema = input_schema.model_json_schema() + if output_schema is not UNSET and hasattr(output_schema, 'model_json_schema'): + output_schema = output_schema.model_json_schema() + # endregion convert-pydantic-schemas + request = models.UpdateFunctionFunctionsFunctionIDPatchRequest( function_id=function_id, update_function_request=models.UpdateFunctionRequest( @@ -987,6 +1008,13 @@ async def update_async( else: base_url = self._get_url(base_url, url_variables) + # region convert-pydantic-schemas + if input_schema is not UNSET and hasattr(input_schema, 'model_json_schema'): + input_schema = input_schema.model_json_schema() + if output_schema is not UNSET and hasattr(output_schema, 'model_json_schema'): + output_schema = output_schema.model_json_schema() + # endregion convert-pydantic-schemas + request = models.UpdateFunctionFunctionsFunctionIDPatchRequest( function_id=function_id, update_function_request=models.UpdateFunctionRequest( @@ -1789,7 +1817,7 @@ def call( self, *, function_id: str, - input_: OptionalNullable[Any] = UNSET, + input: OptionalNullable[Any] = UNSET, parent_span_id: OptionalNullable[str] = UNSET, examples: OptionalNullable[ Union[List[models.ExampleIn], List[models.ExampleInTypedDict]] @@ -1827,7 +1855,7 @@ def call( request = models.CallFunctionFunctionsFunctionIDCallPostRequest( function_id=function_id, app_api_public_v2_functions_call_function_request=models.AppAPIPublicV2FunctionsCallFunctionRequest( - input=input_, + input=input, parent_span_id=parent_span_id, examples=utils.get_pydantic_model( examples, OptionalNullable[List[models.ExampleIn]] @@ -1931,7 +1959,7 @@ async def call_async( self, *, function_id: str, - input_: OptionalNullable[Any] = UNSET, + input: OptionalNullable[Any] = UNSET, parent_span_id: OptionalNullable[str] = UNSET, examples: OptionalNullable[ Union[List[models.ExampleIn], List[models.ExampleInTypedDict]] @@ -1969,7 +1997,7 @@ async def call_async( request = models.CallFunctionFunctionsFunctionIDCallPostRequest( function_id=function_id, app_api_public_v2_functions_call_function_request=models.AppAPIPublicV2FunctionsCallFunctionRequest( - input=input_, + input=input, parent_span_id=parent_span_id, examples=utils.get_pydantic_model( examples, OptionalNullable[List[models.ExampleIn]] @@ -2073,7 +2101,7 @@ def stream( self, *, function_id: str, - input_: OptionalNullable[Any] = UNSET, + input: OptionalNullable[Any] = UNSET, parent_span_id: OptionalNullable[str] = UNSET, examples: OptionalNullable[ Union[List[models.ExampleIn], List[models.ExampleInTypedDict]] @@ -2125,7 +2153,7 @@ def stream( request = models.StreamFunctionFunctionsFunctionIDCallStreamPostRequest( function_id=function_id, app_api_public_v2_functions_call_function_request=models.AppAPIPublicV2FunctionsCallFunctionRequest( - input=input_, + input=input, parent_span_id=parent_span_id, examples=utils.get_pydantic_model( examples, OptionalNullable[List[models.ExampleIn]] @@ -2241,7 +2269,7 @@ async def stream_async( self, *, function_id: str, - input_: OptionalNullable[Any] = UNSET, + input: OptionalNullable[Any] = UNSET, parent_span_id: OptionalNullable[str] = UNSET, examples: OptionalNullable[ Union[List[models.ExampleIn], List[models.ExampleInTypedDict]] @@ -2293,7 +2321,7 @@ async def stream_async( request = models.StreamFunctionFunctionsFunctionIDCallStreamPostRequest( function_id=function_id, app_api_public_v2_functions_call_function_request=models.AppAPIPublicV2FunctionsCallFunctionRequest( - input=input_, + input=input, parent_span_id=parent_span_id, examples=utils.get_pydantic_model( examples, OptionalNullable[List[models.ExampleIn]] @@ -2410,7 +2438,7 @@ def call_revision( *, function_id: str, revision_id: str, - input_: OptionalNullable[Any] = UNSET, + input: OptionalNullable[Any] = UNSET, parent_span_id: OptionalNullable[str] = UNSET, examples: OptionalNullable[ Union[List[models.ExampleIn], List[models.ExampleInTypedDict]] @@ -2450,7 +2478,7 @@ def call_revision( function_id=function_id, revision_id=revision_id, app_api_public_v2_functions_call_function_request=models.AppAPIPublicV2FunctionsCallFunctionRequest( - input=input_, + input=input, parent_span_id=parent_span_id, examples=utils.get_pydantic_model( examples, OptionalNullable[List[models.ExampleIn]] @@ -2555,7 +2583,7 @@ async def call_revision_async( *, function_id: str, revision_id: str, - input_: OptionalNullable[Any] = UNSET, + input: OptionalNullable[Any] = UNSET, parent_span_id: OptionalNullable[str] = UNSET, examples: OptionalNullable[ Union[List[models.ExampleIn], List[models.ExampleInTypedDict]] @@ -2595,7 +2623,7 @@ async def call_revision_async( function_id=function_id, revision_id=revision_id, app_api_public_v2_functions_call_function_request=models.AppAPIPublicV2FunctionsCallFunctionRequest( - input=input_, + input=input, parent_span_id=parent_span_id, examples=utils.get_pydantic_model( examples, OptionalNullable[List[models.ExampleIn]] @@ -2700,7 +2728,7 @@ def stream_revision( *, function_id: str, revision_id: str, - input_: OptionalNullable[Any] = UNSET, + input: OptionalNullable[Any] = UNSET, parent_span_id: OptionalNullable[str] = UNSET, examples: OptionalNullable[ Union[List[models.ExampleIn], List[models.ExampleInTypedDict]] @@ -2756,7 +2784,7 @@ def stream_revision( function_id=function_id, revision_id=revision_id, app_api_public_v2_functions_call_function_request=models.AppAPIPublicV2FunctionsCallFunctionRequest( - input=input_, + input=input, parent_span_id=parent_span_id, examples=utils.get_pydantic_model( examples, OptionalNullable[List[models.ExampleIn]] @@ -2873,7 +2901,7 @@ async def stream_revision_async( *, function_id: str, revision_id: str, - input_: OptionalNullable[Any] = UNSET, + input: OptionalNullable[Any] = UNSET, parent_span_id: OptionalNullable[str] = UNSET, examples: OptionalNullable[ Union[List[models.ExampleIn], List[models.ExampleInTypedDict]] @@ -2929,7 +2957,7 @@ async def stream_revision_async( function_id=function_id, revision_id=revision_id, app_api_public_v2_functions_call_function_request=models.AppAPIPublicV2FunctionsCallFunctionRequest( - input=input_, + input=input, parent_span_id=parent_span_id, examples=utils.get_pydantic_model( examples, OptionalNullable[List[models.ExampleIn]] diff --git a/src/opperai/knowledge.py b/src/opperai/knowledge.py index 2d924ac..bc6b0a6 100644 --- a/src/opperai/knowledge.py +++ b/src/opperai/knowledge.py @@ -1444,8 +1444,8 @@ def register_file_upload( content_type: str, configuration: OptionalNullable[ Union[ - models.FileProcessConfiguration, - models.FileProcessConfigurationTypedDict, + models.TextProcessingConfiguration, + models.TextProcessingConfigurationTypedDict, ] ] = UNSET, retries: OptionalNullable[utils.RetryConfig] = UNSET, @@ -1490,7 +1490,8 @@ def register_file_upload( file_id=file_id, content_type=content_type, configuration=utils.get_pydantic_model( - configuration, OptionalNullable[models.FileProcessConfiguration] + configuration, + OptionalNullable[models.TextProcessingConfiguration], ), ), ) @@ -1596,8 +1597,8 @@ async def register_file_upload_async( content_type: str, configuration: OptionalNullable[ Union[ - models.FileProcessConfiguration, - models.FileProcessConfigurationTypedDict, + models.TextProcessingConfiguration, + models.TextProcessingConfigurationTypedDict, ] ] = UNSET, retries: OptionalNullable[utils.RetryConfig] = UNSET, @@ -1642,7 +1643,8 @@ async def register_file_upload_async( file_id=file_id, content_type=content_type, configuration=utils.get_pydantic_model( - configuration, OptionalNullable[models.FileProcessConfiguration] + configuration, + OptionalNullable[models.TextProcessingConfiguration], ), ), ) @@ -2271,7 +2273,7 @@ async def query_async( http_res, ) - def add( + def add_knowledge_knowledge_base_id_add_post( self, *, knowledge_base_id: str, @@ -2280,8 +2282,8 @@ def add( metadata: Optional[Dict[str, Any]] = None, configuration: OptionalNullable[ Union[ - models.FileProcessConfiguration, - models.FileProcessConfigurationTypedDict, + models.TextProcessingConfiguration, + models.TextProcessingConfigurationTypedDict, ] ] = UNSET, retries: OptionalNullable[utils.RetryConfig] = UNSET, @@ -2313,21 +2315,21 @@ def add( else: base_url = self._get_url(base_url, url_variables) - request = models.AddKnowledgeKnowledgeBaseIDIndexPostRequest( + request = models.AddKnowledgeKnowledgeBaseIDAddPostRequest( knowledge_base_id=knowledge_base_id, add_request=models.AddRequest( key=key, content=content, metadata=metadata, configuration=utils.get_pydantic_model( - configuration, OptionalNullable[models.FileProcessConfiguration] + configuration, OptionalNullable[models.TextProcessingConfiguration] ), ), ) req = self._build_request( method="POST", - path="/knowledge/{knowledge_base_id}/index", + path="/knowledge/{knowledge_base_id}/add", base_url=base_url, url_variables=url_variables, request=request, @@ -2356,7 +2358,7 @@ def add( hook_ctx=HookContext( config=self.sdk_configuration, base_url=base_url or "", - operation_id="add_knowledge__knowledge_base_id__index_post", + operation_id="add_knowledge__knowledge_base_id__add_post", oauth2_scopes=[], security_source=get_security_from_env( self.sdk_configuration.security, models.Security @@ -2410,7 +2412,7 @@ def add( http_res, ) - async def add_async( + async def add_knowledge_knowledge_base_id_add_post_async( self, *, knowledge_base_id: str, @@ -2419,8 +2421,8 @@ async def add_async( metadata: Optional[Dict[str, Any]] = None, configuration: OptionalNullable[ Union[ - models.FileProcessConfiguration, - models.FileProcessConfigurationTypedDict, + models.TextProcessingConfiguration, + models.TextProcessingConfigurationTypedDict, ] ] = UNSET, retries: OptionalNullable[utils.RetryConfig] = UNSET, @@ -2452,21 +2454,21 @@ async def add_async( else: base_url = self._get_url(base_url, url_variables) - request = models.AddKnowledgeKnowledgeBaseIDIndexPostRequest( + request = models.AddKnowledgeKnowledgeBaseIDAddPostRequest( knowledge_base_id=knowledge_base_id, add_request=models.AddRequest( key=key, content=content, metadata=metadata, configuration=utils.get_pydantic_model( - configuration, OptionalNullable[models.FileProcessConfiguration] + configuration, OptionalNullable[models.TextProcessingConfiguration] ), ), ) req = self._build_request_async( method="POST", - path="/knowledge/{knowledge_base_id}/index", + path="/knowledge/{knowledge_base_id}/add", base_url=base_url, url_variables=url_variables, request=request, @@ -2495,7 +2497,7 @@ async def add_async( hook_ctx=HookContext( config=self.sdk_configuration, base_url=base_url or "", - operation_id="add_knowledge__knowledge_base_id__index_post", + operation_id="add_knowledge__knowledge_base_id__add_post", oauth2_scopes=[], security_source=get_security_from_env( self.sdk_configuration.security, models.Security diff --git a/src/opperai/models/__init__.py b/src/opperai/models/__init__.py index e0fc5ea..e55750e 100644 --- a/src/opperai/models/__init__.py +++ b/src/opperai/models/__init__.py @@ -4,9 +4,9 @@ from importlib import import_module if TYPE_CHECKING: - from .add_knowledge_knowledge_base_id_index_postop import ( - AddKnowledgeKnowledgeBaseIDIndexPostRequest, - AddKnowledgeKnowledgeBaseIDIndexPostRequestTypedDict, + from .add_knowledge_knowledge_base_id_add_postop import ( + AddKnowledgeKnowledgeBaseIDAddPostRequest, + AddKnowledgeKnowledgeBaseIDAddPostRequestTypedDict, ) from .addrequest import AddRequest, AddRequestTypedDict from .annotation import Annotation, AnnotationTypedDict @@ -280,10 +280,6 @@ from .examplein import ExampleIn, ExampleInTypedDict from .file import File, FileTypedDict from .filefile import FileFile, FileFileTypedDict - from .fileprocessconfiguration import ( - FileProcessConfiguration, - FileProcessConfigurationTypedDict, - ) from .filter_ import ( Filter, FilterTypedDict, @@ -492,7 +488,6 @@ PaginatedResponseListTracesResponse, PaginatedResponseListTracesResponseTypedDict, ) - from .pdfprocessorname import PdfProcessorName from .prompttokensdetails import PromptTokensDetails, PromptTokensDetailsTypedDict from .query_dataset_entries_datasets_dataset_id_entries_query_postop import ( QueryDatasetEntriesDatasetsDatasetIDEntriesQueryPostRequest, @@ -575,6 +570,10 @@ StreamFunctionRevisionFunctionsFunctionIDCallStreamRevisionIDPostResponseBodyTypedDict, StreamFunctionRevisionFunctionsFunctionIDCallStreamRevisionIDPostResponseTypedDict, ) + from .textprocessingconfiguration import ( + TextProcessingConfiguration, + TextProcessingConfigurationTypedDict, + ) from .tmodel import TModel, TModel1, TModel1TypedDict, TModelTypedDict from .toplogprob import TopLogprob, TopLogprobTypedDict from .update_custom_model_models_custom_model_id_patchop import ( @@ -650,8 +649,8 @@ ) __all__ = [ - "AddKnowledgeKnowledgeBaseIDIndexPostRequest", - "AddKnowledgeKnowledgeBaseIDIndexPostRequestTypedDict", + "AddKnowledgeKnowledgeBaseIDAddPostRequest", + "AddKnowledgeKnowledgeBaseIDAddPostRequestTypedDict", "AddRequest", "AddRequestTypedDict", "Annotation", @@ -826,8 +825,6 @@ "File", "FileFile", "FileFileTypedDict", - "FileProcessConfiguration", - "FileProcessConfigurationTypedDict", "FileTypedDict", "Filter", "FilterTypedDict", @@ -963,7 +960,6 @@ "PaginatedResponseListTracesResponseTypedDict", "Payload", "PayloadTypedDict", - "PdfProcessorName", "PromptTokensDetails", "PromptTokensDetailsTypedDict", "QueryDatasetEntriesDatasetsDatasetIDEntriesQueryPostRequest", @@ -1025,6 +1021,8 @@ "TModel1", "TModel1TypedDict", "TModelTypedDict", + "TextProcessingConfiguration", + "TextProcessingConfigurationTypedDict", "TopLogprob", "TopLogprobTypedDict", "UpdateCustomModelModelsCustomModelIDPatchRequest", @@ -1075,8 +1073,8 @@ ] _dynamic_imports: dict[str, str] = { - "AddKnowledgeKnowledgeBaseIDIndexPostRequest": ".add_knowledge_knowledge_base_id_index_postop", - "AddKnowledgeKnowledgeBaseIDIndexPostRequestTypedDict": ".add_knowledge_knowledge_base_id_index_postop", + "AddKnowledgeKnowledgeBaseIDAddPostRequest": ".add_knowledge_knowledge_base_id_add_postop", + "AddKnowledgeKnowledgeBaseIDAddPostRequestTypedDict": ".add_knowledge_knowledge_base_id_add_postop", "AddRequest": ".addrequest", "AddRequestTypedDict": ".addrequest", "Annotation": ".annotation", @@ -1261,8 +1259,6 @@ "FileTypedDict": ".file", "FileFile": ".filefile", "FileFileTypedDict": ".filefile", - "FileProcessConfiguration": ".fileprocessconfiguration", - "FileProcessConfigurationTypedDict": ".fileprocessconfiguration", "Filter": ".filter_", "FilterTypedDict": ".filter_", "Value1": ".filter_", @@ -1395,7 +1391,6 @@ "PaginatedResponseListSpanMetricsResponseTypedDict": ".paginatedresponse_listspanmetricsresponse_", "PaginatedResponseListTracesResponse": ".paginatedresponse_listtracesresponse_", "PaginatedResponseListTracesResponseTypedDict": ".paginatedresponse_listtracesresponse_", - "PdfProcessorName": ".pdfprocessorname", "PromptTokensDetails": ".prompttokensdetails", "PromptTokensDetailsTypedDict": ".prompttokensdetails", "QueryDatasetEntriesDatasetsDatasetIDEntriesQueryPostRequest": ".query_dataset_entries_datasets_dataset_id_entries_query_postop", @@ -1452,6 +1447,8 @@ "StreamFunctionRevisionFunctionsFunctionIDCallStreamRevisionIDPostResponseBody": ".stream_function_revision_functions_function_id_call_stream_revision_id_postop", "StreamFunctionRevisionFunctionsFunctionIDCallStreamRevisionIDPostResponseBodyTypedDict": ".stream_function_revision_functions_function_id_call_stream_revision_id_postop", "StreamFunctionRevisionFunctionsFunctionIDCallStreamRevisionIDPostResponseTypedDict": ".stream_function_revision_functions_function_id_call_stream_revision_id_postop", + "TextProcessingConfiguration": ".textprocessingconfiguration", + "TextProcessingConfigurationTypedDict": ".textprocessingconfiguration", "TModel": ".tmodel", "TModel1": ".tmodel", "TModel1TypedDict": ".tmodel", diff --git a/src/opperai/models/add_knowledge_knowledge_base_id_index_postop.py b/src/opperai/models/add_knowledge_knowledge_base_id_add_postop.py similarity index 85% rename from src/opperai/models/add_knowledge_knowledge_base_id_index_postop.py rename to src/opperai/models/add_knowledge_knowledge_base_id_add_postop.py index 2e0de43..58c9d6b 100644 --- a/src/opperai/models/add_knowledge_knowledge_base_id_index_postop.py +++ b/src/opperai/models/add_knowledge_knowledge_base_id_add_postop.py @@ -7,13 +7,13 @@ from typing_extensions import Annotated, TypedDict -class AddKnowledgeKnowledgeBaseIDIndexPostRequestTypedDict(TypedDict): +class AddKnowledgeKnowledgeBaseIDAddPostRequestTypedDict(TypedDict): knowledge_base_id: str r"""The id of the knowledge base to add the data to""" add_request: AddRequestTypedDict -class AddKnowledgeKnowledgeBaseIDIndexPostRequest(BaseModel): +class AddKnowledgeKnowledgeBaseIDAddPostRequest(BaseModel): knowledge_base_id: Annotated[ str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False)) ] diff --git a/src/opperai/models/addrequest.py b/src/opperai/models/addrequest.py index 4acc61e..63ee7f7 100644 --- a/src/opperai/models/addrequest.py +++ b/src/opperai/models/addrequest.py @@ -1,9 +1,9 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .fileprocessconfiguration import ( - FileProcessConfiguration, - FileProcessConfigurationTypedDict, +from .textprocessingconfiguration import ( + TextProcessingConfiguration, + TextProcessingConfigurationTypedDict, ) from opperai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL from pydantic import model_serializer @@ -17,7 +17,7 @@ class AddRequestTypedDict(TypedDict): r"""The key of the document""" metadata: NotRequired[Dict[str, Any]] r"""The metadata of the document""" - configuration: NotRequired[Nullable[FileProcessConfigurationTypedDict]] + configuration: NotRequired[Nullable[TextProcessingConfigurationTypedDict]] r"""The configuration for the document""" @@ -30,7 +30,7 @@ class AddRequest(BaseModel): metadata: Optional[Dict[str, Any]] = None r"""The metadata of the document""" - configuration: OptionalNullable[FileProcessConfiguration] = UNSET + configuration: OptionalNullable[TextProcessingConfiguration] = UNSET r"""The configuration for the document""" @model_serializer(mode="wrap") diff --git a/src/opperai/models/fileprocessconfiguration.py b/src/opperai/models/fileprocessconfiguration.py deleted file mode 100644 index 87bd1c5..0000000 --- a/src/opperai/models/fileprocessconfiguration.py +++ /dev/null @@ -1,21 +0,0 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from .pdfprocessorname import PdfProcessorName -from opperai.types import BaseModel -from typing import Optional -from typing_extensions import NotRequired, TypedDict - - -class FileProcessConfigurationTypedDict(TypedDict): - chunk_size: NotRequired[int] - chunk_overlap: NotRequired[int] - pdf_processor: NotRequired[PdfProcessorName] - - -class FileProcessConfiguration(BaseModel): - chunk_size: Optional[int] = 2000 - - chunk_overlap: Optional[int] = 200 - - pdf_processor: Optional[PdfProcessorName] = None diff --git a/src/opperai/models/pdfprocessorname.py b/src/opperai/models/pdfprocessorname.py deleted file mode 100644 index f1358a7..0000000 --- a/src/opperai/models/pdfprocessorname.py +++ /dev/null @@ -1,8 +0,0 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from enum import Enum - - -class PdfProcessorName(str, Enum): - PYPDF = "pypdf" diff --git a/src/opperai/models/registerfileuploadrequest.py b/src/opperai/models/registerfileuploadrequest.py index 78d866f..4ae8c3d 100644 --- a/src/opperai/models/registerfileuploadrequest.py +++ b/src/opperai/models/registerfileuploadrequest.py @@ -1,9 +1,9 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .fileprocessconfiguration import ( - FileProcessConfiguration, - FileProcessConfigurationTypedDict, +from .textprocessingconfiguration import ( + TextProcessingConfiguration, + TextProcessingConfigurationTypedDict, ) from opperai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL from pydantic import model_serializer @@ -17,7 +17,7 @@ class RegisterFileUploadRequestTypedDict(TypedDict): r"""The id of the file to register""" content_type: str r"""The content type of the file to register""" - configuration: NotRequired[Nullable[FileProcessConfigurationTypedDict]] + configuration: NotRequired[Nullable[TextProcessingConfigurationTypedDict]] r"""The configuration for the file to register""" @@ -31,7 +31,7 @@ class RegisterFileUploadRequest(BaseModel): content_type: str r"""The content type of the file to register""" - configuration: OptionalNullable[FileProcessConfiguration] = UNSET + configuration: OptionalNullable[TextProcessingConfiguration] = UNSET r"""The configuration for the file to register""" @model_serializer(mode="wrap") diff --git a/src/opperai/models/textprocessingconfiguration.py b/src/opperai/models/textprocessingconfiguration.py new file mode 100644 index 0000000..608cfd6 --- /dev/null +++ b/src/opperai/models/textprocessingconfiguration.py @@ -0,0 +1,26 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from opperai.types import BaseModel +import pydantic +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class TextProcessingConfigurationTypedDict(TypedDict): + text_processing_chunk_size: NotRequired[int] + r"""The chunk size to use for the document. This is the number of characters to use for the chunk. The default is 2000 characters.""" + text_processing_chunk_overlap: NotRequired[int] + r"""The chunk overlap to use for the document. This is the number of characters to overlap between chunks. The default is 200 characters.""" + + +class TextProcessingConfiguration(BaseModel): + text_processing_chunk_size: Annotated[ + Optional[int], pydantic.Field(alias="text_processing.chunk_size") + ] = 2000 + r"""The chunk size to use for the document. This is the number of characters to use for the chunk. The default is 2000 characters.""" + + text_processing_chunk_overlap: Annotated[ + Optional[int], pydantic.Field(alias="text_processing.chunk_overlap") + ] = 200 + r"""The chunk overlap to use for the document. This is the number of characters to overlap between chunks. The default is 200 characters.""" diff --git a/src/opperai/sdk.py b/src/opperai/sdk.py index 03bcd03..8da6a0d 100644 --- a/src/opperai/sdk.py +++ b/src/opperai/sdk.py @@ -205,7 +205,7 @@ def call( instructions: OptionalNullable[str] = UNSET, input_schema: OptionalNullable[Dict[str, Any]] = UNSET, output_schema: OptionalNullable[Dict[str, Any]] = UNSET, - input_: OptionalNullable[Any] = UNSET, + input: OptionalNullable[Any] = UNSET, model: Optional[Union[models.TModel, models.TModelTypedDict]] = None, examples: OptionalNullable[ Union[List[models.Example], List[models.ExampleTypedDict]] @@ -253,12 +253,19 @@ def call( else: base_url = self._get_url(base_url, url_variables) + # region convert-pydantic-schemas + if input_schema is not UNSET and hasattr(input_schema, 'model_json_schema'): + input_schema = input_schema.model_json_schema() + if output_schema is not UNSET and hasattr(output_schema, 'model_json_schema'): + output_schema = output_schema.model_json_schema() + # endregion convert-pydantic-schemas + request = models.AppAPIPublicV2FunctionCallCallFunctionRequest( name=name, instructions=instructions, input_schema=input_schema, output_schema=output_schema, - input=input_, + input=input, model=utils.get_pydantic_model(model, Optional[models.TModel]), examples=utils.get_pydantic_model( examples, OptionalNullable[List[models.Example]] @@ -368,7 +375,7 @@ async def call_async( instructions: OptionalNullable[str] = UNSET, input_schema: OptionalNullable[Dict[str, Any]] = UNSET, output_schema: OptionalNullable[Dict[str, Any]] = UNSET, - input_: OptionalNullable[Any] = UNSET, + input: OptionalNullable[Any] = UNSET, model: Optional[Union[models.TModel, models.TModelTypedDict]] = None, examples: OptionalNullable[ Union[List[models.Example], List[models.ExampleTypedDict]] @@ -416,12 +423,19 @@ async def call_async( else: base_url = self._get_url(base_url, url_variables) + # region convert-pydantic-schemas + if input_schema is not UNSET and hasattr(input_schema, 'model_json_schema'): + input_schema = input_schema.model_json_schema() + if output_schema is not UNSET and hasattr(output_schema, 'model_json_schema'): + output_schema = output_schema.model_json_schema() + # endregion convert-pydantic-schemas + request = models.AppAPIPublicV2FunctionCallCallFunctionRequest( name=name, instructions=instructions, input_schema=input_schema, output_schema=output_schema, - input=input_, + input=input, model=utils.get_pydantic_model(model, Optional[models.TModel]), examples=utils.get_pydantic_model( examples, OptionalNullable[List[models.Example]] @@ -531,7 +545,7 @@ def stream( instructions: OptionalNullable[str] = UNSET, input_schema: OptionalNullable[Dict[str, Any]] = UNSET, output_schema: OptionalNullable[Dict[str, Any]] = UNSET, - input_: OptionalNullable[Any] = UNSET, + input: OptionalNullable[Any] = UNSET, model: Optional[Union[models.TModel, models.TModelTypedDict]] = None, examples: OptionalNullable[ Union[List[models.Example], List[models.ExampleTypedDict]] @@ -595,12 +609,19 @@ def stream( else: base_url = self._get_url(base_url, url_variables) + # region convert-pydantic-schemas + if input_schema is not UNSET and hasattr(input_schema, 'model_json_schema'): + input_schema = input_schema.model_json_schema() + if output_schema is not UNSET and hasattr(output_schema, 'model_json_schema'): + output_schema = output_schema.model_json_schema() + # endregion convert-pydantic-schemas + request = models.AppAPIPublicV2FunctionCallCallFunctionRequest( name=name, instructions=instructions, input_schema=input_schema, output_schema=output_schema, - input=input_, + input=input, model=utils.get_pydantic_model(model, Optional[models.TModel]), examples=utils.get_pydantic_model( examples, OptionalNullable[List[models.Example]] @@ -721,7 +742,7 @@ async def stream_async( instructions: OptionalNullable[str] = UNSET, input_schema: OptionalNullable[Dict[str, Any]] = UNSET, output_schema: OptionalNullable[Dict[str, Any]] = UNSET, - input_: OptionalNullable[Any] = UNSET, + input: OptionalNullable[Any] = UNSET, model: Optional[Union[models.TModel, models.TModelTypedDict]] = None, examples: OptionalNullable[ Union[List[models.Example], List[models.ExampleTypedDict]] @@ -785,12 +806,19 @@ async def stream_async( else: base_url = self._get_url(base_url, url_variables) + # region convert-pydantic-schemas + if input_schema is not UNSET and hasattr(input_schema, 'model_json_schema'): + input_schema = input_schema.model_json_schema() + if output_schema is not UNSET and hasattr(output_schema, 'model_json_schema'): + output_schema = output_schema.model_json_schema() + # endregion convert-pydantic-schemas + request = models.AppAPIPublicV2FunctionCallCallFunctionRequest( name=name, instructions=instructions, input_schema=input_schema, output_schema=output_schema, - input=input_, + input=input, model=utils.get_pydantic_model(model, Optional[models.TModel]), examples=utils.get_pydantic_model( examples, OptionalNullable[List[models.Example]] diff --git a/src/opperai/spans.py b/src/opperai/spans.py index 2f6335e..30c3fc6 100644 --- a/src/opperai/spans.py +++ b/src/opperai/spans.py @@ -18,9 +18,9 @@ def create( id: OptionalNullable[str] = UNSET, trace_id: OptionalNullable[str] = UNSET, parent_id: OptionalNullable[str] = UNSET, - type_: OptionalNullable[str] = UNSET, + type: OptionalNullable[str] = UNSET, end_time: OptionalNullable[datetime] = UNSET, - input_: OptionalNullable[Any] = UNSET, + input: OptionalNullable[Any] = UNSET, output: OptionalNullable[Any] = UNSET, error: OptionalNullable[str] = UNSET, meta: OptionalNullable[Dict[str, Any]] = UNSET, @@ -67,9 +67,9 @@ def create( id=id, trace_id=trace_id, parent_id=parent_id, - type=type_, + type=type, end_time=end_time, - input=input_, + input=input, output=output, error=error, meta=meta, @@ -169,9 +169,9 @@ async def create_async( id: OptionalNullable[str] = UNSET, trace_id: OptionalNullable[str] = UNSET, parent_id: OptionalNullable[str] = UNSET, - type_: OptionalNullable[str] = UNSET, + type: OptionalNullable[str] = UNSET, end_time: OptionalNullable[datetime] = UNSET, - input_: OptionalNullable[Any] = UNSET, + input: OptionalNullable[Any] = UNSET, output: OptionalNullable[Any] = UNSET, error: OptionalNullable[str] = UNSET, meta: OptionalNullable[Dict[str, Any]] = UNSET, @@ -218,9 +218,9 @@ async def create_async( id=id, trace_id=trace_id, parent_id=parent_id, - type=type_, + type=type, end_time=end_time, - input=input_, + input=input, output=output, error=error, meta=meta, @@ -548,9 +548,9 @@ def update( span_id: str, name: OptionalNullable[str] = UNSET, start_time: OptionalNullable[datetime] = UNSET, - type_: OptionalNullable[str] = UNSET, + type: OptionalNullable[str] = UNSET, end_time: OptionalNullable[datetime] = UNSET, - input_: OptionalNullable[str] = UNSET, + input: OptionalNullable[str] = UNSET, output: OptionalNullable[str] = UNSET, error: OptionalNullable[str] = UNSET, meta: OptionalNullable[Dict[str, Any]] = UNSET, @@ -594,9 +594,9 @@ def update( update_span_request=models.UpdateSpanRequest( name=name, start_time=start_time, - type=type_, + type=type, end_time=end_time, - input=input_, + input=input, output=output, error=error, meta=meta, @@ -699,9 +699,9 @@ async def update_async( span_id: str, name: OptionalNullable[str] = UNSET, start_time: OptionalNullable[datetime] = UNSET, - type_: OptionalNullable[str] = UNSET, + type: OptionalNullable[str] = UNSET, end_time: OptionalNullable[datetime] = UNSET, - input_: OptionalNullable[str] = UNSET, + input: OptionalNullable[str] = UNSET, output: OptionalNullable[str] = UNSET, error: OptionalNullable[str] = UNSET, meta: OptionalNullable[Dict[str, Any]] = UNSET, @@ -745,9 +745,9 @@ async def update_async( update_span_request=models.UpdateSpanRequest( name=name, start_time=start_time, - type=type_, + type=type, end_time=end_time, - input=input_, + input=input, output=output, error=error, meta=meta, diff --git a/tests/mockserver/internal/sdk/models/components/addrequest.go b/tests/mockserver/internal/sdk/models/components/addrequest.go index 671c018..3215a89 100644 --- a/tests/mockserver/internal/sdk/models/components/addrequest.go +++ b/tests/mockserver/internal/sdk/models/components/addrequest.go @@ -9,7 +9,7 @@ type AddRequest struct { // The metadata of the document Metadata map[string]any `json:"metadata,omitempty"` // The configuration for the document - Configuration *FileProcessConfiguration `json:"configuration,omitempty"` + Configuration *TextProcessingConfiguration `json:"configuration,omitempty"` } func (o *AddRequest) GetKey() *string { @@ -33,7 +33,7 @@ func (o *AddRequest) GetMetadata() map[string]any { return o.Metadata } -func (o *AddRequest) GetConfiguration() *FileProcessConfiguration { +func (o *AddRequest) GetConfiguration() *TextProcessingConfiguration { if o == nil { return nil } diff --git a/tests/mockserver/internal/sdk/models/components/fileprocessconfiguration.go b/tests/mockserver/internal/sdk/models/components/fileprocessconfiguration.go deleted file mode 100644 index ea3dca6..0000000 --- a/tests/mockserver/internal/sdk/models/components/fileprocessconfiguration.go +++ /dev/null @@ -1,45 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package components - -import ( - "mockserver/internal/sdk/utils" -) - -type FileProcessConfiguration struct { - ChunkSize *int64 `default:"2000" json:"chunk_size"` - ChunkOverlap *int64 `default:"200" json:"chunk_overlap"` - PdfProcessor *PdfProcessorName `json:"pdf_processor,omitempty"` -} - -func (f FileProcessConfiguration) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(f, "", false) -} - -func (f *FileProcessConfiguration) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &f, "", false, false); err != nil { - return err - } - return nil -} - -func (o *FileProcessConfiguration) GetChunkSize() *int64 { - if o == nil { - return nil - } - return o.ChunkSize -} - -func (o *FileProcessConfiguration) GetChunkOverlap() *int64 { - if o == nil { - return nil - } - return o.ChunkOverlap -} - -func (o *FileProcessConfiguration) GetPdfProcessor() *PdfProcessorName { - if o == nil { - return nil - } - return o.PdfProcessor -} diff --git a/tests/mockserver/internal/sdk/models/components/pdfprocessorname.go b/tests/mockserver/internal/sdk/models/components/pdfprocessorname.go deleted file mode 100644 index 5129710..0000000 --- a/tests/mockserver/internal/sdk/models/components/pdfprocessorname.go +++ /dev/null @@ -1,31 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package components - -import ( - "encoding/json" - "fmt" -) - -type PdfProcessorName string - -const ( - PdfProcessorNamePypdf PdfProcessorName = "pypdf" -) - -func (e PdfProcessorName) ToPointer() *PdfProcessorName { - return &e -} -func (e *PdfProcessorName) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "pypdf": - *e = PdfProcessorName(v) - return nil - default: - return fmt.Errorf("invalid value for PdfProcessorName: %v", v) - } -} diff --git a/tests/mockserver/internal/sdk/models/components/registerfileuploadrequest.go b/tests/mockserver/internal/sdk/models/components/registerfileuploadrequest.go index e70507f..b5b6e78 100644 --- a/tests/mockserver/internal/sdk/models/components/registerfileuploadrequest.go +++ b/tests/mockserver/internal/sdk/models/components/registerfileuploadrequest.go @@ -10,7 +10,7 @@ type RegisterFileUploadRequest struct { // The content type of the file to register ContentType string `json:"content_type"` // The configuration for the file to register - Configuration *FileProcessConfiguration `json:"configuration,omitempty"` + Configuration *TextProcessingConfiguration `json:"configuration,omitempty"` } func (o *RegisterFileUploadRequest) GetFilename() string { @@ -34,7 +34,7 @@ func (o *RegisterFileUploadRequest) GetContentType() string { return o.ContentType } -func (o *RegisterFileUploadRequest) GetConfiguration() *FileProcessConfiguration { +func (o *RegisterFileUploadRequest) GetConfiguration() *TextProcessingConfiguration { if o == nil { return nil } diff --git a/tests/mockserver/internal/sdk/models/components/textprocessingconfiguration.go b/tests/mockserver/internal/sdk/models/components/textprocessingconfiguration.go new file mode 100644 index 0000000..6f4058d --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/textprocessingconfiguration.go @@ -0,0 +1,39 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "mockserver/internal/sdk/utils" +) + +type TextProcessingConfiguration struct { + // The chunk size to use for the document. This is the number of characters to use for the chunk. The default is 2000 characters. + TextProcessingChunkSize *int64 `default:"2000" json:"text_processing.chunk_size"` + // The chunk overlap to use for the document. This is the number of characters to overlap between chunks. The default is 200 characters. + TextProcessingChunkOverlap *int64 `default:"200" json:"text_processing.chunk_overlap"` +} + +func (t TextProcessingConfiguration) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(t, "", false) +} + +func (t *TextProcessingConfiguration) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &t, "", false, false); err != nil { + return err + } + return nil +} + +func (o *TextProcessingConfiguration) GetTextProcessingChunkSize() *int64 { + if o == nil { + return nil + } + return o.TextProcessingChunkSize +} + +func (o *TextProcessingConfiguration) GetTextProcessingChunkOverlap() *int64 { + if o == nil { + return nil + } + return o.TextProcessingChunkOverlap +} diff --git a/tests/mockserver/internal/sdk/models/operations/addknowledgeknowledgebaseidindexpost.go b/tests/mockserver/internal/sdk/models/operations/addknowledgeknowledgebaseidaddpost.go similarity index 61% rename from tests/mockserver/internal/sdk/models/operations/addknowledgeknowledgebaseidindexpost.go rename to tests/mockserver/internal/sdk/models/operations/addknowledgeknowledgebaseidaddpost.go index da7e568..6adca75 100644 --- a/tests/mockserver/internal/sdk/models/operations/addknowledgeknowledgebaseidindexpost.go +++ b/tests/mockserver/internal/sdk/models/operations/addknowledgeknowledgebaseidaddpost.go @@ -6,40 +6,40 @@ import ( "mockserver/internal/sdk/models/components" ) -type AddKnowledgeKnowledgeBaseIDIndexPostRequest struct { +type AddKnowledgeKnowledgeBaseIDAddPostRequest struct { // The id of the knowledge base to add the data to KnowledgeBaseID string `pathParam:"style=simple,explode=false,name=knowledge_base_id"` AddRequest components.AddRequest `request:"mediaType=application/json"` } -func (o *AddKnowledgeKnowledgeBaseIDIndexPostRequest) GetKnowledgeBaseID() string { +func (o *AddKnowledgeKnowledgeBaseIDAddPostRequest) GetKnowledgeBaseID() string { if o == nil { return "" } return o.KnowledgeBaseID } -func (o *AddKnowledgeKnowledgeBaseIDIndexPostRequest) GetAddRequest() components.AddRequest { +func (o *AddKnowledgeKnowledgeBaseIDAddPostRequest) GetAddRequest() components.AddRequest { if o == nil { return components.AddRequest{} } return o.AddRequest } -type AddKnowledgeKnowledgeBaseIDIndexPostResponse struct { +type AddKnowledgeKnowledgeBaseIDAddPostResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // Successful Response Any any } -func (o *AddKnowledgeKnowledgeBaseIDIndexPostResponse) GetHTTPMeta() components.HTTPMetadata { +func (o *AddKnowledgeKnowledgeBaseIDAddPostResponse) GetHTTPMeta() components.HTTPMetadata { if o == nil { return components.HTTPMetadata{} } return o.HTTPMeta } -func (o *AddKnowledgeKnowledgeBaseIDIndexPostResponse) GetAny() any { +func (o *AddKnowledgeKnowledgeBaseIDAddPostResponse) GetAny() any { if o == nil { return nil } From f35539a133bf8e903b747a592eba0920e068e369 Mon Sep 17 00:00:00 2001 From: Johnny Chadda Date: Fri, 27 Jun 2025 15:00:22 +0200 Subject: [PATCH 2/2] Fix kb overlay and regenerate --- .speakeasy/gen.lock | 6 +- .speakeasy/gen.yaml | 2 +- .../speakeasy-modifications-overlay.yaml | 14 +++-- .speakeasy/workflow.lock | 7 +-- README.md | 20 +++---- USAGE.md | 4 +- docs/sdks/datasets/README.md | 2 +- docs/sdks/embeddings/README.md | 2 +- docs/sdks/entries/README.md | 2 +- docs/sdks/functions/README.md | 8 +-- docs/sdks/knowledge/README.md | 12 ++-- docs/sdks/opper/README.md | 4 +- docs/sdks/spans/README.md | 4 +- pyproject.toml | 2 +- src/opperai/_version.py | 4 +- src/opperai/datasets.py | 8 +-- src/opperai/embeddings.py | 8 +-- src/opperai/entries.py | 8 +-- src/opperai/functions.py | 60 +++++-------------- src/opperai/knowledge.py | 8 +-- src/opperai/sdk.py | 44 +++----------- src/opperai/spans.py | 32 +++++----- 22 files changed, 104 insertions(+), 157 deletions(-) diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 44736fc..e06ad0c 100644 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,12 +1,12 @@ lockVersion: 2.0.0 id: c75567cf-9def-4617-8ae7-65af6f367b68 management: - docChecksum: 13be598dda17c8e41e2eae5c2a468111 + docChecksum: 552d84cd05ab94ffe7766e00a1642d41 docVersion: 2.0.0 speakeasyVersion: 1.570.2 generationVersion: 2.638.5 - releaseVersion: 1.0.1 - configChecksum: 8ecbcaa4f87221d7c6c138e9953c2432 + releaseVersion: 1.0.3 + configChecksum: f8263b93221ce3b52c95e02f71d7f53d features: python: additionalDependencies: 1.0.0 diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index d4636df..7548c48 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -25,7 +25,7 @@ generation: generateNewTests: false skipResponseBodyAssertions: false python: - version: 1.0.1 + version: 1.0.3 additionalDependencies: dev: {} main: {} diff --git a/.speakeasy/speakeasy-modifications-overlay.yaml b/.speakeasy/speakeasy-modifications-overlay.yaml index 12941c4..152c37d 100644 --- a/.speakeasy/speakeasy-modifications-overlay.yaml +++ b/.speakeasy/speakeasy-modifications-overlay.yaml @@ -2,7 +2,7 @@ overlay: 1.0.0 x-speakeasy-jsonpath: rfc9535 info: title: Speakeasy Modifications - version: 0.0.28 + version: 0.0.30 x-speakeasy-metadata: after: "" before: "" @@ -709,8 +709,12 @@ actions: x-speakeasy-metadata: created_at: 1750925230100 type: user-edit - - target: $["paths"]["/knowledge"]["post"]["x-speakeasy-name-override"] - update: create + - target: $["paths"]["/knowledge/{knowledge_base_id}/add"]["post"] + update: + x-speakeasy-name-override: add x-speakeasy-metadata: - created_at: 1750925236399 - type: user-edit + after: sdk.knowledge.add() + before: sdk.knowledge.add_knowledge__knowledge_base_id__add_post() + created_at: 1751029113444 + reviewed_at: 1751029118113 + type: method-name diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 7a672dc..db1695d 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -2,20 +2,19 @@ speakeasyVersion: 1.570.2 sources: FastAPI: sourceNamespace: fast-api - sourceRevisionDigest: sha256:c8cd765eeb0a507cc8000e72d1d9513bc651616bfecf5cf84ff5d6864f888c51 + sourceRevisionDigest: sha256:b66f7e1f7511a3a98ba9cd12b772ec995f5cf4362a60fdcc5b2582f1fa09b05b sourceBlobDigest: sha256:46c3eaf6d76d253f805f2e4bb527f5a3e1ee391f78222af96eebb199446604b1 tags: - latest - - main - 2.0.0 targets: opper: source: FastAPI sourceNamespace: fast-api - sourceRevisionDigest: sha256:c8cd765eeb0a507cc8000e72d1d9513bc651616bfecf5cf84ff5d6864f888c51 + sourceRevisionDigest: sha256:b66f7e1f7511a3a98ba9cd12b772ec995f5cf4362a60fdcc5b2582f1fa09b05b sourceBlobDigest: sha256:46c3eaf6d76d253f805f2e4bb527f5a3e1ee391f78222af96eebb199446604b1 codeSamplesNamespace: fast-api-python-code-samples - codeSamplesRevisionDigest: sha256:8f938ea91138da9e592845d3d2818d17700b8d7179a856eecbb02daadb87e78a + codeSamplesRevisionDigest: sha256:27f0e2c1eed1575de750c05307aa2e88414496aea05007fc0a2f81e5797d1d6b workflow: workflowVersion: 1.0.0 speakeasyVersion: latest diff --git a/README.md b/README.md index 163f6b1..c237bf4 100644 --- a/README.md +++ b/README.md @@ -156,7 +156,7 @@ with Opper( ], "title": "OpperOutputExample", "type": "object", - }, input={ + }, input_={ "x": 4, "y": 5, }, examples=[ @@ -223,7 +223,7 @@ async def main(): ], "title": "OpperOutputExample", "type": "object", - }, input={ + }, input_={ "x": 4, "y": 5, }, examples=[ @@ -299,7 +299,7 @@ with Opper( ], "title": "OpperOutputExample", "type": "object", - }, input={ + }, input_={ "x": 4, "y": 5, }, examples=[ @@ -370,7 +370,7 @@ with Opper( ### [knowledge](docs/sdks/knowledge/README.md) -* [create](docs/sdks/knowledge/README.md#create) - Create Knowledge Base +* [creat](docs/sdks/knowledge/README.md#creat) - Create Knowledge Base * [list](docs/sdks/knowledge/README.md#list) - List Knowledge Bases * [get](docs/sdks/knowledge/README.md#get) - Get Knowledge Base * [delete](docs/sdks/knowledge/README.md#delete) - Delete Knowledge Base @@ -379,7 +379,7 @@ with Opper( * [register_file_upload](docs/sdks/knowledge/README.md#register_file_upload) - Register File Upload * [delete_file](docs/sdks/knowledge/README.md#delete_file) - Delete File From Knowledge Base * [query](docs/sdks/knowledge/README.md#query) - Query Knowledge Base -* [add_knowledge_knowledge_base_id_add_post](docs/sdks/knowledge/README.md#add_knowledge_knowledge_base_id_add_post) - Add +* [add](docs/sdks/knowledge/README.md#add) - Add ### [language_models](docs/sdks/languagemodels/README.md) @@ -474,7 +474,7 @@ with Opper( ], "title": "OpperOutputExample", "type": "object", - }, input={ + }, input_={ "x": 4, "y": 5, }, examples=[ @@ -550,7 +550,7 @@ with Opper( ], "title": "OpperOutputExample", "type": "object", - }, input={ + }, input_={ "x": 4, "y": 5, }, examples=[ @@ -616,7 +616,7 @@ with Opper( ], "title": "OpperOutputExample", "type": "object", - }, input={ + }, input_={ "x": 4, "y": 5, }, examples=[ @@ -707,7 +707,7 @@ with Opper( ], "title": "OpperOutputExample", "type": "object", - }, input={ + }, input_={ "x": 4, "y": 5, }, examples=[ @@ -792,7 +792,7 @@ with Opper( ], "title": "OpperOutputExample", "type": "object", - }, input={ + }, input_={ "x": 4, "y": 5, }, examples=[ diff --git a/USAGE.md b/USAGE.md index abece1d..fb05c92 100644 --- a/USAGE.md +++ b/USAGE.md @@ -38,7 +38,7 @@ with Opper( ], "title": "OpperOutputExample", "type": "object", - }, input={ + }, input_={ "x": 4, "y": 5, }, examples=[ @@ -105,7 +105,7 @@ async def main(): ], "title": "OpperOutputExample", "type": "object", - }, input={ + }, input_={ "x": 4, "y": 5, }, examples=[ diff --git a/docs/sdks/datasets/README.md b/docs/sdks/datasets/README.md index e049ed9..7bb7ef8 100644 --- a/docs/sdks/datasets/README.md +++ b/docs/sdks/datasets/README.md @@ -26,7 +26,7 @@ with Opper( http_bearer=os.getenv("OPPER_HTTP_BEARER", ""), ) as opper: - res = opper.datasets.create_entry(dataset_id="50c15d18-6e79-449b-9e59-30324da6de5f", input={ + res = opper.datasets.create_entry(dataset_id="50c15d18-6e79-449b-9e59-30324da6de5f", input_={ "x": 4, "y": 5, }, output={ diff --git a/docs/sdks/embeddings/README.md b/docs/sdks/embeddings/README.md index 4736118..bb9f8ac 100644 --- a/docs/sdks/embeddings/README.md +++ b/docs/sdks/embeddings/README.md @@ -22,7 +22,7 @@ with Opper( http_bearer=os.getenv("OPPER_HTTP_BEARER", ""), ) as opper: - res = opper.embeddings.create(input="Hello, world!") + res = opper.embeddings.create(input_="Hello, world!") # Handle response print(res) diff --git a/docs/sdks/entries/README.md b/docs/sdks/entries/README.md index 69568d0..c4a3171 100644 --- a/docs/sdks/entries/README.md +++ b/docs/sdks/entries/README.md @@ -22,7 +22,7 @@ with Opper( http_bearer=os.getenv("OPPER_HTTP_BEARER", ""), ) as opper: - res = opper.datasets.entries.update(dataset_id="df57581c-3364-4ee6-a9f8-7de20cb937ff", entry_id="2789b25b-1a98-4360-96ee-67e9af98c53f", input="Given this input, what is the output?", output="This is the output to the dataset entry", expected="This `was` the output to the dataset entry", comment="This is an example of how one can edit the output") + res = opper.datasets.entries.update(dataset_id="df57581c-3364-4ee6-a9f8-7de20cb937ff", entry_id="2789b25b-1a98-4360-96ee-67e9af98c53f", input_="Given this input, what is the output?", output="This is the output to the dataset entry", expected="This `was` the output to the dataset entry", comment="This is an example of how one can edit the output") # Handle response print(res) diff --git a/docs/sdks/functions/README.md b/docs/sdks/functions/README.md index 97457ac..c23d264 100644 --- a/docs/sdks/functions/README.md +++ b/docs/sdks/functions/README.md @@ -409,7 +409,7 @@ with Opper( http_bearer=os.getenv("OPPER_HTTP_BEARER", ""), ) as opper: - res = opper.functions.call(function_id="864c5880-3d87-4091-828c-33cc2c7219a9", input={ + res = opper.functions.call(function_id="864c5880-3d87-4091-828c-33cc2c7219a9", input_={ "x": 4, "y": 5, }, examples=[ @@ -486,7 +486,7 @@ with Opper( http_bearer=os.getenv("OPPER_HTTP_BEARER", ""), ) as opper: - res = opper.functions.stream(function_id="e35c595b-59f2-40b8-bc8a-d6f71ebd3c63", input={ + res = opper.functions.stream(function_id="e35c595b-59f2-40b8-bc8a-d6f71ebd3c63", input_={ "x": 4, "y": 5, }, examples=[ @@ -551,7 +551,7 @@ with Opper( http_bearer=os.getenv("OPPER_HTTP_BEARER", ""), ) as opper: - res = opper.functions.call_revision(function_id="b7391b0d-f115-4145-ae29-a136ae2d6a7a", revision_id="de9b5cac-c926-4aa1-a5ab-dc3aa3cd539c", input={ + res = opper.functions.call_revision(function_id="b7391b0d-f115-4145-ae29-a136ae2d6a7a", revision_id="de9b5cac-c926-4aa1-a5ab-dc3aa3cd539c", input_={ "x": 4, "y": 5, }, examples=[ @@ -629,7 +629,7 @@ with Opper( http_bearer=os.getenv("OPPER_HTTP_BEARER", ""), ) as opper: - res = opper.functions.stream_revision(function_id="d69e8466-7dba-4eaf-983c-ee6573398ae7", revision_id="c5701ae3-acaf-40b6-95f8-5c1192d84640", input={ + res = opper.functions.stream_revision(function_id="d69e8466-7dba-4eaf-983c-ee6573398ae7", revision_id="c5701ae3-acaf-40b6-95f8-5c1192d84640", input_={ "x": 4, "y": 5, }, examples=[ diff --git a/docs/sdks/knowledge/README.md b/docs/sdks/knowledge/README.md index 95fa539..0573e11 100644 --- a/docs/sdks/knowledge/README.md +++ b/docs/sdks/knowledge/README.md @@ -5,7 +5,7 @@ ### Available Operations -* [create](#create) - Create Knowledge Base +* [creat](#creat) - Create Knowledge Base * [list](#list) - List Knowledge Bases * [get](#get) - Get Knowledge Base * [delete](#delete) - Delete Knowledge Base @@ -14,9 +14,9 @@ * [register_file_upload](#register_file_upload) - Register File Upload * [delete_file](#delete_file) - Delete File From Knowledge Base * [query](#query) - Query Knowledge Base -* [add_knowledge_knowledge_base_id_add_post](#add_knowledge_knowledge_base_id_add_post) - Add +* [add](#add) - Add -## create +## creat Create a knowledge base @@ -31,7 +31,7 @@ with Opper( http_bearer=os.getenv("OPPER_HTTP_BEARER", ""), ) as opper: - res = opper.knowledge.create(name="", embedding_model="azure/text-embedding-3-large") + res = opper.knowledge.creat(name="", embedding_model="azure/text-embedding-3-large") # Handle response print(res) @@ -431,7 +431,7 @@ with Opper( | errors.RequestValidationError | 422 | application/json | | errors.APIError | 4XX, 5XX | \*/\* | -## add_knowledge_knowledge_base_id_add_post +## add Add data to a knowledge base @@ -446,7 +446,7 @@ with Opper( http_bearer=os.getenv("OPPER_HTTP_BEARER", ""), ) as opper: - res = opper.knowledge.add_knowledge_knowledge_base_id_add_post(knowledge_base_id="c441b497-32db-4e24-8f41-ab160e1329fc", content="The capital of France is Paris", key="paris_123", metadata={ + res = opper.knowledge.add(knowledge_base_id="c441b497-32db-4e24-8f41-ab160e1329fc", content="The capital of France is Paris", key="paris_123", metadata={ "category": "product", "price": 100, }) diff --git a/docs/sdks/opper/README.md b/docs/sdks/opper/README.md index ba2f525..2e3808b 100644 --- a/docs/sdks/opper/README.md +++ b/docs/sdks/opper/README.md @@ -52,7 +52,7 @@ with Opper( ], "title": "OpperOutputExample", "type": "object", - }, input={ + }, input_={ "x": 4, "y": 5, }, examples=[ @@ -167,7 +167,7 @@ with Opper( ], "title": "OpperOutputExample", "type": "object", - }, input={ + }, input_={ "x": 4, "y": 5, }, examples=[ diff --git a/docs/sdks/spans/README.md b/docs/sdks/spans/README.md index a2e5e5f..b7923ba 100644 --- a/docs/sdks/spans/README.md +++ b/docs/sdks/spans/README.md @@ -27,7 +27,7 @@ with Opper( http_bearer=os.getenv("OPPER_HTTP_BEARER", ""), ) as opper: - res = opper.spans.create(name="my span", start_time=parse_datetime("2024-03-20T10:00:00+00:00"), id="123e4567-e89b-12d3-a456-426614174000", trace_id="123e4567-e89b-12d3-a456-426614174000", parent_id="123e4567-e89b-12d3-a456-426614174000", type="email_tool", end_time=parse_datetime("2024-03-20T10:00:10+00:00"), input="Hello, world!", output="Hello, world!", error="Exception: This is an error message", meta={ + res = opper.spans.create(name="my span", start_time=parse_datetime("2024-03-20T10:00:00+00:00"), id="123e4567-e89b-12d3-a456-426614174000", trace_id="123e4567-e89b-12d3-a456-426614174000", parent_id="123e4567-e89b-12d3-a456-426614174000", type_="email_tool", end_time=parse_datetime("2024-03-20T10:00:10+00:00"), input_="Hello, world!", output="Hello, world!", error="Exception: This is an error message", meta={ "key": "value", }, score=10) @@ -127,7 +127,7 @@ with Opper( http_bearer=os.getenv("OPPER_HTTP_BEARER", ""), ) as opper: - res = opper.spans.update(span_id="77b258a2-45c1-4b87-a50c-9116bc8ed1d6", name="my span", start_time=parse_datetime("2025-06-27T11:37:21.302644Z"), type="email_tool", end_time=parse_datetime("2025-06-27T11:37:21.302704Z"), input="Hello, world!", output="Hello, world!", error="Exception: This is an error message", meta={ + res = opper.spans.update(span_id="77b258a2-45c1-4b87-a50c-9116bc8ed1d6", name="my span", start_time=parse_datetime("2025-06-27T11:37:21.302644Z"), type_="email_tool", end_time=parse_datetime("2025-06-27T11:37:21.302704Z"), input_="Hello, world!", output="Hello, world!", error="Exception: This is an error message", meta={ "key": "value", }, score=10) diff --git a/pyproject.toml b/pyproject.toml index 6e5098c..2d7df06 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "opperai" -version = "1.0.1" +version = "1.0.3" description = "Python Client SDK Generated by Speakeasy." authors = [{ name = "Speakeasy" },] readme = "README.md" diff --git a/src/opperai/_version.py b/src/opperai/_version.py index 0b5d3fa..b92cda6 100644 --- a/src/opperai/_version.py +++ b/src/opperai/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "opperai" -__version__: str = "1.0.1" +__version__: str = "1.0.3" __openapi_doc_version__: str = "2.0.0" __gen_version__: str = "2.638.5" -__user_agent__: str = "speakeasy-sdk/python 1.0.1 2.638.5 2.0.0 opperai" +__user_agent__: str = "speakeasy-sdk/python 1.0.3 2.638.5 2.0.0 opperai" try: if __package__ is not None: diff --git a/src/opperai/datasets.py b/src/opperai/datasets.py index 2a67fd0..8eb5c93 100644 --- a/src/opperai/datasets.py +++ b/src/opperai/datasets.py @@ -25,7 +25,7 @@ def create_entry( self, *, dataset_id: str, - input: Any, + input_: Any, output: Any, expected: OptionalNullable[Any] = UNSET, comment: OptionalNullable[str] = UNSET, @@ -59,7 +59,7 @@ def create_entry( request = models.CreateDatasetEntryDatasetsDatasetIDPostRequest( dataset_id=dataset_id, create_dataset_entry_request=models.CreateDatasetEntryRequest( - input=input, + input=input_, output=output, expected=expected, comment=comment, @@ -161,7 +161,7 @@ async def create_entry_async( self, *, dataset_id: str, - input: Any, + input_: Any, output: Any, expected: OptionalNullable[Any] = UNSET, comment: OptionalNullable[str] = UNSET, @@ -195,7 +195,7 @@ async def create_entry_async( request = models.CreateDatasetEntryDatasetsDatasetIDPostRequest( dataset_id=dataset_id, create_dataset_entry_request=models.CreateDatasetEntryRequest( - input=input, + input=input_, output=output, expected=expected, comment=comment, diff --git a/src/opperai/embeddings.py b/src/opperai/embeddings.py index f1fcc0d..0c27e77 100644 --- a/src/opperai/embeddings.py +++ b/src/opperai/embeddings.py @@ -12,7 +12,7 @@ class Embeddings(BaseSDK): def create( self, *, - input: Union[models.Input, models.InputTypedDict], + input_: Union[models.Input, models.InputTypedDict], model: OptionalNullable[Union[models.TModel, models.TModelTypedDict]] = UNSET, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, @@ -42,7 +42,7 @@ def create( request = models.CreateEmbeddingRequest( model=utils.get_pydantic_model(model, OptionalNullable[models.TModel]), - input=input, + input=input_, ) req = self._build_request( @@ -134,7 +134,7 @@ def create( async def create_async( self, *, - input: Union[models.Input, models.InputTypedDict], + input_: Union[models.Input, models.InputTypedDict], model: OptionalNullable[Union[models.TModel, models.TModelTypedDict]] = UNSET, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, @@ -164,7 +164,7 @@ async def create_async( request = models.CreateEmbeddingRequest( model=utils.get_pydantic_model(model, OptionalNullable[models.TModel]), - input=input, + input=input_, ) req = self._build_request_async( diff --git a/src/opperai/entries.py b/src/opperai/entries.py index 8c63a54..943de1e 100644 --- a/src/opperai/entries.py +++ b/src/opperai/entries.py @@ -14,7 +14,7 @@ def update( *, dataset_id: str, entry_id: str, - input: OptionalNullable[Any] = UNSET, + input_: OptionalNullable[Any] = UNSET, output: OptionalNullable[Any] = UNSET, expected: OptionalNullable[Any] = UNSET, comment: OptionalNullable[str] = UNSET, @@ -50,7 +50,7 @@ def update( dataset_id=dataset_id, entry_id=entry_id, update_dataset_entry_request=models.UpdateDatasetEntryRequest( - input=input, + input=input_, output=output, expected=expected, comment=comment, @@ -153,7 +153,7 @@ async def update_async( *, dataset_id: str, entry_id: str, - input: OptionalNullable[Any] = UNSET, + input_: OptionalNullable[Any] = UNSET, output: OptionalNullable[Any] = UNSET, expected: OptionalNullable[Any] = UNSET, comment: OptionalNullable[str] = UNSET, @@ -189,7 +189,7 @@ async def update_async( dataset_id=dataset_id, entry_id=entry_id, update_dataset_entry_request=models.UpdateDatasetEntryRequest( - input=input, + input=input_, output=output, expected=expected, comment=comment, diff --git a/src/opperai/functions.py b/src/opperai/functions.py index 66ac939..5dc83a3 100644 --- a/src/opperai/functions.py +++ b/src/opperai/functions.py @@ -67,13 +67,6 @@ def create( else: base_url = self._get_url(base_url, url_variables) - # region convert-pydantic-schemas - if input_schema is not UNSET and hasattr(input_schema, 'model_json_schema'): - input_schema = input_schema.model_json_schema() - if output_schema is not UNSET and hasattr(output_schema, 'model_json_schema'): - output_schema = output_schema.model_json_schema() - # endregion convert-pydantic-schemas - request = models.CreateFunctionRequest( name=name, description=description, @@ -222,13 +215,6 @@ async def create_async( else: base_url = self._get_url(base_url, url_variables) - # region convert-pydantic-schemas - if input_schema is not UNSET and hasattr(input_schema, 'model_json_schema'): - input_schema = input_schema.model_json_schema() - if output_schema is not UNSET and hasattr(output_schema, 'model_json_schema'): - output_schema = output_schema.model_json_schema() - # endregion convert-pydantic-schemas - request = models.CreateFunctionRequest( name=name, description=description, @@ -856,13 +842,6 @@ def update( else: base_url = self._get_url(base_url, url_variables) - # region convert-pydantic-schemas - if input_schema is not UNSET and hasattr(input_schema, 'model_json_schema'): - input_schema = input_schema.model_json_schema() - if output_schema is not UNSET and hasattr(output_schema, 'model_json_schema'): - output_schema = output_schema.model_json_schema() - # endregion convert-pydantic-schemas - request = models.UpdateFunctionFunctionsFunctionIDPatchRequest( function_id=function_id, update_function_request=models.UpdateFunctionRequest( @@ -1008,13 +987,6 @@ async def update_async( else: base_url = self._get_url(base_url, url_variables) - # region convert-pydantic-schemas - if input_schema is not UNSET and hasattr(input_schema, 'model_json_schema'): - input_schema = input_schema.model_json_schema() - if output_schema is not UNSET and hasattr(output_schema, 'model_json_schema'): - output_schema = output_schema.model_json_schema() - # endregion convert-pydantic-schemas - request = models.UpdateFunctionFunctionsFunctionIDPatchRequest( function_id=function_id, update_function_request=models.UpdateFunctionRequest( @@ -1817,7 +1789,7 @@ def call( self, *, function_id: str, - input: OptionalNullable[Any] = UNSET, + input_: OptionalNullable[Any] = UNSET, parent_span_id: OptionalNullable[str] = UNSET, examples: OptionalNullable[ Union[List[models.ExampleIn], List[models.ExampleInTypedDict]] @@ -1855,7 +1827,7 @@ def call( request = models.CallFunctionFunctionsFunctionIDCallPostRequest( function_id=function_id, app_api_public_v2_functions_call_function_request=models.AppAPIPublicV2FunctionsCallFunctionRequest( - input=input, + input=input_, parent_span_id=parent_span_id, examples=utils.get_pydantic_model( examples, OptionalNullable[List[models.ExampleIn]] @@ -1959,7 +1931,7 @@ async def call_async( self, *, function_id: str, - input: OptionalNullable[Any] = UNSET, + input_: OptionalNullable[Any] = UNSET, parent_span_id: OptionalNullable[str] = UNSET, examples: OptionalNullable[ Union[List[models.ExampleIn], List[models.ExampleInTypedDict]] @@ -1997,7 +1969,7 @@ async def call_async( request = models.CallFunctionFunctionsFunctionIDCallPostRequest( function_id=function_id, app_api_public_v2_functions_call_function_request=models.AppAPIPublicV2FunctionsCallFunctionRequest( - input=input, + input=input_, parent_span_id=parent_span_id, examples=utils.get_pydantic_model( examples, OptionalNullable[List[models.ExampleIn]] @@ -2101,7 +2073,7 @@ def stream( self, *, function_id: str, - input: OptionalNullable[Any] = UNSET, + input_: OptionalNullable[Any] = UNSET, parent_span_id: OptionalNullable[str] = UNSET, examples: OptionalNullable[ Union[List[models.ExampleIn], List[models.ExampleInTypedDict]] @@ -2153,7 +2125,7 @@ def stream( request = models.StreamFunctionFunctionsFunctionIDCallStreamPostRequest( function_id=function_id, app_api_public_v2_functions_call_function_request=models.AppAPIPublicV2FunctionsCallFunctionRequest( - input=input, + input=input_, parent_span_id=parent_span_id, examples=utils.get_pydantic_model( examples, OptionalNullable[List[models.ExampleIn]] @@ -2269,7 +2241,7 @@ async def stream_async( self, *, function_id: str, - input: OptionalNullable[Any] = UNSET, + input_: OptionalNullable[Any] = UNSET, parent_span_id: OptionalNullable[str] = UNSET, examples: OptionalNullable[ Union[List[models.ExampleIn], List[models.ExampleInTypedDict]] @@ -2321,7 +2293,7 @@ async def stream_async( request = models.StreamFunctionFunctionsFunctionIDCallStreamPostRequest( function_id=function_id, app_api_public_v2_functions_call_function_request=models.AppAPIPublicV2FunctionsCallFunctionRequest( - input=input, + input=input_, parent_span_id=parent_span_id, examples=utils.get_pydantic_model( examples, OptionalNullable[List[models.ExampleIn]] @@ -2438,7 +2410,7 @@ def call_revision( *, function_id: str, revision_id: str, - input: OptionalNullable[Any] = UNSET, + input_: OptionalNullable[Any] = UNSET, parent_span_id: OptionalNullable[str] = UNSET, examples: OptionalNullable[ Union[List[models.ExampleIn], List[models.ExampleInTypedDict]] @@ -2478,7 +2450,7 @@ def call_revision( function_id=function_id, revision_id=revision_id, app_api_public_v2_functions_call_function_request=models.AppAPIPublicV2FunctionsCallFunctionRequest( - input=input, + input=input_, parent_span_id=parent_span_id, examples=utils.get_pydantic_model( examples, OptionalNullable[List[models.ExampleIn]] @@ -2583,7 +2555,7 @@ async def call_revision_async( *, function_id: str, revision_id: str, - input: OptionalNullable[Any] = UNSET, + input_: OptionalNullable[Any] = UNSET, parent_span_id: OptionalNullable[str] = UNSET, examples: OptionalNullable[ Union[List[models.ExampleIn], List[models.ExampleInTypedDict]] @@ -2623,7 +2595,7 @@ async def call_revision_async( function_id=function_id, revision_id=revision_id, app_api_public_v2_functions_call_function_request=models.AppAPIPublicV2FunctionsCallFunctionRequest( - input=input, + input=input_, parent_span_id=parent_span_id, examples=utils.get_pydantic_model( examples, OptionalNullable[List[models.ExampleIn]] @@ -2728,7 +2700,7 @@ def stream_revision( *, function_id: str, revision_id: str, - input: OptionalNullable[Any] = UNSET, + input_: OptionalNullable[Any] = UNSET, parent_span_id: OptionalNullable[str] = UNSET, examples: OptionalNullable[ Union[List[models.ExampleIn], List[models.ExampleInTypedDict]] @@ -2784,7 +2756,7 @@ def stream_revision( function_id=function_id, revision_id=revision_id, app_api_public_v2_functions_call_function_request=models.AppAPIPublicV2FunctionsCallFunctionRequest( - input=input, + input=input_, parent_span_id=parent_span_id, examples=utils.get_pydantic_model( examples, OptionalNullable[List[models.ExampleIn]] @@ -2901,7 +2873,7 @@ async def stream_revision_async( *, function_id: str, revision_id: str, - input: OptionalNullable[Any] = UNSET, + input_: OptionalNullable[Any] = UNSET, parent_span_id: OptionalNullable[str] = UNSET, examples: OptionalNullable[ Union[List[models.ExampleIn], List[models.ExampleInTypedDict]] @@ -2957,7 +2929,7 @@ async def stream_revision_async( function_id=function_id, revision_id=revision_id, app_api_public_v2_functions_call_function_request=models.AppAPIPublicV2FunctionsCallFunctionRequest( - input=input, + input=input_, parent_span_id=parent_span_id, examples=utils.get_pydantic_model( examples, OptionalNullable[List[models.ExampleIn]] diff --git a/src/opperai/knowledge.py b/src/opperai/knowledge.py index bc6b0a6..752309a 100644 --- a/src/opperai/knowledge.py +++ b/src/opperai/knowledge.py @@ -9,7 +9,7 @@ class Knowledge(BaseSDK): - def create( + def creat( self, *, name: str, @@ -132,7 +132,7 @@ def create( http_res, ) - async def create_async( + async def creat_async( self, *, name: str, @@ -2273,7 +2273,7 @@ async def query_async( http_res, ) - def add_knowledge_knowledge_base_id_add_post( + def add( self, *, knowledge_base_id: str, @@ -2412,7 +2412,7 @@ def add_knowledge_knowledge_base_id_add_post( http_res, ) - async def add_knowledge_knowledge_base_id_add_post_async( + async def add_async( self, *, knowledge_base_id: str, diff --git a/src/opperai/sdk.py b/src/opperai/sdk.py index 8da6a0d..03bcd03 100644 --- a/src/opperai/sdk.py +++ b/src/opperai/sdk.py @@ -205,7 +205,7 @@ def call( instructions: OptionalNullable[str] = UNSET, input_schema: OptionalNullable[Dict[str, Any]] = UNSET, output_schema: OptionalNullable[Dict[str, Any]] = UNSET, - input: OptionalNullable[Any] = UNSET, + input_: OptionalNullable[Any] = UNSET, model: Optional[Union[models.TModel, models.TModelTypedDict]] = None, examples: OptionalNullable[ Union[List[models.Example], List[models.ExampleTypedDict]] @@ -253,19 +253,12 @@ def call( else: base_url = self._get_url(base_url, url_variables) - # region convert-pydantic-schemas - if input_schema is not UNSET and hasattr(input_schema, 'model_json_schema'): - input_schema = input_schema.model_json_schema() - if output_schema is not UNSET and hasattr(output_schema, 'model_json_schema'): - output_schema = output_schema.model_json_schema() - # endregion convert-pydantic-schemas - request = models.AppAPIPublicV2FunctionCallCallFunctionRequest( name=name, instructions=instructions, input_schema=input_schema, output_schema=output_schema, - input=input, + input=input_, model=utils.get_pydantic_model(model, Optional[models.TModel]), examples=utils.get_pydantic_model( examples, OptionalNullable[List[models.Example]] @@ -375,7 +368,7 @@ async def call_async( instructions: OptionalNullable[str] = UNSET, input_schema: OptionalNullable[Dict[str, Any]] = UNSET, output_schema: OptionalNullable[Dict[str, Any]] = UNSET, - input: OptionalNullable[Any] = UNSET, + input_: OptionalNullable[Any] = UNSET, model: Optional[Union[models.TModel, models.TModelTypedDict]] = None, examples: OptionalNullable[ Union[List[models.Example], List[models.ExampleTypedDict]] @@ -423,19 +416,12 @@ async def call_async( else: base_url = self._get_url(base_url, url_variables) - # region convert-pydantic-schemas - if input_schema is not UNSET and hasattr(input_schema, 'model_json_schema'): - input_schema = input_schema.model_json_schema() - if output_schema is not UNSET and hasattr(output_schema, 'model_json_schema'): - output_schema = output_schema.model_json_schema() - # endregion convert-pydantic-schemas - request = models.AppAPIPublicV2FunctionCallCallFunctionRequest( name=name, instructions=instructions, input_schema=input_schema, output_schema=output_schema, - input=input, + input=input_, model=utils.get_pydantic_model(model, Optional[models.TModel]), examples=utils.get_pydantic_model( examples, OptionalNullable[List[models.Example]] @@ -545,7 +531,7 @@ def stream( instructions: OptionalNullable[str] = UNSET, input_schema: OptionalNullable[Dict[str, Any]] = UNSET, output_schema: OptionalNullable[Dict[str, Any]] = UNSET, - input: OptionalNullable[Any] = UNSET, + input_: OptionalNullable[Any] = UNSET, model: Optional[Union[models.TModel, models.TModelTypedDict]] = None, examples: OptionalNullable[ Union[List[models.Example], List[models.ExampleTypedDict]] @@ -609,19 +595,12 @@ def stream( else: base_url = self._get_url(base_url, url_variables) - # region convert-pydantic-schemas - if input_schema is not UNSET and hasattr(input_schema, 'model_json_schema'): - input_schema = input_schema.model_json_schema() - if output_schema is not UNSET and hasattr(output_schema, 'model_json_schema'): - output_schema = output_schema.model_json_schema() - # endregion convert-pydantic-schemas - request = models.AppAPIPublicV2FunctionCallCallFunctionRequest( name=name, instructions=instructions, input_schema=input_schema, output_schema=output_schema, - input=input, + input=input_, model=utils.get_pydantic_model(model, Optional[models.TModel]), examples=utils.get_pydantic_model( examples, OptionalNullable[List[models.Example]] @@ -742,7 +721,7 @@ async def stream_async( instructions: OptionalNullable[str] = UNSET, input_schema: OptionalNullable[Dict[str, Any]] = UNSET, output_schema: OptionalNullable[Dict[str, Any]] = UNSET, - input: OptionalNullable[Any] = UNSET, + input_: OptionalNullable[Any] = UNSET, model: Optional[Union[models.TModel, models.TModelTypedDict]] = None, examples: OptionalNullable[ Union[List[models.Example], List[models.ExampleTypedDict]] @@ -806,19 +785,12 @@ async def stream_async( else: base_url = self._get_url(base_url, url_variables) - # region convert-pydantic-schemas - if input_schema is not UNSET and hasattr(input_schema, 'model_json_schema'): - input_schema = input_schema.model_json_schema() - if output_schema is not UNSET and hasattr(output_schema, 'model_json_schema'): - output_schema = output_schema.model_json_schema() - # endregion convert-pydantic-schemas - request = models.AppAPIPublicV2FunctionCallCallFunctionRequest( name=name, instructions=instructions, input_schema=input_schema, output_schema=output_schema, - input=input, + input=input_, model=utils.get_pydantic_model(model, Optional[models.TModel]), examples=utils.get_pydantic_model( examples, OptionalNullable[List[models.Example]] diff --git a/src/opperai/spans.py b/src/opperai/spans.py index 30c3fc6..2f6335e 100644 --- a/src/opperai/spans.py +++ b/src/opperai/spans.py @@ -18,9 +18,9 @@ def create( id: OptionalNullable[str] = UNSET, trace_id: OptionalNullable[str] = UNSET, parent_id: OptionalNullable[str] = UNSET, - type: OptionalNullable[str] = UNSET, + type_: OptionalNullable[str] = UNSET, end_time: OptionalNullable[datetime] = UNSET, - input: OptionalNullable[Any] = UNSET, + input_: OptionalNullable[Any] = UNSET, output: OptionalNullable[Any] = UNSET, error: OptionalNullable[str] = UNSET, meta: OptionalNullable[Dict[str, Any]] = UNSET, @@ -67,9 +67,9 @@ def create( id=id, trace_id=trace_id, parent_id=parent_id, - type=type, + type=type_, end_time=end_time, - input=input, + input=input_, output=output, error=error, meta=meta, @@ -169,9 +169,9 @@ async def create_async( id: OptionalNullable[str] = UNSET, trace_id: OptionalNullable[str] = UNSET, parent_id: OptionalNullable[str] = UNSET, - type: OptionalNullable[str] = UNSET, + type_: OptionalNullable[str] = UNSET, end_time: OptionalNullable[datetime] = UNSET, - input: OptionalNullable[Any] = UNSET, + input_: OptionalNullable[Any] = UNSET, output: OptionalNullable[Any] = UNSET, error: OptionalNullable[str] = UNSET, meta: OptionalNullable[Dict[str, Any]] = UNSET, @@ -218,9 +218,9 @@ async def create_async( id=id, trace_id=trace_id, parent_id=parent_id, - type=type, + type=type_, end_time=end_time, - input=input, + input=input_, output=output, error=error, meta=meta, @@ -548,9 +548,9 @@ def update( span_id: str, name: OptionalNullable[str] = UNSET, start_time: OptionalNullable[datetime] = UNSET, - type: OptionalNullable[str] = UNSET, + type_: OptionalNullable[str] = UNSET, end_time: OptionalNullable[datetime] = UNSET, - input: OptionalNullable[str] = UNSET, + input_: OptionalNullable[str] = UNSET, output: OptionalNullable[str] = UNSET, error: OptionalNullable[str] = UNSET, meta: OptionalNullable[Dict[str, Any]] = UNSET, @@ -594,9 +594,9 @@ def update( update_span_request=models.UpdateSpanRequest( name=name, start_time=start_time, - type=type, + type=type_, end_time=end_time, - input=input, + input=input_, output=output, error=error, meta=meta, @@ -699,9 +699,9 @@ async def update_async( span_id: str, name: OptionalNullable[str] = UNSET, start_time: OptionalNullable[datetime] = UNSET, - type: OptionalNullable[str] = UNSET, + type_: OptionalNullable[str] = UNSET, end_time: OptionalNullable[datetime] = UNSET, - input: OptionalNullable[str] = UNSET, + input_: OptionalNullable[str] = UNSET, output: OptionalNullable[str] = UNSET, error: OptionalNullable[str] = UNSET, meta: OptionalNullable[Dict[str, Any]] = UNSET, @@ -745,9 +745,9 @@ async def update_async( update_span_request=models.UpdateSpanRequest( name=name, start_time=start_time, - type=type, + type=type_, end_time=end_time, - input=input, + input=input_, output=output, error=error, meta=meta,