-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
System Info
Llama Stack 0.4.2
Python Llama Stack Client SDK 0.4.2
Information
- The official example scripts
- My own modified scripts
🐛 Describe the bug
The conversation.items response is always empty/null/set to whatever it was when the object was created. It does not update in the data store (openai_conversations table, sqlite in this case), and the API (e.g. /v1/conversations/:id:) returns the conversation with no items, even as the Responses API is consumed with a conversation ID provided.
Sample script:
#!/usr/bin/env python3
import os
import logging
import sys
from llama_stack_client import LlamaStackClient
from llama_stack_client.types.response_object import ResponseObject
# Not relevant for this poc script, just configurables for the script.
_APP_ENV_PREFIX = "LLS_DEMO"
APP_LLS_BASE_URL = os.getenv(f"{_APP_ENV_PREFIX}_LLS_BASE_URL", "http://localhost:8321")
APP_AGENT_MODEL = os.getenv(f"{_APP_ENV_PREFIX}_AGENT_MODEL", "ollama/llama3.2:3b")
APP_PROMPT = os.getenv(f"{_APP_ENV_PREFIX}_PROMPT", "What's your favorite food.")
logging.basicConfig(filename=sys.stderr, level=logging.INFO)
logger = logging.getLogger()
client = LlamaStackClient(base_url=APP_LLS_BASE_URL)
# create the conversation manually
convo = client.conversations.create()
logger.info(f"conversation id: {convo.id}")
response: ResponseObject = client.responses.create(
conversation=convo.id, # generate a response in this conversation
instructions="You are a helpful assistant",
model=APP_AGENT_MODEL,
input=APP_PROMPT,
store=True,
)
retrieved_convo = client.conversations.retrieve(conversation_id=convo.id)
logger.info(f"retrieved convo id: {retrieved_convo.id}")
logger.info(f"retrieved convo items: {retrieved_convo.items}") # always empty!
# This workaround allows me to pull the conversation items from the conversation.
conversation_items = client.conversations.items.list(conversation_id=convo.id)
print(len(conversation_items.data))I can retrieve the items in the conversation by hitting the /v1/conversations/:id:/items endpoint without issue. It's unclear if the OpenAI Conversation entry is supposed to be updated, however, which is what this issue focuses on.
Error logs
N/A
Expected behavior
I would expect that the API should return the items in the conversation when requesting the conversation, but this is only because there's an "items" key in the object itself.