diff --git a/docs/static/llama-stack-spec.html b/docs/static/llama-stack-spec.html index 2a591b223..349720f4e 100644 --- a/docs/static/llama-stack-spec.html +++ b/docs/static/llama-stack-spec.html @@ -614,7 +614,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/CreateRequest" + "$ref": "#/components/schemas/AddItemsRequest" } } }, @@ -6355,7 +6355,7 @@ "title": "ConversationItemList", "description": "List of conversation items with pagination." }, - "CreateRequest": { + "AddItemsRequest": { "type": "object", "properties": { "items": { @@ -6370,7 +6370,7 @@ "required": [ "items" ], - "title": "CreateRequest" + "title": "AddItemsRequest" }, "ConversationItemDeletedResource": { "type": "object", diff --git a/docs/static/llama-stack-spec.yaml b/docs/static/llama-stack-spec.yaml index 199f429f6..a2fcb812a 100644 --- a/docs/static/llama-stack-spec.yaml +++ b/docs/static/llama-stack-spec.yaml @@ -505,7 +505,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/CreateRequest' + $ref: '#/components/schemas/AddItemsRequest' required: true deprecated: false /v1/conversations/{conversation_id}/items/{item_id}: @@ -4763,7 +4763,7 @@ components: title: ConversationItemList description: >- List of conversation items with pagination. - CreateRequest: + AddItemsRequest: type: object properties: items: @@ -4775,7 +4775,7 @@ components: additionalProperties: false required: - items - title: CreateRequest + title: AddItemsRequest ConversationItemDeletedResource: type: object properties: diff --git a/docs/static/stainless-llama-stack-spec.html b/docs/static/stainless-llama-stack-spec.html index 7580ace7b..f037f24c3 100644 --- a/docs/static/stainless-llama-stack-spec.html +++ b/docs/static/stainless-llama-stack-spec.html @@ -614,7 +614,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/CreateRequest" + "$ref": "#/components/schemas/AddItemsRequest" } } }, @@ -8364,7 +8364,7 @@ "title": "ConversationItemList", "description": "List of conversation items with pagination." }, - "CreateRequest": { + "AddItemsRequest": { "type": "object", "properties": { "items": { @@ -8379,7 +8379,7 @@ "required": [ "items" ], - "title": "CreateRequest" + "title": "AddItemsRequest" }, "ConversationItemDeletedResource": { "type": "object", diff --git a/docs/static/stainless-llama-stack-spec.yaml b/docs/static/stainless-llama-stack-spec.yaml index 22593cd7c..a3ad45487 100644 --- a/docs/static/stainless-llama-stack-spec.yaml +++ b/docs/static/stainless-llama-stack-spec.yaml @@ -508,7 +508,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/CreateRequest' + $ref: '#/components/schemas/AddItemsRequest' required: true deprecated: false /v1/conversations/{conversation_id}/items/{item_id}: @@ -6208,7 +6208,7 @@ components: title: ConversationItemList description: >- List of conversation items with pagination. - CreateRequest: + AddItemsRequest: type: object properties: items: @@ -6220,7 +6220,7 @@ components: additionalProperties: false required: - items - title: CreateRequest + title: AddItemsRequest ConversationItemDeletedResource: type: object properties: diff --git a/llama_stack/apis/conversations/conversations.py b/llama_stack/apis/conversations/conversations.py index 3fe1a906d..58ae9c35a 100644 --- a/llama_stack/apis/conversations/conversations.py +++ b/llama_stack/apis/conversations/conversations.py @@ -208,7 +208,7 @@ class Conversations(Protocol): ... @webmethod(route="/conversations/{conversation_id}/items", method="POST", level=LLAMA_STACK_API_V1) - async def create(self, conversation_id: str, items: list[ConversationItem]) -> ConversationItemList: + async def add_items(self, conversation_id: str, items: list[ConversationItem]) -> ConversationItemList: """Create items in the conversation. :param conversation_id: The conversation identifier. diff --git a/llama_stack/core/conversations/conversations.py b/llama_stack/core/conversations/conversations.py index a41a60a6e..40173a0be 100644 --- a/llama_stack/core/conversations/conversations.py +++ b/llama_stack/core/conversations/conversations.py @@ -185,8 +185,8 @@ class ConversationServiceImpl(Conversations): self._validate_conversation_id(conversation_id) return await self.get_conversation(conversation_id) - async def create(self, conversation_id: str, items: list[ConversationItem]) -> ConversationItemList: - """Create items in the conversation.""" + async def add_items(self, conversation_id: str, items: list[ConversationItem]) -> ConversationItemList: + """Create (add) items to a conversation.""" await self._get_validated_conversation(conversation_id) created_items = [] diff --git a/tests/unit/conversations/test_conversations.py b/tests/unit/conversations/test_conversations.py index 9ea47947a..65c3e2333 100644 --- a/tests/unit/conversations/test_conversations.py +++ b/tests/unit/conversations/test_conversations.py @@ -59,7 +59,7 @@ async def test_conversation_items(service): status="completed", ) ] - item_list = await service.create(conversation.id, items) + item_list = await service.add_items(conversation.id, items) assert len(item_list.data) == 1 assert item_list.data[0].id == "msg_test123" @@ -96,7 +96,7 @@ async def test_openai_type_compatibility(service): status="completed", ) ] - item_list = await service.create(conversation.id, items) + item_list = await service.add_items(conversation.id, items) for attr in ["object", "data", "first_id", "last_id", "has_more"]: assert hasattr(item_list, attr)