diff --git a/README.md b/README.md index 7af5d60..949bfad 100644 --- a/README.md +++ b/README.md @@ -2,3 +2,4 @@ See our [API docs](https://api-docs.gradient-labs.ai); chat to us for the password. + diff --git a/examples/conversations/run.py b/examples/conversations/run.py index 548e601..1d11875 100644 --- a/examples/conversations/run.py +++ b/examples/conversations/run.py @@ -79,15 +79,8 @@ ) logging.info("✅ Human agent message added") -client.add_resource( - conversation_id=conv.id, - name="account-details", - data={ - "sort_code": "123456", - "account_type": "personal", - }, -) -logging.info("✅ Resource added") +# Note: Resources should be passed during start_conversation or resume_conversation +# via the resources parameter, not added separately afterwards. client.end_conversation(conversation_id=conv.id) logging.info(f"✅ Conversation closed: {conv.id}") diff --git a/src/gradient_labs/_conversation_add_resource.py b/src/gradient_labs/_conversation_add_resource.py deleted file mode 100644 index daa5b89..0000000 --- a/src/gradient_labs/_conversation_add_resource.py +++ /dev/null @@ -1,31 +0,0 @@ -from typing import Any -from ._http_client import HttpClient - - -def add_resource( - *, client: HttpClient, conversation_id: str, name: str, resource: Any -) -> None: - """ - AddResource adds (or updates) a resource to the conversation (e.g. the - customer's order details) so the AI agent can handle customer-specific - queries. - - A resource can be any JSON document, as long it is smaller than 1MB. There - are no strict requirements on the format/structure of the document, but we - recommend making attribute names as descriptive as possible. - - Over time, the AI agent will learn the structure of your resources - so while - it's fine to add new attributes, you may want to consider using new resource - names when removing attributes or changing the structure of your resources - significantly. - - Resource names are case-insensitive and can be anything consisting of letters, - numbers, or any of the following characters: _ - + =. - - Names should be descriptive handles that are the same for all conversations - (e.g. "order-details" and "user-profile") not unique identifiers. - """ - _ = client.put( - path=f"conversations/{conversation_id}/resources/{name}", - body=resource, - ) diff --git a/src/gradient_labs/client.py b/src/gradient_labs/client.py index 80adc2e..7360811 100644 --- a/src/gradient_labs/client.py +++ b/src/gradient_labs/client.py @@ -7,7 +7,6 @@ from .conversation import Conversation from ._conversation_add_message import add_message, AddMessageParams, Message -from ._conversation_add_resource import add_resource from ._conversation_assign import assign_conversation, AssignmentParams from ._conversation_cancel import cancel_conversation, CancelParams from ._conversation_event import add_conversation_event, EventParams @@ -209,37 +208,6 @@ def add_message( params=params, ) - def add_resource( - self, - *, - conversation_id: str, - name: str, - data: Any, - ) -> None: - """add_resource adds (or updates) a resource to the conversation (e.g. the - customer's order details) so the AI agent can handle customer-specific queries. - - A resource can be any JSON document, as long it is smaller than 1MB. There - are no strict requirements on the format/structure of the document, but we - recommend making attribute names as descriptive as possible. - - Over time, the AI agent will learn the structure of your resources - so while - it's fine to add new attributes, you may want to consider using new resource - names when removing attributes or changing the structure of your resources - significantly. - - Resource names are case-insensitive and can be anything consisting of letters, - numbers, or any of the following characters: _ - + =. - - Names should be descriptive handles that are the same for all conversations - (e.g. "order-details" and "user-profile") not unique identifiers.""" - add_resource( - client=self.http_client, - conversation_id=conversation_id, - name=name, - resource=data, - ) - def upsert_hand_off_target(self, *, params: UpsertHandOffTargetParams) -> None: """upsert_hand_off_target inserts or updates a hand-off target. diff --git a/uv.lock b/uv.lock index f31b7d4..0fddedd 100644 --- a/uv.lock +++ b/uv.lock @@ -111,7 +111,7 @@ wheels = [ [[package]] name = "gradient-labs" -version = "0.11.6" +version = "0.11.8" source = { editable = "." } dependencies = [ { name = "dataclasses-json" },