Flatten enums

This commit is contained in:
Ashwin Bharambe 2025-01-29 09:09:51 -08:00
parent 62c3c5bb7e
commit 3e2a751f54
5 changed files with 243 additions and 259 deletions

View file

@ -2337,15 +2337,6 @@
"rows" "rows"
] ]
}, },
"BuiltinTool": {
"type": "string",
"enum": [
"brave_search",
"wolfram_alpha",
"photogen",
"code_interpreter"
]
},
"CompletionMessage": { "CompletionMessage": {
"type": "object", "type": "object",
"properties": { "properties": {
@ -2360,7 +2351,12 @@
"description": "The content of the model's response" "description": "The content of the model's response"
}, },
"stop_reason": { "stop_reason": {
"$ref": "#/components/schemas/StopReason", "type": "string",
"enum": [
"end_of_turn",
"end_of_message",
"out_of_tokens"
],
"description": "Reason why the model stopped generating. Options are: - `StopReason.end_of_turn`: The model finished generating the entire response. - `StopReason.end_of_message`: The model finished generating but generated a partial response -- usually, a tool call. The user may call the tool and continue the conversation with the tool's response. - `StopReason.out_of_tokens`: The model ran out of token budget." "description": "Reason why the model stopped generating. Options are: - `StopReason.end_of_turn`: The model finished generating the entire response. - `StopReason.end_of_message`: The model finished generating but generated a partial response -- usually, a tool call. The user may call the tool and continue the conversation with the tool's response. - `StopReason.out_of_tokens`: The model ran out of token budget."
}, },
"tool_calls": { "tool_calls": {
@ -2587,25 +2583,7 @@
"type": "object", "type": "object",
"properties": { "properties": {
"strategy": { "strategy": {
"oneOf": [ "$ref": "#/components/schemas/SamplingStrategy"
{
"$ref": "#/components/schemas/GreedySamplingStrategy"
},
{
"$ref": "#/components/schemas/TopPSamplingStrategy"
},
{
"$ref": "#/components/schemas/TopKSamplingStrategy"
}
],
"discriminator": {
"propertyName": "type",
"mapping": {
"greedy": "#/components/schemas/GreedySamplingStrategy",
"top_p": "#/components/schemas/TopPSamplingStrategy",
"top_k": "#/components/schemas/TopKSamplingStrategy"
}
}
}, },
"max_tokens": { "max_tokens": {
"type": "integer", "type": "integer",
@ -2621,13 +2599,26 @@
"strategy" "strategy"
] ]
}, },
"StopReason": { "SamplingStrategy": {
"type": "string", "oneOf": [
"enum": [ {
"end_of_turn", "$ref": "#/components/schemas/GreedySamplingStrategy"
"end_of_message", },
"out_of_tokens" {
] "$ref": "#/components/schemas/TopPSamplingStrategy"
},
{
"$ref": "#/components/schemas/TopKSamplingStrategy"
}
],
"discriminator": {
"propertyName": "type",
"mapping": {
"greedy": "#/components/schemas/GreedySamplingStrategy",
"top_p": "#/components/schemas/TopPSamplingStrategy",
"top_k": "#/components/schemas/TopKSamplingStrategy"
}
}
}, },
"SystemMessage": { "SystemMessage": {
"type": "object", "type": "object",
@ -2677,7 +2668,13 @@
"tool_name": { "tool_name": {
"oneOf": [ "oneOf": [
{ {
"$ref": "#/components/schemas/BuiltinTool" "type": "string",
"enum": [
"brave_search",
"wolfram_alpha",
"photogen",
"code_interpreter"
]
}, },
{ {
"type": "string" "type": "string"
@ -2758,21 +2755,19 @@
"arguments" "arguments"
] ]
}, },
"ToolChoice": {
"type": "string",
"enum": [
"auto",
"required"
],
"title": "Whether tool use is required or automatic. This is a hint to the model which may not be followed. It depends on the Instruction Following capabilities of the model."
},
"ToolDefinition": { "ToolDefinition": {
"type": "object", "type": "object",
"properties": { "properties": {
"tool_name": { "tool_name": {
"oneOf": [ "oneOf": [
{ {
"$ref": "#/components/schemas/BuiltinTool" "type": "string",
"enum": [
"brave_search",
"wolfram_alpha",
"photogen",
"code_interpreter"
]
}, },
{ {
"type": "string" "type": "string"
@ -2835,16 +2830,6 @@
"param_type" "param_type"
] ]
}, },
"ToolPromptFormat": {
"type": "string",
"enum": [
"json",
"function_tag",
"python_list"
],
"title": "This Enum refers to the prompt format for calling custom / zero shot tools",
"description": "`json` --\n Refers to the json format for calling tools.\n The json format takes the form like\n {\n \"type\": \"function\",\n \"function\" : {\n \"name\": \"function_name\",\n \"description\": \"function_description\",\n \"parameters\": {...}\n }\n }\n\n`function_tag` --\n This is an example of how you could define\n your own user defined format for making tool calls.\n The function_tag format looks like this,\n <function=function_name>(parameters)</function>\n\nThe detailed prompts for each of these formats are added to llama cli"
},
"ToolResponseMessage": { "ToolResponseMessage": {
"type": "object", "type": "object",
"properties": { "properties": {
@ -2861,7 +2846,13 @@
"tool_name": { "tool_name": {
"oneOf": [ "oneOf": [
{ {
"$ref": "#/components/schemas/BuiltinTool" "type": "string",
"enum": [
"brave_search",
"wolfram_alpha",
"photogen",
"code_interpreter"
]
}, },
{ {
"type": "string" "type": "string"
@ -2984,10 +2975,22 @@
} }
}, },
"tool_choice": { "tool_choice": {
"$ref": "#/components/schemas/ToolChoice" "type": "string",
"enum": [
"auto",
"required"
],
"title": "Whether tool use is required or automatic. This is a hint to the model which may not be followed. It depends on the Instruction Following capabilities of the model."
}, },
"tool_prompt_format": { "tool_prompt_format": {
"$ref": "#/components/schemas/ToolPromptFormat" "type": "string",
"enum": [
"json",
"function_tag",
"python_list"
],
"title": "This Enum refers to the prompt format for calling custom / zero shot tools",
"description": "The detailed prompts for each of these formats are added to llama cli"
}, },
"response_format": { "response_format": {
"$ref": "#/components/schemas/ResponseFormat" "$ref": "#/components/schemas/ResponseFormat"
@ -3122,7 +3125,12 @@
"description": "The generated completion text" "description": "The generated completion text"
}, },
"stop_reason": { "stop_reason": {
"$ref": "#/components/schemas/StopReason", "type": "string",
"enum": [
"end_of_turn",
"end_of_message",
"out_of_tokens"
],
"description": "Reason why generation stopped" "description": "Reason why generation stopped"
}, },
"logprobs": { "logprobs": {
@ -3178,11 +3186,20 @@
"description": "(Optional) List of tool definitions available to the model" "description": "(Optional) List of tool definitions available to the model"
}, },
"tool_choice": { "tool_choice": {
"$ref": "#/components/schemas/ToolChoice", "type": "string",
"enum": [
"auto",
"required"
],
"description": "(Optional) Whether tool use is required or automatic. Defaults to ToolChoice.auto." "description": "(Optional) Whether tool use is required or automatic. Defaults to ToolChoice.auto."
}, },
"tool_prompt_format": { "tool_prompt_format": {
"$ref": "#/components/schemas/ToolPromptFormat", "type": "string",
"enum": [
"json",
"function_tag",
"python_list"
],
"description": "(Optional) Instructs the model how to format tool calls. By default, Llama Stack will attempt to use a format that is best adapted to the model. - `ToolPromptFormat.json`: The tool calls are formatted as a JSON object. - `ToolPromptFormat.function_tag`: The tool calls are enclosed in a <function=function_name> tag. - `ToolPromptFormat.python_list`: The tool calls are output as Python syntax -- a list of function calls." "description": "(Optional) Instructs the model how to format tool calls. By default, Llama Stack will attempt to use a format that is best adapted to the model. - `ToolPromptFormat.json`: The tool calls are formatted as a JSON object. - `ToolPromptFormat.function_tag`: The tool calls are enclosed in a <function=function_name> tag. - `ToolPromptFormat.python_list`: The tool calls are output as Python syntax -- a list of function calls."
}, },
"response_format": { "response_format": {
@ -3216,7 +3233,12 @@
"type": "object", "type": "object",
"properties": { "properties": {
"event_type": { "event_type": {
"$ref": "#/components/schemas/ChatCompletionResponseEventType", "type": "string",
"enum": [
"start",
"complete",
"progress"
],
"description": "Type of the event" "description": "Type of the event"
}, },
"delta": { "delta": {
@ -3231,7 +3253,12 @@
"description": "Optional log probabilities for generated tokens" "description": "Optional log probabilities for generated tokens"
}, },
"stop_reason": { "stop_reason": {
"$ref": "#/components/schemas/StopReason", "type": "string",
"enum": [
"end_of_turn",
"end_of_message",
"out_of_tokens"
],
"description": "Optional reason why generation stopped, if complete" "description": "Optional reason why generation stopped, if complete"
} }
}, },
@ -3242,15 +3269,6 @@
], ],
"title": "An event during chat completion generation." "title": "An event during chat completion generation."
}, },
"ChatCompletionResponseEventType": {
"type": "string",
"enum": [
"start",
"complete",
"progress"
],
"title": "Types of events that can occur during chat completion."
},
"ChatCompletionResponseStreamChunk": { "ChatCompletionResponseStreamChunk": {
"type": "object", "type": "object",
"properties": { "properties": {
@ -3342,7 +3360,13 @@
] ]
}, },
"parse_status": { "parse_status": {
"$ref": "#/components/schemas/ToolCallParseStatus" "type": "string",
"enum": [
"started",
"in_progress",
"failed",
"succeeded"
]
} }
}, },
"additionalProperties": false, "additionalProperties": false,
@ -3352,15 +3376,6 @@
"parse_status" "parse_status"
] ]
}, },
"ToolCallParseStatus": {
"type": "string",
"enum": [
"started",
"in_progress",
"failed",
"succeeded"
]
},
"CompletionRequest": { "CompletionRequest": {
"type": "object", "type": "object",
"properties": { "properties": {
@ -3411,7 +3426,12 @@
"description": "New content generated since last chunk. This can be one or more tokens." "description": "New content generated since last chunk. This can be one or more tokens."
}, },
"stop_reason": { "stop_reason": {
"$ref": "#/components/schemas/StopReason", "type": "string",
"enum": [
"end_of_turn",
"end_of_message",
"out_of_tokens"
],
"description": "Optional reason why generation stopped, if complete" "description": "Optional reason why generation stopped, if complete"
}, },
"logprobs": { "logprobs": {
@ -3459,11 +3479,23 @@
} }
}, },
"tool_choice": { "tool_choice": {
"$ref": "#/components/schemas/ToolChoice", "type": "string",
"enum": [
"auto",
"required"
],
"title": "Whether tool use is required or automatic. This is a hint to the model which may not be followed. It depends on the Instruction Following capabilities of the model.",
"default": "auto" "default": "auto"
}, },
"tool_prompt_format": { "tool_prompt_format": {
"$ref": "#/components/schemas/ToolPromptFormat" "type": "string",
"enum": [
"json",
"function_tag",
"python_list"
],
"title": "This Enum refers to the prompt format for calling custom / zero shot tools",
"description": "The detailed prompts for each of these formats are added to llama cli"
}, },
"max_infer_iters": { "max_infer_iters": {
"type": "integer", "type": "integer",
@ -4170,7 +4202,13 @@
"tool_name": { "tool_name": {
"oneOf": [ "oneOf": [
{ {
"$ref": "#/components/schemas/BuiltinTool" "type": "string",
"enum": [
"brave_search",
"wolfram_alpha",
"photogen",
"code_interpreter"
]
}, },
{ {
"type": "string" "type": "string"
@ -7917,10 +7955,6 @@
"name": "BooleanType", "name": "BooleanType",
"description": "" "description": ""
}, },
{
"name": "BuiltinTool",
"description": ""
},
{ {
"name": "CancelTrainingJobRequest", "name": "CancelTrainingJobRequest",
"description": "" "description": ""
@ -7941,10 +7975,6 @@
"name": "ChatCompletionResponseEvent", "name": "ChatCompletionResponseEvent",
"description": "An event during chat completion generation." "description": "An event during chat completion generation."
}, },
{
"name": "ChatCompletionResponseEventType",
"description": "Types of events that can occur during chat completion."
},
{ {
"name": "ChatCompletionResponseStreamChunk", "name": "ChatCompletionResponseStreamChunk",
"description": "A chunk of a streamed chat completion response." "description": "A chunk of a streamed chat completion response."
@ -8376,6 +8406,10 @@
"name": "SamplingParams", "name": "SamplingParams",
"description": "" "description": ""
}, },
{
"name": "SamplingStrategy",
"description": ""
},
{ {
"name": "SaveSpansToDatasetRequest", "name": "SaveSpansToDatasetRequest",
"description": "" "description": ""
@ -8449,10 +8483,6 @@
"name": "SpanWithStatus", "name": "SpanWithStatus",
"description": "" "description": ""
}, },
{
"name": "StopReason",
"description": ""
},
{ {
"name": "StringType", "name": "StringType",
"description": "" "description": ""
@ -8511,14 +8541,6 @@
"name": "ToolCallDelta", "name": "ToolCallDelta",
"description": "" "description": ""
}, },
{
"name": "ToolCallParseStatus",
"description": ""
},
{
"name": "ToolChoice",
"description": "Whether tool use is required or automatic. This is a hint to the model which may not be followed. It depends on the Instruction Following capabilities of the model."
},
{ {
"name": "ToolDef", "name": "ToolDef",
"description": "" "description": ""
@ -8554,10 +8576,6 @@
"name": "ToolParameter", "name": "ToolParameter",
"description": "" "description": ""
}, },
{
"name": "ToolPromptFormat",
"description": "This Enum refers to the prompt format for calling custom / zero shot tools\n\n`json` --\n Refers to the json format for calling tools.\n The json format takes the form like\n {\n \"type\": \"function\",\n \"function\" : {\n \"name\": \"function_name\",\n \"description\": \"function_description\",\n \"parameters\": {...}\n }\n }\n\n`function_tag` --\n This is an example of how you could define\n your own user defined format for making tool calls.\n The function_tag format looks like this,\n <function=function_name>(parameters)</function>\n\nThe detailed prompts for each of these formats are added to llama cli"
},
{ {
"name": "ToolResponse", "name": "ToolResponse",
"description": "" "description": ""
@ -8680,13 +8698,11 @@
"BatchCompletionResponse", "BatchCompletionResponse",
"BenchmarkEvalTaskConfig", "BenchmarkEvalTaskConfig",
"BooleanType", "BooleanType",
"BuiltinTool",
"CancelTrainingJobRequest", "CancelTrainingJobRequest",
"ChatCompletionInputType", "ChatCompletionInputType",
"ChatCompletionRequest", "ChatCompletionRequest",
"ChatCompletionResponse", "ChatCompletionResponse",
"ChatCompletionResponseEvent", "ChatCompletionResponseEvent",
"ChatCompletionResponseEventType",
"ChatCompletionResponseStreamChunk", "ChatCompletionResponseStreamChunk",
"Checkpoint", "Checkpoint",
"CompletionInputType", "CompletionInputType",
@ -8788,6 +8804,7 @@
"RunShieldResponse", "RunShieldResponse",
"SafetyViolation", "SafetyViolation",
"SamplingParams", "SamplingParams",
"SamplingStrategy",
"SaveSpansToDatasetRequest", "SaveSpansToDatasetRequest",
"ScoreBatchRequest", "ScoreBatchRequest",
"ScoreBatchResponse", "ScoreBatchResponse",
@ -8804,7 +8821,6 @@
"SpanStartPayload", "SpanStartPayload",
"SpanStatus", "SpanStatus",
"SpanWithStatus", "SpanWithStatus",
"StopReason",
"StringType", "StringType",
"StructuredLogEvent", "StructuredLogEvent",
"StructuredLogPayload", "StructuredLogPayload",
@ -8818,8 +8834,6 @@
"Tool", "Tool",
"ToolCall", "ToolCall",
"ToolCallDelta", "ToolCallDelta",
"ToolCallParseStatus",
"ToolChoice",
"ToolDef", "ToolDef",
"ToolDefinition", "ToolDefinition",
"ToolExecutionStep", "ToolExecutionStep",
@ -8828,7 +8842,6 @@
"ToolInvocationResult", "ToolInvocationResult",
"ToolParamDefinition", "ToolParamDefinition",
"ToolParameter", "ToolParameter",
"ToolPromptFormat",
"ToolResponse", "ToolResponse",
"ToolResponseMessage", "ToolResponseMessage",
"TopKSamplingStrategy", "TopKSamplingStrategy",

View file

@ -1383,13 +1383,6 @@ components:
required: required:
- dataset_id - dataset_id
- rows - rows
BuiltinTool:
type: string
enum:
- brave_search
- wolfram_alpha
- photogen
- code_interpreter
CompletionMessage: CompletionMessage:
type: object type: object
properties: properties:
@ -1403,7 +1396,11 @@ components:
$ref: '#/components/schemas/InterleavedContent' $ref: '#/components/schemas/InterleavedContent'
description: The content of the model's response description: The content of the model's response
stop_reason: stop_reason:
$ref: '#/components/schemas/StopReason' type: string
enum:
- end_of_turn
- end_of_message
- out_of_tokens
description: >- description: >-
Reason why the model stopped generating. Options are: - `StopReason.end_of_turn`: Reason why the model stopped generating. Options are: - `StopReason.end_of_turn`:
The model finished generating the entire response. - `StopReason.end_of_message`: The model finished generating the entire response. - `StopReason.end_of_message`:
@ -1552,16 +1549,7 @@ components:
type: object type: object
properties: properties:
strategy: strategy:
oneOf: $ref: '#/components/schemas/SamplingStrategy'
- $ref: '#/components/schemas/GreedySamplingStrategy'
- $ref: '#/components/schemas/TopPSamplingStrategy'
- $ref: '#/components/schemas/TopKSamplingStrategy'
discriminator:
propertyName: type
mapping:
greedy: '#/components/schemas/GreedySamplingStrategy'
top_p: '#/components/schemas/TopPSamplingStrategy'
top_k: '#/components/schemas/TopKSamplingStrategy'
max_tokens: max_tokens:
type: integer type: integer
default: 0 default: 0
@ -1571,12 +1559,17 @@ components:
additionalProperties: false additionalProperties: false
required: required:
- strategy - strategy
StopReason: SamplingStrategy:
type: string oneOf:
enum: - $ref: '#/components/schemas/GreedySamplingStrategy'
- end_of_turn - $ref: '#/components/schemas/TopPSamplingStrategy'
- end_of_message - $ref: '#/components/schemas/TopKSamplingStrategy'
- out_of_tokens discriminator:
propertyName: type
mapping:
greedy: '#/components/schemas/GreedySamplingStrategy'
top_p: '#/components/schemas/TopPSamplingStrategy'
top_k: '#/components/schemas/TopKSamplingStrategy'
SystemMessage: SystemMessage:
type: object type: object
properties: properties:
@ -1618,7 +1611,12 @@ components:
type: string type: string
tool_name: tool_name:
oneOf: oneOf:
- $ref: '#/components/schemas/BuiltinTool' - type: string
enum:
- brave_search
- wolfram_alpha
- photogen
- code_interpreter
- type: string - type: string
arguments: arguments:
type: object type: object
@ -1650,21 +1648,17 @@ components:
- call_id - call_id
- tool_name - tool_name
- arguments - arguments
ToolChoice:
type: string
enum:
- auto
- required
title: >-
Whether tool use is required or automatic. This is a hint to the model which
may not be followed. It depends on the Instruction Following capabilities
of the model.
ToolDefinition: ToolDefinition:
type: object type: object
properties: properties:
tool_name: tool_name:
oneOf: oneOf:
- $ref: '#/components/schemas/BuiltinTool' - type: string
enum:
- brave_search
- wolfram_alpha
- photogen
- code_interpreter
- type: string - type: string
description: description:
type: string type: string
@ -1696,34 +1690,6 @@ components:
additionalProperties: false additionalProperties: false
required: required:
- param_type - param_type
ToolPromptFormat:
type: string
enum:
- json
- function_tag
- python_list
title: >-
This Enum refers to the prompt format for calling custom / zero shot tools
description: >-
`json` --
Refers to the json format for calling tools.
The json format takes the form like
{
"type": "function",
"function" : {
"name": "function_name",
"description": "function_description",
"parameters": {...}
}
}
`function_tag` --
This is an example of how you could define
your own user defined format for making tool calls.
The function_tag format looks like this,
<function=function_name>(parameters)</function>
The detailed prompts for each of these formats are added to llama cli
ToolResponseMessage: ToolResponseMessage:
type: object type: object
properties: properties:
@ -1739,7 +1705,12 @@ components:
Unique identifier for the tool call this response is for Unique identifier for the tool call this response is for
tool_name: tool_name:
oneOf: oneOf:
- $ref: '#/components/schemas/BuiltinTool' - type: string
enum:
- brave_search
- wolfram_alpha
- photogen
- code_interpreter
- type: string - type: string
description: Name of the tool that was called description: Name of the tool that was called
content: content:
@ -1831,9 +1802,24 @@ components:
items: items:
$ref: '#/components/schemas/ToolDefinition' $ref: '#/components/schemas/ToolDefinition'
tool_choice: tool_choice:
$ref: '#/components/schemas/ToolChoice' type: string
enum:
- auto
- required
title: >-
Whether tool use is required or automatic. This is a hint to the model
which may not be followed. It depends on the Instruction Following capabilities
of the model.
tool_prompt_format: tool_prompt_format:
$ref: '#/components/schemas/ToolPromptFormat' type: string
enum:
- json
- function_tag
- python_list
title: >-
This Enum refers to the prompt format for calling custom / zero shot tools
description: >-
The detailed prompts for each of these formats are added to llama cli
response_format: response_format:
$ref: '#/components/schemas/ResponseFormat' $ref: '#/components/schemas/ResponseFormat'
logprobs: logprobs:
@ -1931,7 +1917,11 @@ components:
type: string type: string
description: The generated completion text description: The generated completion text
stop_reason: stop_reason:
$ref: '#/components/schemas/StopReason' type: string
enum:
- end_of_turn
- end_of_message
- out_of_tokens
description: Reason why generation stopped description: Reason why generation stopped
logprobs: logprobs:
type: array type: array
@ -1976,11 +1966,18 @@ components:
description: >- description: >-
(Optional) List of tool definitions available to the model (Optional) List of tool definitions available to the model
tool_choice: tool_choice:
$ref: '#/components/schemas/ToolChoice' type: string
enum:
- auto
- required
description: >- description: >-
(Optional) Whether tool use is required or automatic. Defaults to ToolChoice.auto. (Optional) Whether tool use is required or automatic. Defaults to ToolChoice.auto.
tool_prompt_format: tool_prompt_format:
$ref: '#/components/schemas/ToolPromptFormat' type: string
enum:
- json
- function_tag
- python_list
description: >- description: >-
(Optional) Instructs the model how to format tool calls. By default, Llama (Optional) Instructs the model how to format tool calls. By default, Llama
Stack will attempt to use a format that is best adapted to the model. Stack will attempt to use a format that is best adapted to the model.
@ -2021,7 +2018,11 @@ components:
type: object type: object
properties: properties:
event_type: event_type:
$ref: '#/components/schemas/ChatCompletionResponseEventType' type: string
enum:
- start
- complete
- progress
description: Type of the event description: Type of the event
delta: delta:
$ref: '#/components/schemas/ContentDelta' $ref: '#/components/schemas/ContentDelta'
@ -2035,7 +2036,11 @@ components:
description: >- description: >-
Optional log probabilities for generated tokens Optional log probabilities for generated tokens
stop_reason: stop_reason:
$ref: '#/components/schemas/StopReason' type: string
enum:
- end_of_turn
- end_of_message
- out_of_tokens
description: >- description: >-
Optional reason why generation stopped, if complete Optional reason why generation stopped, if complete
additionalProperties: false additionalProperties: false
@ -2044,14 +2049,6 @@ components:
- delta - delta
title: >- title: >-
An event during chat completion generation. An event during chat completion generation.
ChatCompletionResponseEventType:
type: string
enum:
- start
- complete
- progress
title: >-
Types of events that can occur during chat completion.
ChatCompletionResponseStreamChunk: ChatCompletionResponseStreamChunk:
type: object type: object
properties: properties:
@ -2113,19 +2110,17 @@ components:
- type: string - type: string
- $ref: '#/components/schemas/ToolCall' - $ref: '#/components/schemas/ToolCall'
parse_status: parse_status:
$ref: '#/components/schemas/ToolCallParseStatus' type: string
enum:
- started
- in_progress
- failed
- succeeded
additionalProperties: false additionalProperties: false
required: required:
- type - type
- tool_call - tool_call
- parse_status - parse_status
ToolCallParseStatus:
type: string
enum:
- started
- in_progress
- failed
- succeeded
CompletionRequest: CompletionRequest:
type: object type: object
properties: properties:
@ -2174,7 +2169,11 @@ components:
description: >- description: >-
New content generated since last chunk. This can be one or more tokens. New content generated since last chunk. This can be one or more tokens.
stop_reason: stop_reason:
$ref: '#/components/schemas/StopReason' type: string
enum:
- end_of_turn
- end_of_message
- out_of_tokens
description: >- description: >-
Optional reason why generation stopped, if complete Optional reason why generation stopped, if complete
logprobs: logprobs:
@ -2210,10 +2209,25 @@ components:
items: items:
$ref: '#/components/schemas/ToolDef' $ref: '#/components/schemas/ToolDef'
tool_choice: tool_choice:
$ref: '#/components/schemas/ToolChoice' type: string
enum:
- auto
- required
title: >-
Whether tool use is required or automatic. This is a hint to the model
which may not be followed. It depends on the Instruction Following capabilities
of the model.
default: auto default: auto
tool_prompt_format: tool_prompt_format:
$ref: '#/components/schemas/ToolPromptFormat' type: string
enum:
- json
- function_tag
- python_list
title: >-
This Enum refers to the prompt format for calling custom / zero shot tools
description: >-
The detailed prompts for each of these formats are added to llama cli
max_infer_iters: max_infer_iters:
type: integer type: integer
default: 10 default: 10
@ -2656,7 +2670,12 @@ components:
type: string type: string
tool_name: tool_name:
oneOf: oneOf:
- $ref: '#/components/schemas/BuiltinTool' - type: string
enum:
- brave_search
- wolfram_alpha
- photogen
- code_interpreter
- type: string - type: string
content: content:
$ref: '#/components/schemas/InterleavedContent' $ref: '#/components/schemas/InterleavedContent'
@ -4942,8 +4961,6 @@ tags:
description: '' description: ''
- name: BooleanType - name: BooleanType
description: '' description: ''
- name: BuiltinTool
description: ''
- name: CancelTrainingJobRequest - name: CancelTrainingJobRequest
description: '' description: ''
- name: ChatCompletionInputType - name: ChatCompletionInputType
@ -4955,9 +4972,6 @@ tags:
- name: ChatCompletionResponseEvent - name: ChatCompletionResponseEvent
description: >- description: >-
An event during chat completion generation. An event during chat completion generation.
- name: ChatCompletionResponseEventType
description: >-
Types of events that can occur during chat completion.
- name: ChatCompletionResponseStreamChunk - name: ChatCompletionResponseStreamChunk
description: >- description: >-
A chunk of a streamed chat completion response. A chunk of a streamed chat completion response.
@ -5175,6 +5189,8 @@ tags:
description: '' description: ''
- name: SamplingParams - name: SamplingParams
description: '' description: ''
- name: SamplingStrategy
description: ''
- name: SaveSpansToDatasetRequest - name: SaveSpansToDatasetRequest
description: '' description: ''
- name: ScoreBatchRequest - name: ScoreBatchRequest
@ -5212,8 +5228,6 @@ tags:
description: '' description: ''
- name: SpanWithStatus - name: SpanWithStatus
description: '' description: ''
- name: StopReason
description: ''
- name: StringType - name: StringType
description: '' description: ''
- name: StructuredLogEvent - name: StructuredLogEvent
@ -5245,13 +5259,6 @@ tags:
description: '' description: ''
- name: ToolCallDelta - name: ToolCallDelta
description: '' description: ''
- name: ToolCallParseStatus
description: ''
- name: ToolChoice
description: >-
Whether tool use is required or automatic. This is a hint to the model which
may not be followed. It depends on the Instruction Following capabilities of
the model.
- name: ToolDef - name: ToolDef
description: '' description: ''
- name: ToolDefinition - name: ToolDefinition
@ -5269,30 +5276,6 @@ tags:
description: '' description: ''
- name: ToolParameter - name: ToolParameter
description: '' description: ''
- name: ToolPromptFormat
description: >-
This Enum refers to the prompt format for calling custom / zero shot tools
`json` --
Refers to the json format for calling tools.
The json format takes the form like
{
"type": "function",
"function" : {
"name": "function_name",
"description": "function_description",
"parameters": {...}
}
}
`function_tag` --
This is an example of how you could define
your own user defined format for making tool calls.
The function_tag format looks like this,
<function=function_name>(parameters)</function>
The detailed prompts for each of these formats are added to llama cli
- name: ToolResponse - name: ToolResponse
description: '' description: ''
- name: ToolResponseMessage - name: ToolResponseMessage
@ -5379,13 +5362,11 @@ x-tagGroups:
- BatchCompletionResponse - BatchCompletionResponse
- BenchmarkEvalTaskConfig - BenchmarkEvalTaskConfig
- BooleanType - BooleanType
- BuiltinTool
- CancelTrainingJobRequest - CancelTrainingJobRequest
- ChatCompletionInputType - ChatCompletionInputType
- ChatCompletionRequest - ChatCompletionRequest
- ChatCompletionResponse - ChatCompletionResponse
- ChatCompletionResponseEvent - ChatCompletionResponseEvent
- ChatCompletionResponseEventType
- ChatCompletionResponseStreamChunk - ChatCompletionResponseStreamChunk
- Checkpoint - Checkpoint
- CompletionInputType - CompletionInputType
@ -5487,6 +5468,7 @@ x-tagGroups:
- RunShieldResponse - RunShieldResponse
- SafetyViolation - SafetyViolation
- SamplingParams - SamplingParams
- SamplingStrategy
- SaveSpansToDatasetRequest - SaveSpansToDatasetRequest
- ScoreBatchRequest - ScoreBatchRequest
- ScoreBatchResponse - ScoreBatchResponse
@ -5503,7 +5485,6 @@ x-tagGroups:
- SpanStartPayload - SpanStartPayload
- SpanStatus - SpanStatus
- SpanWithStatus - SpanWithStatus
- StopReason
- StringType - StringType
- StructuredLogEvent - StructuredLogEvent
- StructuredLogPayload - StructuredLogPayload
@ -5517,8 +5498,6 @@ x-tagGroups:
- Tool - Tool
- ToolCall - ToolCall
- ToolCallDelta - ToolCallDelta
- ToolCallParseStatus
- ToolChoice
- ToolDef - ToolDef
- ToolDefinition - ToolDefinition
- ToolExecutionStep - ToolExecutionStep
@ -5527,7 +5506,6 @@ x-tagGroups:
- ToolInvocationResult - ToolInvocationResult
- ToolParamDefinition - ToolParamDefinition
- ToolParameter - ToolParameter
- ToolPromptFormat
- ToolResponse - ToolResponse
- ToolResponseMessage - ToolResponseMessage
- TopKSamplingStrategy - TopKSamplingStrategy

View file

@ -77,7 +77,6 @@ class ImageDelta(BaseModel):
image: bytes image: bytes
@json_schema_type
class ToolCallParseStatus(Enum): class ToolCallParseStatus(Enum):
started = "started" started = "started"
in_progress = "in_progress" in_progress = "in_progress"

View file

@ -43,7 +43,6 @@ class LogProbConfig(BaseModel):
top_k: Optional[int] = 0 top_k: Optional[int] = 0
@json_schema_type
class QuantizationType(Enum): class QuantizationType(Enum):
"""Type of model quantization to run inference with. """Type of model quantization to run inference with.
@ -177,7 +176,6 @@ class ToolResponse(BaseModel):
return v return v
@json_schema_type
class ToolChoice(Enum): class ToolChoice(Enum):
"""Whether tool use is required or automatic. This is a hint to the model which may not be followed. It depends on the Instruction Following capabilities of the model. """Whether tool use is required or automatic. This is a hint to the model which may not be followed. It depends on the Instruction Following capabilities of the model.
@ -199,7 +197,6 @@ class TokenLogProbs(BaseModel):
logprobs_by_token: Dict[str, float] logprobs_by_token: Dict[str, float]
@json_schema_type
class ChatCompletionResponseEventType(Enum): class ChatCompletionResponseEventType(Enum):
"""Types of events that can occur during chat completion. """Types of events that can occur during chat completion.
@ -229,7 +226,6 @@ class ChatCompletionResponseEvent(BaseModel):
stop_reason: Optional[StopReason] = None stop_reason: Optional[StopReason] = None
@json_schema_type
class ResponseFormatType(Enum): class ResponseFormatType(Enum):
"""Types of formats for structured (guided) decoding. """Types of formats for structured (guided) decoding.

View file

@ -6,11 +6,9 @@
from enum import Enum from enum import Enum
from llama_models.schema_utils import json_schema_type
from pydantic import BaseModel, Field from pydantic import BaseModel, Field
@json_schema_type
class ResourceType(Enum): class ResourceType(Enum):
model = "model" model = "model"
shield = "shield" shield = "shield"