mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-10-03 19:57:35 +00:00
renamed create to add items
Signed-off-by: Francisco Javier Arceo <farceo@redhat.com>
This commit is contained in:
parent
0dbc522bcb
commit
d2ce672d4b
7 changed files with 17 additions and 17 deletions
6
docs/static/llama-stack-spec.html
vendored
6
docs/static/llama-stack-spec.html
vendored
|
@ -614,7 +614,7 @@
|
||||||
"content": {
|
"content": {
|
||||||
"application/json": {
|
"application/json": {
|
||||||
"schema": {
|
"schema": {
|
||||||
"$ref": "#/components/schemas/CreateRequest"
|
"$ref": "#/components/schemas/AddItemsRequest"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -6355,7 +6355,7 @@
|
||||||
"title": "ConversationItemList",
|
"title": "ConversationItemList",
|
||||||
"description": "List of conversation items with pagination."
|
"description": "List of conversation items with pagination."
|
||||||
},
|
},
|
||||||
"CreateRequest": {
|
"AddItemsRequest": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"items": {
|
"items": {
|
||||||
|
@ -6370,7 +6370,7 @@
|
||||||
"required": [
|
"required": [
|
||||||
"items"
|
"items"
|
||||||
],
|
],
|
||||||
"title": "CreateRequest"
|
"title": "AddItemsRequest"
|
||||||
},
|
},
|
||||||
"ConversationItemDeletedResource": {
|
"ConversationItemDeletedResource": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
|
|
6
docs/static/llama-stack-spec.yaml
vendored
6
docs/static/llama-stack-spec.yaml
vendored
|
@ -505,7 +505,7 @@ paths:
|
||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/CreateRequest'
|
$ref: '#/components/schemas/AddItemsRequest'
|
||||||
required: true
|
required: true
|
||||||
deprecated: false
|
deprecated: false
|
||||||
/v1/conversations/{conversation_id}/items/{item_id}:
|
/v1/conversations/{conversation_id}/items/{item_id}:
|
||||||
|
@ -4763,7 +4763,7 @@ components:
|
||||||
title: ConversationItemList
|
title: ConversationItemList
|
||||||
description: >-
|
description: >-
|
||||||
List of conversation items with pagination.
|
List of conversation items with pagination.
|
||||||
CreateRequest:
|
AddItemsRequest:
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
items:
|
items:
|
||||||
|
@ -4775,7 +4775,7 @@ components:
|
||||||
additionalProperties: false
|
additionalProperties: false
|
||||||
required:
|
required:
|
||||||
- items
|
- items
|
||||||
title: CreateRequest
|
title: AddItemsRequest
|
||||||
ConversationItemDeletedResource:
|
ConversationItemDeletedResource:
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
|
|
6
docs/static/stainless-llama-stack-spec.html
vendored
6
docs/static/stainless-llama-stack-spec.html
vendored
|
@ -614,7 +614,7 @@
|
||||||
"content": {
|
"content": {
|
||||||
"application/json": {
|
"application/json": {
|
||||||
"schema": {
|
"schema": {
|
||||||
"$ref": "#/components/schemas/CreateRequest"
|
"$ref": "#/components/schemas/AddItemsRequest"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -8364,7 +8364,7 @@
|
||||||
"title": "ConversationItemList",
|
"title": "ConversationItemList",
|
||||||
"description": "List of conversation items with pagination."
|
"description": "List of conversation items with pagination."
|
||||||
},
|
},
|
||||||
"CreateRequest": {
|
"AddItemsRequest": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"items": {
|
"items": {
|
||||||
|
@ -8379,7 +8379,7 @@
|
||||||
"required": [
|
"required": [
|
||||||
"items"
|
"items"
|
||||||
],
|
],
|
||||||
"title": "CreateRequest"
|
"title": "AddItemsRequest"
|
||||||
},
|
},
|
||||||
"ConversationItemDeletedResource": {
|
"ConversationItemDeletedResource": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
|
|
6
docs/static/stainless-llama-stack-spec.yaml
vendored
6
docs/static/stainless-llama-stack-spec.yaml
vendored
|
@ -508,7 +508,7 @@ paths:
|
||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/CreateRequest'
|
$ref: '#/components/schemas/AddItemsRequest'
|
||||||
required: true
|
required: true
|
||||||
deprecated: false
|
deprecated: false
|
||||||
/v1/conversations/{conversation_id}/items/{item_id}:
|
/v1/conversations/{conversation_id}/items/{item_id}:
|
||||||
|
@ -6208,7 +6208,7 @@ components:
|
||||||
title: ConversationItemList
|
title: ConversationItemList
|
||||||
description: >-
|
description: >-
|
||||||
List of conversation items with pagination.
|
List of conversation items with pagination.
|
||||||
CreateRequest:
|
AddItemsRequest:
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
items:
|
items:
|
||||||
|
@ -6220,7 +6220,7 @@ components:
|
||||||
additionalProperties: false
|
additionalProperties: false
|
||||||
required:
|
required:
|
||||||
- items
|
- items
|
||||||
title: CreateRequest
|
title: AddItemsRequest
|
||||||
ConversationItemDeletedResource:
|
ConversationItemDeletedResource:
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
|
|
|
@ -208,7 +208,7 @@ class Conversations(Protocol):
|
||||||
...
|
...
|
||||||
|
|
||||||
@webmethod(route="/conversations/{conversation_id}/items", method="POST", level=LLAMA_STACK_API_V1)
|
@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.
|
"""Create items in the conversation.
|
||||||
|
|
||||||
:param conversation_id: The conversation identifier.
|
:param conversation_id: The conversation identifier.
|
||||||
|
|
|
@ -185,8 +185,8 @@ class ConversationServiceImpl(Conversations):
|
||||||
self._validate_conversation_id(conversation_id)
|
self._validate_conversation_id(conversation_id)
|
||||||
return await self.get_conversation(conversation_id)
|
return await self.get_conversation(conversation_id)
|
||||||
|
|
||||||
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."""
|
"""Create (add) items to a conversation."""
|
||||||
await self._get_validated_conversation(conversation_id)
|
await self._get_validated_conversation(conversation_id)
|
||||||
|
|
||||||
created_items = []
|
created_items = []
|
||||||
|
|
|
@ -59,7 +59,7 @@ async def test_conversation_items(service):
|
||||||
status="completed",
|
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 len(item_list.data) == 1
|
||||||
assert item_list.data[0].id == "msg_test123"
|
assert item_list.data[0].id == "msg_test123"
|
||||||
|
@ -96,7 +96,7 @@ async def test_openai_type_compatibility(service):
|
||||||
status="completed",
|
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"]:
|
for attr in ["object", "data", "first_id", "last_id", "has_more"]:
|
||||||
assert hasattr(item_list, attr)
|
assert hasattr(item_list, attr)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue