From 8885cea8d7b3412334a23298ca1a3a836bfc6421 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 22 Oct 2025 12:32:48 -0700 Subject: [PATCH] fix(conversations)!: update Conversations API definitions (was: bump openai from 1.107.0 to 2.5.0) (#3847) Bumps [openai](https://github.com/openai/openai-python) from 1.107.0 to 2.5.0.
Release notes

Sourced from openai's releases.

v2.5.0

2.5.0 (2025-10-17)

Full Changelog: v2.4.0...v2.5.0

Features

Chores

v2.4.0

2.4.0 (2025-10-16)

Full Changelog: v2.3.0...v2.4.0

Features

Chores

v2.3.0

2.3.0 (2025-10-10)

Full Changelog: v2.2.0...v2.3.0

Features

Chores

v2.2.0

2.2.0 (2025-10-06)

Full Changelog: v2.1.0...v2.2.0

Features

... (truncated)

Changelog

Sourced from openai's changelog.

2.5.0 (2025-10-17)

Full Changelog: v2.4.0...v2.5.0

Features

Chores

2.4.0 (2025-10-16)

Full Changelog: v2.3.0...v2.4.0

Features

Chores

2.3.0 (2025-10-10)

Full Changelog: v2.2.0...v2.3.0

Features

Chores

2.2.0 (2025-10-06)

Full Changelog: v2.1.0...v2.2.0

Features

Bug Fixes

... (truncated)

Commits

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=openai&package-manager=uv&previous-version=1.107.0&new-version=2.5.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
--------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] Co-authored-by: Ashwin Bharambe --- client-sdks/stainless/openapi.yml | 156 ++++-------------- docs/static/llama-stack-spec.html | 83 +++------- docs/static/llama-stack-spec.yaml | 148 +++-------------- docs/static/stainless-llama-stack-spec.html | 83 +++------- docs/static/stainless-llama-stack-spec.yaml | 148 +++-------------- .../apis/conversations/conversations.py | 28 +++- .../core/conversations/conversations.py | 19 ++- .../responses/openai_responses.py | 2 +- .../unit/conversations/test_conversations.py | 4 +- .../test_openai_responses_conversations.py | 6 +- uv.lock | 6 +- 11 files changed, 169 insertions(+), 514 deletions(-) diff --git a/client-sdks/stainless/openapi.yml b/client-sdks/stainless/openapi.yml index 93049a14a..bd22f2129 100644 --- a/client-sdks/stainless/openapi.yml +++ b/client-sdks/stainless/openapi.yml @@ -350,146 +350,46 @@ paths: in: query description: >- An item ID to list items after, used in pagination. - required: true + required: false schema: - oneOf: - - type: string - - type: object - title: NotGiven - description: >- - A sentinel singleton class used to distinguish omitted keyword arguments - from those passed in with the value None (which may have different - behavior). - - For example: - - - ```py - - def get(timeout: Union[int, NotGiven, None] = NotGiven()) -> Response: - ... - - - - get(timeout=1) # 1s timeout - - get(timeout=None) # No timeout - - get() # Default timeout behavior, which may not be statically known - at the method definition. - - ``` + type: string - name: include in: query description: >- Specify additional output data to include in the response. - required: true + required: false schema: - oneOf: - - type: array - items: - type: string - enum: - - code_interpreter_call.outputs - - computer_call_output.output.image_url - - file_search_call.results - - message.input_image.image_url - - message.output_text.logprobs - - reasoning.encrypted_content - - type: object - title: NotGiven - description: >- - A sentinel singleton class used to distinguish omitted keyword arguments - from those passed in with the value None (which may have different - behavior). - - For example: - - - ```py - - def get(timeout: Union[int, NotGiven, None] = NotGiven()) -> Response: - ... - - - - get(timeout=1) # 1s timeout - - get(timeout=None) # No timeout - - get() # Default timeout behavior, which may not be statically known - at the method definition. - - ``` + type: array + items: + type: string + enum: + - web_search_call.action.sources + - code_interpreter_call.outputs + - computer_call_output.output.image_url + - file_search_call.results + - message.input_image.image_url + - message.output_text.logprobs + - reasoning.encrypted_content + title: ConversationItemInclude + description: >- + Specify additional output data to include in the model response. - name: limit in: query description: >- A limit on the number of objects to be returned (1-100, default 20). - required: true + required: false schema: - oneOf: - - type: integer - - type: object - title: NotGiven - description: >- - A sentinel singleton class used to distinguish omitted keyword arguments - from those passed in with the value None (which may have different - behavior). - - For example: - - - ```py - - def get(timeout: Union[int, NotGiven, None] = NotGiven()) -> Response: - ... - - - - get(timeout=1) # 1s timeout - - get(timeout=None) # No timeout - - get() # Default timeout behavior, which may not be statically known - at the method definition. - - ``` + type: integer - name: order in: query description: >- The order to return items in (asc or desc, default desc). - required: true + required: false schema: - oneOf: - - type: string - enum: - - asc - - desc - - type: object - title: NotGiven - description: >- - A sentinel singleton class used to distinguish omitted keyword arguments - from those passed in with the value None (which may have different - behavior). - - For example: - - - ```py - - def get(timeout: Union[int, NotGiven, None] = NotGiven()) -> Response: - ... - - - - get(timeout=1) # 1s timeout - - get(timeout=None) # No timeout - - get() # Default timeout behavior, which may not be statically known - at the method definition. - - ``` + type: string + enum: + - asc + - desc deprecated: false post: responses: @@ -6482,6 +6382,7 @@ components: enum: - llm - embedding + - rerank title: ModelType description: >- Enumeration of supported model types in Llama Stack. @@ -13585,13 +13486,16 @@ tags: embeddings. - This API provides the raw interface to the underlying models. Two kinds of models - are supported: + This API provides the raw interface to the underlying models. Three kinds of + models are supported: - LLM models: these models generate "raw" and "chat" (conversational) completions. - Embedding models: these models generate embeddings to be used for semantic search. + + - Rerank models: these models reorder the documents based on their relevance + to a query. x-displayName: Inference - name: Inspect description: >- diff --git a/docs/static/llama-stack-spec.html b/docs/static/llama-stack-spec.html index 584127d91..384770954 100644 --- a/docs/static/llama-stack-spec.html +++ b/docs/static/llama-stack-spec.html @@ -483,86 +483,53 @@ "name": "after", "in": "query", "description": "An item ID to list items after, used in pagination.", - "required": true, + "required": false, "schema": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "object", - "title": "NotGiven", - "description": "A sentinel singleton class used to distinguish omitted keyword arguments from those passed in with the value None (which may have different behavior).\nFor example:\n\n```py\ndef get(timeout: Union[int, NotGiven, None] = NotGiven()) -> Response: ...\n\n\nget(timeout=1) # 1s timeout\nget(timeout=None) # No timeout\nget() # Default timeout behavior, which may not be statically known at the method definition.\n```" - } - ] + "type": "string" } }, { "name": "include", "in": "query", "description": "Specify additional output data to include in the response.", - "required": true, + "required": false, "schema": { - "oneOf": [ - { - "type": "array", - "items": { - "type": "string", - "enum": [ - "code_interpreter_call.outputs", - "computer_call_output.output.image_url", - "file_search_call.results", - "message.input_image.image_url", - "message.output_text.logprobs", - "reasoning.encrypted_content" - ] - } - }, - { - "type": "object", - "title": "NotGiven", - "description": "A sentinel singleton class used to distinguish omitted keyword arguments from those passed in with the value None (which may have different behavior).\nFor example:\n\n```py\ndef get(timeout: Union[int, NotGiven, None] = NotGiven()) -> Response: ...\n\n\nget(timeout=1) # 1s timeout\nget(timeout=None) # No timeout\nget() # Default timeout behavior, which may not be statically known at the method definition.\n```" - } - ] + "type": "array", + "items": { + "type": "string", + "enum": [ + "web_search_call.action.sources", + "code_interpreter_call.outputs", + "computer_call_output.output.image_url", + "file_search_call.results", + "message.input_image.image_url", + "message.output_text.logprobs", + "reasoning.encrypted_content" + ], + "title": "ConversationItemInclude", + "description": "Specify additional output data to include in the model response." + } } }, { "name": "limit", "in": "query", "description": "A limit on the number of objects to be returned (1-100, default 20).", - "required": true, + "required": false, "schema": { - "oneOf": [ - { - "type": "integer" - }, - { - "type": "object", - "title": "NotGiven", - "description": "A sentinel singleton class used to distinguish omitted keyword arguments from those passed in with the value None (which may have different behavior).\nFor example:\n\n```py\ndef get(timeout: Union[int, NotGiven, None] = NotGiven()) -> Response: ...\n\n\nget(timeout=1) # 1s timeout\nget(timeout=None) # No timeout\nget() # Default timeout behavior, which may not be statically known at the method definition.\n```" - } - ] + "type": "integer" } }, { "name": "order", "in": "query", "description": "The order to return items in (asc or desc, default desc).", - "required": true, + "required": false, "schema": { - "oneOf": [ - { - "type": "string", - "enum": [ - "asc", - "desc" - ] - }, - { - "type": "object", - "title": "NotGiven", - "description": "A sentinel singleton class used to distinguish omitted keyword arguments from those passed in with the value None (which may have different behavior).\nFor example:\n\n```py\ndef get(timeout: Union[int, NotGiven, None] = NotGiven()) -> Response: ...\n\n\nget(timeout=1) # 1s timeout\nget(timeout=None) # No timeout\nget() # Default timeout behavior, which may not be statically known at the method definition.\n```" - } + "type": "string", + "enum": [ + "asc", + "desc" ] } } diff --git a/docs/static/llama-stack-spec.yaml b/docs/static/llama-stack-spec.yaml index 90b1b3a2e..36b9c7153 100644 --- a/docs/static/llama-stack-spec.yaml +++ b/docs/static/llama-stack-spec.yaml @@ -347,146 +347,46 @@ paths: in: query description: >- An item ID to list items after, used in pagination. - required: true + required: false schema: - oneOf: - - type: string - - type: object - title: NotGiven - description: >- - A sentinel singleton class used to distinguish omitted keyword arguments - from those passed in with the value None (which may have different - behavior). - - For example: - - - ```py - - def get(timeout: Union[int, NotGiven, None] = NotGiven()) -> Response: - ... - - - - get(timeout=1) # 1s timeout - - get(timeout=None) # No timeout - - get() # Default timeout behavior, which may not be statically known - at the method definition. - - ``` + type: string - name: include in: query description: >- Specify additional output data to include in the response. - required: true + required: false schema: - oneOf: - - type: array - items: - type: string - enum: - - code_interpreter_call.outputs - - computer_call_output.output.image_url - - file_search_call.results - - message.input_image.image_url - - message.output_text.logprobs - - reasoning.encrypted_content - - type: object - title: NotGiven - description: >- - A sentinel singleton class used to distinguish omitted keyword arguments - from those passed in with the value None (which may have different - behavior). - - For example: - - - ```py - - def get(timeout: Union[int, NotGiven, None] = NotGiven()) -> Response: - ... - - - - get(timeout=1) # 1s timeout - - get(timeout=None) # No timeout - - get() # Default timeout behavior, which may not be statically known - at the method definition. - - ``` + type: array + items: + type: string + enum: + - web_search_call.action.sources + - code_interpreter_call.outputs + - computer_call_output.output.image_url + - file_search_call.results + - message.input_image.image_url + - message.output_text.logprobs + - reasoning.encrypted_content + title: ConversationItemInclude + description: >- + Specify additional output data to include in the model response. - name: limit in: query description: >- A limit on the number of objects to be returned (1-100, default 20). - required: true + required: false schema: - oneOf: - - type: integer - - type: object - title: NotGiven - description: >- - A sentinel singleton class used to distinguish omitted keyword arguments - from those passed in with the value None (which may have different - behavior). - - For example: - - - ```py - - def get(timeout: Union[int, NotGiven, None] = NotGiven()) -> Response: - ... - - - - get(timeout=1) # 1s timeout - - get(timeout=None) # No timeout - - get() # Default timeout behavior, which may not be statically known - at the method definition. - - ``` + type: integer - name: order in: query description: >- The order to return items in (asc or desc, default desc). - required: true + required: false schema: - oneOf: - - type: string - enum: - - asc - - desc - - type: object - title: NotGiven - description: >- - A sentinel singleton class used to distinguish omitted keyword arguments - from those passed in with the value None (which may have different - behavior). - - For example: - - - ```py - - def get(timeout: Union[int, NotGiven, None] = NotGiven()) -> Response: - ... - - - - get(timeout=1) # 1s timeout - - get(timeout=None) # No timeout - - get() # Default timeout behavior, which may not be statically known - at the method definition. - - ``` + type: string + enum: + - asc + - desc deprecated: false post: responses: diff --git a/docs/static/stainless-llama-stack-spec.html b/docs/static/stainless-llama-stack-spec.html index f2d99a9c7..77a64ced0 100644 --- a/docs/static/stainless-llama-stack-spec.html +++ b/docs/static/stainless-llama-stack-spec.html @@ -483,86 +483,53 @@ "name": "after", "in": "query", "description": "An item ID to list items after, used in pagination.", - "required": true, + "required": false, "schema": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "object", - "title": "NotGiven", - "description": "A sentinel singleton class used to distinguish omitted keyword arguments from those passed in with the value None (which may have different behavior).\nFor example:\n\n```py\ndef get(timeout: Union[int, NotGiven, None] = NotGiven()) -> Response: ...\n\n\nget(timeout=1) # 1s timeout\nget(timeout=None) # No timeout\nget() # Default timeout behavior, which may not be statically known at the method definition.\n```" - } - ] + "type": "string" } }, { "name": "include", "in": "query", "description": "Specify additional output data to include in the response.", - "required": true, + "required": false, "schema": { - "oneOf": [ - { - "type": "array", - "items": { - "type": "string", - "enum": [ - "code_interpreter_call.outputs", - "computer_call_output.output.image_url", - "file_search_call.results", - "message.input_image.image_url", - "message.output_text.logprobs", - "reasoning.encrypted_content" - ] - } - }, - { - "type": "object", - "title": "NotGiven", - "description": "A sentinel singleton class used to distinguish omitted keyword arguments from those passed in with the value None (which may have different behavior).\nFor example:\n\n```py\ndef get(timeout: Union[int, NotGiven, None] = NotGiven()) -> Response: ...\n\n\nget(timeout=1) # 1s timeout\nget(timeout=None) # No timeout\nget() # Default timeout behavior, which may not be statically known at the method definition.\n```" - } - ] + "type": "array", + "items": { + "type": "string", + "enum": [ + "web_search_call.action.sources", + "code_interpreter_call.outputs", + "computer_call_output.output.image_url", + "file_search_call.results", + "message.input_image.image_url", + "message.output_text.logprobs", + "reasoning.encrypted_content" + ], + "title": "ConversationItemInclude", + "description": "Specify additional output data to include in the model response." + } } }, { "name": "limit", "in": "query", "description": "A limit on the number of objects to be returned (1-100, default 20).", - "required": true, + "required": false, "schema": { - "oneOf": [ - { - "type": "integer" - }, - { - "type": "object", - "title": "NotGiven", - "description": "A sentinel singleton class used to distinguish omitted keyword arguments from those passed in with the value None (which may have different behavior).\nFor example:\n\n```py\ndef get(timeout: Union[int, NotGiven, None] = NotGiven()) -> Response: ...\n\n\nget(timeout=1) # 1s timeout\nget(timeout=None) # No timeout\nget() # Default timeout behavior, which may not be statically known at the method definition.\n```" - } - ] + "type": "integer" } }, { "name": "order", "in": "query", "description": "The order to return items in (asc or desc, default desc).", - "required": true, + "required": false, "schema": { - "oneOf": [ - { - "type": "string", - "enum": [ - "asc", - "desc" - ] - }, - { - "type": "object", - "title": "NotGiven", - "description": "A sentinel singleton class used to distinguish omitted keyword arguments from those passed in with the value None (which may have different behavior).\nFor example:\n\n```py\ndef get(timeout: Union[int, NotGiven, None] = NotGiven()) -> Response: ...\n\n\nget(timeout=1) # 1s timeout\nget(timeout=None) # No timeout\nget() # Default timeout behavior, which may not be statically known at the method definition.\n```" - } + "type": "string", + "enum": [ + "asc", + "desc" ] } } diff --git a/docs/static/stainless-llama-stack-spec.yaml b/docs/static/stainless-llama-stack-spec.yaml index 9fe6cb6a3..bd22f2129 100644 --- a/docs/static/stainless-llama-stack-spec.yaml +++ b/docs/static/stainless-llama-stack-spec.yaml @@ -350,146 +350,46 @@ paths: in: query description: >- An item ID to list items after, used in pagination. - required: true + required: false schema: - oneOf: - - type: string - - type: object - title: NotGiven - description: >- - A sentinel singleton class used to distinguish omitted keyword arguments - from those passed in with the value None (which may have different - behavior). - - For example: - - - ```py - - def get(timeout: Union[int, NotGiven, None] = NotGiven()) -> Response: - ... - - - - get(timeout=1) # 1s timeout - - get(timeout=None) # No timeout - - get() # Default timeout behavior, which may not be statically known - at the method definition. - - ``` + type: string - name: include in: query description: >- Specify additional output data to include in the response. - required: true + required: false schema: - oneOf: - - type: array - items: - type: string - enum: - - code_interpreter_call.outputs - - computer_call_output.output.image_url - - file_search_call.results - - message.input_image.image_url - - message.output_text.logprobs - - reasoning.encrypted_content - - type: object - title: NotGiven - description: >- - A sentinel singleton class used to distinguish omitted keyword arguments - from those passed in with the value None (which may have different - behavior). - - For example: - - - ```py - - def get(timeout: Union[int, NotGiven, None] = NotGiven()) -> Response: - ... - - - - get(timeout=1) # 1s timeout - - get(timeout=None) # No timeout - - get() # Default timeout behavior, which may not be statically known - at the method definition. - - ``` + type: array + items: + type: string + enum: + - web_search_call.action.sources + - code_interpreter_call.outputs + - computer_call_output.output.image_url + - file_search_call.results + - message.input_image.image_url + - message.output_text.logprobs + - reasoning.encrypted_content + title: ConversationItemInclude + description: >- + Specify additional output data to include in the model response. - name: limit in: query description: >- A limit on the number of objects to be returned (1-100, default 20). - required: true + required: false schema: - oneOf: - - type: integer - - type: object - title: NotGiven - description: >- - A sentinel singleton class used to distinguish omitted keyword arguments - from those passed in with the value None (which may have different - behavior). - - For example: - - - ```py - - def get(timeout: Union[int, NotGiven, None] = NotGiven()) -> Response: - ... - - - - get(timeout=1) # 1s timeout - - get(timeout=None) # No timeout - - get() # Default timeout behavior, which may not be statically known - at the method definition. - - ``` + type: integer - name: order in: query description: >- The order to return items in (asc or desc, default desc). - required: true + required: false schema: - oneOf: - - type: string - enum: - - asc - - desc - - type: object - title: NotGiven - description: >- - A sentinel singleton class used to distinguish omitted keyword arguments - from those passed in with the value None (which may have different - behavior). - - For example: - - - ```py - - def get(timeout: Union[int, NotGiven, None] = NotGiven()) -> Response: - ... - - - - get(timeout=1) # 1s timeout - - get(timeout=None) # No timeout - - get() # Default timeout behavior, which may not be statically known - at the method definition. - - ``` + type: string + enum: + - asc + - desc deprecated: false post: responses: diff --git a/llama_stack/apis/conversations/conversations.py b/llama_stack/apis/conversations/conversations.py index d7752995d..3b6c50a03 100644 --- a/llama_stack/apis/conversations/conversations.py +++ b/llama_stack/apis/conversations/conversations.py @@ -4,11 +4,9 @@ # This source code is licensed under the terms described in the LICENSE file in # the root directory of this source tree. +from enum import StrEnum from typing import Annotated, Literal, Protocol, runtime_checkable -from openai import NOT_GIVEN -from openai._types import NotGiven -from openai.types.responses.response_includable import ResponseIncludable from pydantic import BaseModel, Field from llama_stack.apis.agents.openai_responses import ( @@ -150,6 +148,20 @@ class ConversationItemCreateRequest(BaseModel): ) +class ConversationItemInclude(StrEnum): + """ + Specify additional output data to include in the model response. + """ + + web_search_call_action_sources = "web_search_call.action.sources" + code_interpreter_call_outputs = "code_interpreter_call.outputs" + computer_call_output_output_image_url = "computer_call_output.output.image_url" + file_search_call_results = "file_search_call.results" + message_input_image_image_url = "message.input_image.image_url" + message_output_text_logprobs = "message.output_text.logprobs" + reasoning_encrypted_content = "reasoning.encrypted_content" + + @json_schema_type class ConversationItemList(BaseModel): """List of conversation items with pagination.""" @@ -250,13 +262,13 @@ class Conversations(Protocol): ... @webmethod(route="/conversations/{conversation_id}/items", method="GET", level=LLAMA_STACK_API_V1) - async def list( + async def list_items( self, conversation_id: str, - after: str | NotGiven = NOT_GIVEN, - include: list[ResponseIncludable] | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - order: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, + after: str | None = None, + include: list[ConversationItemInclude] | None = None, + limit: int | None = None, + order: Literal["asc", "desc"] | None = None, ) -> ConversationItemList: """List items. diff --git a/llama_stack/core/conversations/conversations.py b/llama_stack/core/conversations/conversations.py index 66880ca36..83a49e848 100644 --- a/llama_stack/core/conversations/conversations.py +++ b/llama_stack/core/conversations/conversations.py @@ -6,9 +6,8 @@ import secrets import time -from typing import Any +from typing import Any, Literal -from openai import NOT_GIVEN from pydantic import BaseModel, TypeAdapter from llama_stack.apis.conversations.conversations import ( @@ -16,6 +15,7 @@ from llama_stack.apis.conversations.conversations import ( ConversationDeletedResource, ConversationItem, ConversationItemDeletedResource, + ConversationItemInclude, ConversationItemList, Conversations, Metadata, @@ -247,7 +247,14 @@ class ConversationServiceImpl(Conversations): adapter: TypeAdapter[ConversationItem] = TypeAdapter(ConversationItem) return adapter.validate_python(record["item_data"]) - async def list(self, conversation_id: str, after=NOT_GIVEN, include=NOT_GIVEN, limit=NOT_GIVEN, order=NOT_GIVEN): + async def list_items( + self, + conversation_id: str, + after: str | None = None, + include: list[ConversationItemInclude] | None = None, + limit: int | None = None, + order: Literal["asc", "desc"] | None = None, + ) -> ConversationItemList: """List items in the conversation.""" if not conversation_id: raise ValueError(f"Expected a non-empty value for `conversation_id` but received {conversation_id!r}") @@ -258,14 +265,12 @@ class ConversationServiceImpl(Conversations): result = await self.sql_store.fetch_all(table="conversation_items", where={"conversation_id": conversation_id}) records = result.data - if order != NOT_GIVEN and order == "asc": + if order is not None and order == "asc": records.sort(key=lambda x: x["created_at"]) else: records.sort(key=lambda x: x["created_at"], reverse=True) - actual_limit = 20 - if limit != NOT_GIVEN and isinstance(limit, int): - actual_limit = limit + actual_limit = limit or 20 records = records[:actual_limit] items = [record["item_data"] for record in records] diff --git a/llama_stack/providers/inline/agents/meta_reference/responses/openai_responses.py b/llama_stack/providers/inline/agents/meta_reference/responses/openai_responses.py index 2360dafd9..e2508bec1 100644 --- a/llama_stack/providers/inline/agents/meta_reference/responses/openai_responses.py +++ b/llama_stack/providers/inline/agents/meta_reference/responses/openai_responses.py @@ -131,7 +131,7 @@ class OpenAIResponsesImpl: tool_context.recover_tools_from_previous_response(previous_response) elif conversation is not None: - conversation_items = await self.conversations_api.list(conversation, order="asc") + conversation_items = await self.conversations_api.list_items(conversation, order="asc") # Use stored messages as source of truth (like previous_response.messages) stored_messages = await self.responses_store.get_conversation_messages(conversation) diff --git a/tests/unit/conversations/test_conversations.py b/tests/unit/conversations/test_conversations.py index ff6dd243d..3f0175831 100644 --- a/tests/unit/conversations/test_conversations.py +++ b/tests/unit/conversations/test_conversations.py @@ -82,7 +82,7 @@ async def test_conversation_items(service): assert len(item_list.data) == 1 assert item_list.data[0].id == "msg_test123" - items = await service.list(conversation.id) + items = await service.list_items(conversation.id) assert len(items.data) == 1 @@ -120,7 +120,7 @@ async def test_openai_type_compatibility(service): assert hasattr(item_list, attr) assert item_list.object == "list" - items = await service.list(conversation.id) + items = await service.list_items(conversation.id) item = await service.retrieve(conversation.id, items.data[0].id) item_dict = item.model_dump() diff --git a/tests/unit/providers/agents/meta_reference/test_openai_responses_conversations.py b/tests/unit/providers/agents/meta_reference/test_openai_responses_conversations.py index 2ca350862..c2c113c1b 100644 --- a/tests/unit/providers/agents/meta_reference/test_openai_responses_conversations.py +++ b/tests/unit/providers/agents/meta_reference/test_openai_responses_conversations.py @@ -62,7 +62,7 @@ class TestConversationValidation: conv_id = "conv_nonexistent" # Mock conversation not found - mock_conversations_api.list.side_effect = ConversationNotFoundError("conv_nonexistent") + mock_conversations_api.list_items.side_effect = ConversationNotFoundError("conv_nonexistent") with pytest.raises(ConversationNotFoundError): await responses_impl_with_conversations.create_openai_response( @@ -160,7 +160,7 @@ class TestIntegrationWorkflow: self, responses_impl_with_conversations, mock_conversations_api ): """Test creating a response with a valid conversation parameter.""" - mock_conversations_api.list.return_value = ConversationItemList( + mock_conversations_api.list_items.return_value = ConversationItemList( data=[], first_id=None, has_more=False, last_id=None, object="list" ) @@ -227,7 +227,7 @@ class TestIntegrationWorkflow: self, responses_impl_with_conversations, mock_conversations_api ): """Test creating a response with a non-existent conversation.""" - mock_conversations_api.list.side_effect = ConversationNotFoundError("conv_nonexistent") + mock_conversations_api.list_items.side_effect = ConversationNotFoundError("conv_nonexistent") with pytest.raises(ConversationNotFoundError) as exc_info: await responses_impl_with_conversations.create_openai_response( diff --git a/uv.lock b/uv.lock index 82c6a3ae6..aad77f6a1 100644 --- a/uv.lock +++ b/uv.lock @@ -2661,7 +2661,7 @@ wheels = [ [[package]] name = "openai" -version = "1.107.0" +version = "2.5.0" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "anyio" }, @@ -2673,9 +2673,9 @@ dependencies = [ { name = "tqdm" }, { name = "typing-extensions" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/88/67/d6498de300f83ff57a79cb7aa96ef3bef8d6f070c3ded0f1b5b45442a6bc/openai-1.107.0.tar.gz", hash = "sha256:43e04927584e57d0e9e640ee0077c78baf8150098be96ebd5c512539b6c4e9a4", size = 566056, upload-time = "2025-09-08T19:25:47.604Z" } +sdist = { url = "https://files.pythonhosted.org/packages/72/39/aa3767c920c217ef56f27e89cbe3aaa43dd6eea3269c95f045c5761b9df1/openai-2.5.0.tar.gz", hash = "sha256:f8fa7611f96886a0f31ac6b97e58bc0ada494b255ee2cfd51c8eb502cfcb4814", size = 590333, upload-time = "2025-10-17T18:14:47.669Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/91/ed/e8a4fd20390f2858b95227c288df8fe0c835f7c77625f7583609161684ba/openai-1.107.0-py3-none-any.whl", hash = "sha256:3dcfa3cbb116bd6924b27913b8da28c4a787379ff60049588547a1013e6d6438", size = 950968, upload-time = "2025-09-08T19:25:45.552Z" }, + { url = "https://files.pythonhosted.org/packages/14/f3/ebbd700d8dc1e6380a7a382969d96bc0cbea8717b52fb38ff0ca2a7653e8/openai-2.5.0-py3-none-any.whl", hash = "sha256:21380e5f52a71666dbadbf322dd518bdf2b9d11ed0bb3f96bea17310302d6280", size = 999851, upload-time = "2025-10-17T18:14:45.528Z" }, ] [[package]]