mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-08-15 14:08:00 +00:00
Merge branch 'main' into agent_session_unit_test
This commit is contained in:
commit
48fc88faff
6 changed files with 145 additions and 37 deletions
81
docs/_static/llama-stack-spec.html
vendored
81
docs/_static/llama-stack-spec.html
vendored
|
@ -8293,28 +8293,60 @@
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"items": {
|
"items": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"additionalProperties": {
|
"properties": {
|
||||||
"oneOf": [
|
"attributes": {
|
||||||
{
|
"type": "object",
|
||||||
"type": "null"
|
"additionalProperties": {
|
||||||
|
"oneOf": [
|
||||||
|
{
|
||||||
|
"type": "null"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "number"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "array"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "object"
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
"description": "(Optional) Key-value attributes associated with the file"
|
||||||
"type": "boolean"
|
},
|
||||||
},
|
"file_id": {
|
||||||
{
|
"type": "string",
|
||||||
"type": "number"
|
"description": "Unique identifier of the file containing the result"
|
||||||
},
|
},
|
||||||
{
|
"filename": {
|
||||||
"type": "string"
|
"type": "string",
|
||||||
},
|
"description": "Name of the file containing the result"
|
||||||
{
|
},
|
||||||
"type": "array"
|
"score": {
|
||||||
},
|
"type": "number",
|
||||||
{
|
"description": "Relevance score for this search result (between 0 and 1)"
|
||||||
"type": "object"
|
},
|
||||||
}
|
"text": {
|
||||||
]
|
"type": "string",
|
||||||
}
|
"description": "Text content of the search result"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"required": [
|
||||||
|
"attributes",
|
||||||
|
"file_id",
|
||||||
|
"filename",
|
||||||
|
"score",
|
||||||
|
"text"
|
||||||
|
],
|
||||||
|
"title": "OpenAIResponseOutputMessageFileSearchToolCallResults",
|
||||||
|
"description": "Search results returned by the file search operation."
|
||||||
},
|
},
|
||||||
"description": "(Optional) Search results returned by the file search operation"
|
"description": "(Optional) Search results returned by the file search operation"
|
||||||
}
|
}
|
||||||
|
@ -8515,6 +8547,13 @@
|
||||||
"$ref": "#/components/schemas/OpenAIResponseInputTool"
|
"$ref": "#/components/schemas/OpenAIResponseInputTool"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"include": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"description": "(Optional) Additional fields to include in the response."
|
||||||
|
},
|
||||||
"max_infer_iters": {
|
"max_infer_iters": {
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
}
|
}
|
||||||
|
|
52
docs/_static/llama-stack-spec.yaml
vendored
52
docs/_static/llama-stack-spec.yaml
vendored
|
@ -6021,14 +6021,44 @@ components:
|
||||||
type: array
|
type: array
|
||||||
items:
|
items:
|
||||||
type: object
|
type: object
|
||||||
additionalProperties:
|
properties:
|
||||||
oneOf:
|
attributes:
|
||||||
- type: 'null'
|
type: object
|
||||||
- type: boolean
|
additionalProperties:
|
||||||
- type: number
|
oneOf:
|
||||||
- type: string
|
- type: 'null'
|
||||||
- type: array
|
- type: boolean
|
||||||
- type: object
|
- type: number
|
||||||
|
- type: string
|
||||||
|
- type: array
|
||||||
|
- type: object
|
||||||
|
description: >-
|
||||||
|
(Optional) Key-value attributes associated with the file
|
||||||
|
file_id:
|
||||||
|
type: string
|
||||||
|
description: >-
|
||||||
|
Unique identifier of the file containing the result
|
||||||
|
filename:
|
||||||
|
type: string
|
||||||
|
description: Name of the file containing the result
|
||||||
|
score:
|
||||||
|
type: number
|
||||||
|
description: >-
|
||||||
|
Relevance score for this search result (between 0 and 1)
|
||||||
|
text:
|
||||||
|
type: string
|
||||||
|
description: Text content of the search result
|
||||||
|
additionalProperties: false
|
||||||
|
required:
|
||||||
|
- attributes
|
||||||
|
- file_id
|
||||||
|
- filename
|
||||||
|
- score
|
||||||
|
- text
|
||||||
|
title: >-
|
||||||
|
OpenAIResponseOutputMessageFileSearchToolCallResults
|
||||||
|
description: >-
|
||||||
|
Search results returned by the file search operation.
|
||||||
description: >-
|
description: >-
|
||||||
(Optional) Search results returned by the file search operation
|
(Optional) Search results returned by the file search operation
|
||||||
additionalProperties: false
|
additionalProperties: false
|
||||||
|
@ -6188,6 +6218,12 @@ components:
|
||||||
type: array
|
type: array
|
||||||
items:
|
items:
|
||||||
$ref: '#/components/schemas/OpenAIResponseInputTool'
|
$ref: '#/components/schemas/OpenAIResponseInputTool'
|
||||||
|
include:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
description: >-
|
||||||
|
(Optional) Additional fields to include in the response.
|
||||||
max_infer_iters:
|
max_infer_iters:
|
||||||
type: integer
|
type: integer
|
||||||
additionalProperties: false
|
additionalProperties: false
|
||||||
|
|
|
@ -706,6 +706,7 @@ class Agents(Protocol):
|
||||||
temperature: float | None = None,
|
temperature: float | None = None,
|
||||||
text: OpenAIResponseText | None = None,
|
text: OpenAIResponseText | None = None,
|
||||||
tools: list[OpenAIResponseInputTool] | None = None,
|
tools: list[OpenAIResponseInputTool] | None = None,
|
||||||
|
include: list[str] | None = None,
|
||||||
max_infer_iters: int | None = 10, # this is an extension to the OpenAI API
|
max_infer_iters: int | None = 10, # this is an extension to the OpenAI API
|
||||||
) -> OpenAIResponseObject | AsyncIterator[OpenAIResponseObjectStream]:
|
) -> OpenAIResponseObject | AsyncIterator[OpenAIResponseObjectStream]:
|
||||||
"""Create a new OpenAI response.
|
"""Create a new OpenAI response.
|
||||||
|
@ -713,6 +714,7 @@ class Agents(Protocol):
|
||||||
:param input: Input message(s) to create the response.
|
:param input: Input message(s) to create the response.
|
||||||
:param model: The underlying LLM used for completions.
|
:param model: The underlying LLM used for completions.
|
||||||
:param previous_response_id: (Optional) if specified, the new response will be a continuation of the previous response. This can be used to easily fork-off new responses from existing responses.
|
:param previous_response_id: (Optional) if specified, the new response will be a continuation of the previous response. This can be used to easily fork-off new responses from existing responses.
|
||||||
|
:param include: (Optional) Additional fields to include in the response.
|
||||||
:returns: An OpenAIResponseObject.
|
:returns: An OpenAIResponseObject.
|
||||||
"""
|
"""
|
||||||
...
|
...
|
||||||
|
|
|
@ -170,6 +170,23 @@ class OpenAIResponseOutputMessageWebSearchToolCall(BaseModel):
|
||||||
type: Literal["web_search_call"] = "web_search_call"
|
type: Literal["web_search_call"] = "web_search_call"
|
||||||
|
|
||||||
|
|
||||||
|
class OpenAIResponseOutputMessageFileSearchToolCallResults(BaseModel):
|
||||||
|
"""Search results returned by the file search operation.
|
||||||
|
|
||||||
|
:param attributes: (Optional) Key-value attributes associated with the file
|
||||||
|
:param file_id: Unique identifier of the file containing the result
|
||||||
|
:param filename: Name of the file containing the result
|
||||||
|
:param score: Relevance score for this search result (between 0 and 1)
|
||||||
|
:param text: Text content of the search result
|
||||||
|
"""
|
||||||
|
|
||||||
|
attributes: dict[str, Any]
|
||||||
|
file_id: str
|
||||||
|
filename: str
|
||||||
|
score: float
|
||||||
|
text: str
|
||||||
|
|
||||||
|
|
||||||
@json_schema_type
|
@json_schema_type
|
||||||
class OpenAIResponseOutputMessageFileSearchToolCall(BaseModel):
|
class OpenAIResponseOutputMessageFileSearchToolCall(BaseModel):
|
||||||
"""File search tool call output message for OpenAI responses.
|
"""File search tool call output message for OpenAI responses.
|
||||||
|
@ -185,7 +202,7 @@ class OpenAIResponseOutputMessageFileSearchToolCall(BaseModel):
|
||||||
queries: list[str]
|
queries: list[str]
|
||||||
status: str
|
status: str
|
||||||
type: Literal["file_search_call"] = "file_search_call"
|
type: Literal["file_search_call"] = "file_search_call"
|
||||||
results: list[dict[str, Any]] | None = None
|
results: list[OpenAIResponseOutputMessageFileSearchToolCallResults] | None = None
|
||||||
|
|
||||||
|
|
||||||
@json_schema_type
|
@json_schema_type
|
||||||
|
|
|
@ -327,10 +327,21 @@ class MetaReferenceAgentsImpl(Agents):
|
||||||
temperature: float | None = None,
|
temperature: float | None = None,
|
||||||
text: OpenAIResponseText | None = None,
|
text: OpenAIResponseText | None = None,
|
||||||
tools: list[OpenAIResponseInputTool] | None = None,
|
tools: list[OpenAIResponseInputTool] | None = None,
|
||||||
|
include: list[str] | None = None,
|
||||||
max_infer_iters: int | None = 10,
|
max_infer_iters: int | None = 10,
|
||||||
) -> OpenAIResponseObject:
|
) -> OpenAIResponseObject:
|
||||||
return await self.openai_responses_impl.create_openai_response(
|
return await self.openai_responses_impl.create_openai_response(
|
||||||
input, model, instructions, previous_response_id, store, stream, temperature, text, tools, max_infer_iters
|
input,
|
||||||
|
model,
|
||||||
|
instructions,
|
||||||
|
previous_response_id,
|
||||||
|
store,
|
||||||
|
stream,
|
||||||
|
temperature,
|
||||||
|
text,
|
||||||
|
tools,
|
||||||
|
include,
|
||||||
|
max_infer_iters,
|
||||||
)
|
)
|
||||||
|
|
||||||
async def list_openai_responses(
|
async def list_openai_responses(
|
||||||
|
|
|
@ -38,6 +38,7 @@ from llama_stack.apis.agents.openai_responses import (
|
||||||
OpenAIResponseOutputMessageContent,
|
OpenAIResponseOutputMessageContent,
|
||||||
OpenAIResponseOutputMessageContentOutputText,
|
OpenAIResponseOutputMessageContentOutputText,
|
||||||
OpenAIResponseOutputMessageFileSearchToolCall,
|
OpenAIResponseOutputMessageFileSearchToolCall,
|
||||||
|
OpenAIResponseOutputMessageFileSearchToolCallResults,
|
||||||
OpenAIResponseOutputMessageFunctionToolCall,
|
OpenAIResponseOutputMessageFunctionToolCall,
|
||||||
OpenAIResponseOutputMessageMCPListTools,
|
OpenAIResponseOutputMessageMCPListTools,
|
||||||
OpenAIResponseOutputMessageWebSearchToolCall,
|
OpenAIResponseOutputMessageWebSearchToolCall,
|
||||||
|
@ -333,6 +334,7 @@ class OpenAIResponsesImpl:
|
||||||
temperature: float | None = None,
|
temperature: float | None = None,
|
||||||
text: OpenAIResponseText | None = None,
|
text: OpenAIResponseText | None = None,
|
||||||
tools: list[OpenAIResponseInputTool] | None = None,
|
tools: list[OpenAIResponseInputTool] | None = None,
|
||||||
|
include: list[str] | None = None,
|
||||||
max_infer_iters: int | None = 10,
|
max_infer_iters: int | None = 10,
|
||||||
):
|
):
|
||||||
stream = bool(stream)
|
stream = bool(stream)
|
||||||
|
@ -826,12 +828,13 @@ class OpenAIResponsesImpl:
|
||||||
text = result.metadata["chunks"][i] if "chunks" in result.metadata else None
|
text = result.metadata["chunks"][i] if "chunks" in result.metadata else None
|
||||||
score = result.metadata["scores"][i] if "scores" in result.metadata else None
|
score = result.metadata["scores"][i] if "scores" in result.metadata else None
|
||||||
message.results.append(
|
message.results.append(
|
||||||
{
|
OpenAIResponseOutputMessageFileSearchToolCallResults(
|
||||||
"file_id": doc_id,
|
file_id=doc_id,
|
||||||
"filename": doc_id,
|
filename=doc_id,
|
||||||
"text": text,
|
text=text,
|
||||||
"score": score,
|
score=score,
|
||||||
}
|
attributes={},
|
||||||
|
)
|
||||||
)
|
)
|
||||||
if error_exc or (result.error_code and result.error_code > 0) or result.error_message:
|
if error_exc or (result.error_code and result.error_code > 0) or result.error_message:
|
||||||
message.status = "failed"
|
message.status = "failed"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue