mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-17 14:09:48 +00:00
feat!: Implement include parameter specifically for adding logprobs in the output message (#4261)
Some checks failed
SqlStore Integration Tests / test-postgres (3.12) (push) Failing after 0s
Integration Auth Tests / test-matrix (oauth2_token) (push) Failing after 1s
Test External Providers Installed via Module / test-external-providers-from-module (venv) (push) Has been skipped
Integration Tests (Replay) / generate-matrix (push) Successful in 3s
SqlStore Integration Tests / test-postgres (3.13) (push) Failing after 3s
API Conformance Tests / check-schema-compatibility (push) Successful in 15s
Python Package Build Test / build (3.12) (push) Successful in 17s
Python Package Build Test / build (3.13) (push) Successful in 18s
Test External API and Providers / test-external (venv) (push) Failing after 28s
Vector IO Integration Tests / test-matrix (push) Failing after 43s
UI Tests / ui-tests (22) (push) Successful in 52s
Unit Tests / unit-tests (3.13) (push) Failing after 1m45s
Unit Tests / unit-tests (3.12) (push) Failing after 1m58s
Pre-commit / pre-commit (22) (push) Successful in 3m9s
Integration Tests (Replay) / Integration Tests (, , , client=, ) (push) Failing after 4m5s
Some checks failed
SqlStore Integration Tests / test-postgres (3.12) (push) Failing after 0s
Integration Auth Tests / test-matrix (oauth2_token) (push) Failing after 1s
Test External Providers Installed via Module / test-external-providers-from-module (venv) (push) Has been skipped
Integration Tests (Replay) / generate-matrix (push) Successful in 3s
SqlStore Integration Tests / test-postgres (3.13) (push) Failing after 3s
API Conformance Tests / check-schema-compatibility (push) Successful in 15s
Python Package Build Test / build (3.12) (push) Successful in 17s
Python Package Build Test / build (3.13) (push) Successful in 18s
Test External API and Providers / test-external (venv) (push) Failing after 28s
Vector IO Integration Tests / test-matrix (push) Failing after 43s
UI Tests / ui-tests (22) (push) Successful in 52s
Unit Tests / unit-tests (3.13) (push) Failing after 1m45s
Unit Tests / unit-tests (3.12) (push) Failing after 1m58s
Pre-commit / pre-commit (22) (push) Successful in 3m9s
Integration Tests (Replay) / Integration Tests (, , , client=, ) (push) Failing after 4m5s
# Problem As an Application Developer, I want to use the include parameter with the value message.output_text.logprobs, so that I can receive log probabilities for output tokens to assess the model's confidence in its response. # What does this PR do? - Updates the include parameter in various resource definitions - Updates the inline provider to return logprobs when "message.output_text.logprobs" is passed in the include parameter - Converts the logprobs returned by the inference provider from chat completion format to responses format Closes #[4260](https://github.com/llamastack/llama-stack/issues/4260) ## Test Plan - Created a script to explore OpenAI behavior: https://github.com/s-akhtar-baig/llama-stack-examples/blob/main/responses/src/include.py - Added integration tests and new recordings --------- Co-authored-by: Matthew Farrellee <matt@cs.wisc.edu> Co-authored-by: Ashwin Bharambe <ashwin.bharambe@gmail.com>
This commit is contained in:
parent
76e47d811a
commit
805abf573f
26 changed files with 13524 additions and 161 deletions
104
docs/static/experimental-llama-stack-spec.yaml
vendored
104
docs/static/experimental-llama-stack-spec.yaml
vendored
|
|
@ -1349,15 +1349,15 @@ components:
|
|||
type: number
|
||||
title: Logprob
|
||||
top_logprobs:
|
||||
items:
|
||||
$ref: '#/components/schemas/OpenAITopLogProb'
|
||||
type: array
|
||||
title: Top Logprobs
|
||||
anyOf:
|
||||
- items:
|
||||
$ref: '#/components/schemas/OpenAITopLogProb'
|
||||
type: array
|
||||
- type: 'null'
|
||||
type: object
|
||||
required:
|
||||
- token
|
||||
- logprob
|
||||
- top_logprobs
|
||||
title: OpenAITokenLogProb
|
||||
description: |-
|
||||
The log probability for a token from an OpenAI-compatible chat completion response.
|
||||
|
|
@ -2445,15 +2445,22 @@ components:
|
|||
OpenAIResponseOutputMessageContentOutputText:
|
||||
properties:
|
||||
text:
|
||||
type: string
|
||||
title: Text
|
||||
type:
|
||||
type: string
|
||||
type:
|
||||
const: output_text
|
||||
title: Type
|
||||
default: output_text
|
||||
title: Type
|
||||
type: string
|
||||
annotations:
|
||||
items:
|
||||
discriminator:
|
||||
mapping:
|
||||
container_file_citation: '#/components/schemas/OpenAIResponseAnnotationContainerFileCitation'
|
||||
file_citation: '#/components/schemas/OpenAIResponseAnnotationFileCitation'
|
||||
file_path: '#/components/schemas/OpenAIResponseAnnotationFilePath'
|
||||
url_citation: '#/components/schemas/OpenAIResponseAnnotationCitation'
|
||||
propertyName: type
|
||||
oneOf:
|
||||
- $ref: '#/components/schemas/OpenAIResponseAnnotationFileCitation'
|
||||
title: OpenAIResponseAnnotationFileCitation
|
||||
|
|
@ -2463,20 +2470,20 @@ components:
|
|||
title: OpenAIResponseAnnotationContainerFileCitation
|
||||
- $ref: '#/components/schemas/OpenAIResponseAnnotationFilePath'
|
||||
title: OpenAIResponseAnnotationFilePath
|
||||
discriminator:
|
||||
propertyName: type
|
||||
mapping:
|
||||
container_file_citation: '#/components/schemas/OpenAIResponseAnnotationContainerFileCitation'
|
||||
file_citation: '#/components/schemas/OpenAIResponseAnnotationFileCitation'
|
||||
file_path: '#/components/schemas/OpenAIResponseAnnotationFilePath'
|
||||
url_citation: '#/components/schemas/OpenAIResponseAnnotationCitation'
|
||||
title: OpenAIResponseAnnotationFileCitation | ... (4 variants)
|
||||
type: array
|
||||
title: Annotations
|
||||
type: object
|
||||
type: array
|
||||
logprobs:
|
||||
anyOf:
|
||||
- items:
|
||||
$ref: '#/components/schemas/OpenAITokenLogProb'
|
||||
type: array
|
||||
- type: 'null'
|
||||
nullable: true
|
||||
required:
|
||||
- text
|
||||
title: OpenAIResponseOutputMessageContentOutputText
|
||||
type: object
|
||||
OpenAIResponseOutputMessageFileSearchToolCall:
|
||||
properties:
|
||||
id:
|
||||
|
|
@ -3983,8 +3990,7 @@ components:
|
|||
logprobs:
|
||||
anyOf:
|
||||
- items:
|
||||
additionalProperties: true
|
||||
type: object
|
||||
$ref: '#/components/schemas/OpenAITokenLogProb'
|
||||
type: array
|
||||
- type: 'null'
|
||||
nullable: true
|
||||
|
|
@ -4746,6 +4752,13 @@ components:
|
|||
item_id:
|
||||
title: Item Id
|
||||
type: string
|
||||
logprobs:
|
||||
anyOf:
|
||||
- items:
|
||||
$ref: '#/components/schemas/OpenAITokenLogProb'
|
||||
type: array
|
||||
- type: 'null'
|
||||
nullable: true
|
||||
output_index:
|
||||
title: Output Index
|
||||
type: integer
|
||||
|
|
@ -7975,19 +7988,19 @@ components:
|
|||
title: list[OpenAIResponseInputMessageContentText | OpenAIResponseInputMessageContentImage | OpenAIResponseInputMessageContentFile]
|
||||
- items:
|
||||
oneOf:
|
||||
- $ref: '#/components/schemas/OpenAIResponseOutputMessageContentOutputText'
|
||||
title: OpenAIResponseOutputMessageContentOutputText
|
||||
- $ref: '#/components/schemas/OpenAIResponseOutputMessageContentOutputText-Output'
|
||||
title: OpenAIResponseOutputMessageContentOutputText-Output
|
||||
- $ref: '#/components/schemas/OpenAIResponseContentPartRefusal'
|
||||
title: OpenAIResponseContentPartRefusal
|
||||
discriminator:
|
||||
propertyName: type
|
||||
mapping:
|
||||
output_text: '#/components/schemas/OpenAIResponseOutputMessageContentOutputText'
|
||||
output_text: '#/components/schemas/OpenAIResponseOutputMessageContentOutputText-Output'
|
||||
refusal: '#/components/schemas/OpenAIResponseContentPartRefusal'
|
||||
title: OpenAIResponseOutputMessageContentOutputText | OpenAIResponseContentPartRefusal
|
||||
title: OpenAIResponseOutputMessageContentOutputText-Output | OpenAIResponseContentPartRefusal
|
||||
type: array
|
||||
title: list[OpenAIResponseOutputMessageContentOutputText | OpenAIResponseContentPartRefusal]
|
||||
title: string | list[OpenAIResponseInputMessageContentText | OpenAIResponseInputMessageContentImage | OpenAIResponseInputMessageContentFile] | list[OpenAIResponseOutputMessageContentOutputText | OpenAIResponseContentPartRefusal]
|
||||
title: list[OpenAIResponseOutputMessageContentOutputText-Output | OpenAIResponseContentPartRefusal]
|
||||
title: string | list[OpenAIResponseInputMessageContentText | OpenAIResponseInputMessageContentImage | OpenAIResponseInputMessageContentFile] | list[OpenAIResponseOutputMessageContentOutputText-Output | OpenAIResponseContentPartRefusal]
|
||||
role:
|
||||
title: Role
|
||||
type: string
|
||||
|
|
@ -8020,6 +8033,47 @@ components:
|
|||
They are all under one type because the Responses API gives them all
|
||||
the same "type" value, and there is no way to tell them apart in certain
|
||||
scenarios.
|
||||
OpenAIResponseOutputMessageContentOutputText-Output:
|
||||
properties:
|
||||
text:
|
||||
type: string
|
||||
title: Text
|
||||
type:
|
||||
type: string
|
||||
const: output_text
|
||||
title: Type
|
||||
default: output_text
|
||||
annotations:
|
||||
items:
|
||||
oneOf:
|
||||
- $ref: '#/components/schemas/OpenAIResponseAnnotationFileCitation'
|
||||
title: OpenAIResponseAnnotationFileCitation
|
||||
- $ref: '#/components/schemas/OpenAIResponseAnnotationCitation'
|
||||
title: OpenAIResponseAnnotationCitation
|
||||
- $ref: '#/components/schemas/OpenAIResponseAnnotationContainerFileCitation'
|
||||
title: OpenAIResponseAnnotationContainerFileCitation
|
||||
- $ref: '#/components/schemas/OpenAIResponseAnnotationFilePath'
|
||||
title: OpenAIResponseAnnotationFilePath
|
||||
discriminator:
|
||||
propertyName: type
|
||||
mapping:
|
||||
container_file_citation: '#/components/schemas/OpenAIResponseAnnotationContainerFileCitation'
|
||||
file_citation: '#/components/schemas/OpenAIResponseAnnotationFileCitation'
|
||||
file_path: '#/components/schemas/OpenAIResponseAnnotationFilePath'
|
||||
url_citation: '#/components/schemas/OpenAIResponseAnnotationCitation'
|
||||
title: OpenAIResponseAnnotationFileCitation | ... (4 variants)
|
||||
type: array
|
||||
title: Annotations
|
||||
logprobs:
|
||||
anyOf:
|
||||
- items:
|
||||
$ref: '#/components/schemas/OpenAITokenLogProb'
|
||||
type: array
|
||||
- type: 'null'
|
||||
type: object
|
||||
required:
|
||||
- text
|
||||
title: OpenAIResponseOutputMessageContentOutputText
|
||||
OpenAIResponseOutputMessageFileSearchToolCallResults:
|
||||
properties:
|
||||
attributes:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue