mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-07-22 12:37:53 +00:00
making the API python based with a converter script
This commit is contained in:
parent
1a2b17af7f
commit
722d20c6de
5 changed files with 1565 additions and 0 deletions
492
source/openapi.yaml
Normal file
492
source/openapi.yaml
Normal file
|
@ -0,0 +1,492 @@
|
|||
components:
|
||||
responses: {}
|
||||
schemas:
|
||||
Attachment:
|
||||
additionalProperties: false
|
||||
properties:
|
||||
mime_type:
|
||||
type: string
|
||||
url:
|
||||
$ref: '#/components/schemas/URL'
|
||||
required:
|
||||
- url
|
||||
- mime_type
|
||||
title: Attachments are used to refer to external resources, such as images,
|
||||
videos, audio, etc.
|
||||
type: object
|
||||
ChatCompletionRequest:
|
||||
additionalProperties: false
|
||||
properties:
|
||||
logprobs:
|
||||
default: false
|
||||
type: boolean
|
||||
max_tokens:
|
||||
default: 0
|
||||
type: integer
|
||||
message:
|
||||
$ref: '#/components/schemas/Message'
|
||||
message_history:
|
||||
items:
|
||||
$ref: '#/components/schemas/Message'
|
||||
type: array
|
||||
model:
|
||||
default: llama3_8b_chat
|
||||
enum:
|
||||
- llama3_8b_chat
|
||||
- llama3_70b_chat
|
||||
type: string
|
||||
sampling_params:
|
||||
additionalProperties: false
|
||||
properties:
|
||||
strategy:
|
||||
default: greedy
|
||||
type: string
|
||||
temperature:
|
||||
default: 0.0
|
||||
type: number
|
||||
top_k:
|
||||
default: 0
|
||||
type: integer
|
||||
top_p:
|
||||
default: 0.95
|
||||
type: number
|
||||
required:
|
||||
- temperature
|
||||
- strategy
|
||||
- top_p
|
||||
- top_k
|
||||
type: object
|
||||
stream:
|
||||
default: false
|
||||
type: boolean
|
||||
required:
|
||||
- message
|
||||
- message_history
|
||||
- model
|
||||
- sampling_params
|
||||
- max_tokens
|
||||
- stream
|
||||
- logprobs
|
||||
type: object
|
||||
ChatCompletionResponse:
|
||||
additionalProperties: false
|
||||
properties:
|
||||
content:
|
||||
oneOf:
|
||||
- type: string
|
||||
- $ref: '#/components/schemas/Attachment'
|
||||
- items:
|
||||
oneOf:
|
||||
- type: string
|
||||
- $ref: '#/components/schemas/Attachment'
|
||||
type: array
|
||||
logprobs:
|
||||
additionalProperties:
|
||||
oneOf:
|
||||
- type: 'null'
|
||||
- type: boolean
|
||||
- type: number
|
||||
- type: string
|
||||
- type: array
|
||||
- type: object
|
||||
type: object
|
||||
stop_reason:
|
||||
enum:
|
||||
- not_stopped
|
||||
- finished_ok
|
||||
- max_tokens
|
||||
title: Stop reasons are used to indicate why the model stopped generating
|
||||
text.
|
||||
type: string
|
||||
tool_calls:
|
||||
items:
|
||||
additionalProperties: false
|
||||
properties:
|
||||
arguments:
|
||||
additionalProperties:
|
||||
oneOf:
|
||||
- type: 'null'
|
||||
- type: boolean
|
||||
- type: number
|
||||
- type: string
|
||||
- type: array
|
||||
- type: object
|
||||
type: object
|
||||
tool_name:
|
||||
type: string
|
||||
required:
|
||||
- tool_name
|
||||
- arguments
|
||||
title: A tool call is a request to a tool.
|
||||
type: object
|
||||
type: array
|
||||
required:
|
||||
- content
|
||||
- stop_reason
|
||||
- tool_calls
|
||||
title: Normal chat completion response.
|
||||
type: object
|
||||
CompletionRequest:
|
||||
additionalProperties: false
|
||||
properties:
|
||||
content:
|
||||
oneOf:
|
||||
- type: string
|
||||
- $ref: '#/components/schemas/Attachment'
|
||||
- items:
|
||||
oneOf:
|
||||
- type: string
|
||||
- $ref: '#/components/schemas/Attachment'
|
||||
type: array
|
||||
logprobs:
|
||||
default: false
|
||||
type: boolean
|
||||
max_tokens:
|
||||
default: 0
|
||||
type: integer
|
||||
model:
|
||||
default: llama3_8b
|
||||
enum:
|
||||
- llama3_8b
|
||||
- llama3_70b
|
||||
type: string
|
||||
sampling_params:
|
||||
additionalProperties: false
|
||||
properties:
|
||||
strategy:
|
||||
default: greedy
|
||||
type: string
|
||||
temperature:
|
||||
default: 0.0
|
||||
type: number
|
||||
top_k:
|
||||
default: 0
|
||||
type: integer
|
||||
top_p:
|
||||
default: 0.95
|
||||
type: number
|
||||
required:
|
||||
- temperature
|
||||
- strategy
|
||||
- top_p
|
||||
- top_k
|
||||
type: object
|
||||
stream:
|
||||
default: false
|
||||
type: boolean
|
||||
required:
|
||||
- content
|
||||
- model
|
||||
- sampling_params
|
||||
- max_tokens
|
||||
- stream
|
||||
- logprobs
|
||||
type: object
|
||||
CompletionResponse:
|
||||
additionalProperties: false
|
||||
properties:
|
||||
content:
|
||||
oneOf:
|
||||
- type: string
|
||||
- $ref: '#/components/schemas/Attachment'
|
||||
- items:
|
||||
oneOf:
|
||||
- type: string
|
||||
- $ref: '#/components/schemas/Attachment'
|
||||
type: array
|
||||
logprobs:
|
||||
additionalProperties:
|
||||
oneOf:
|
||||
- type: 'null'
|
||||
- type: boolean
|
||||
- type: number
|
||||
- type: string
|
||||
- type: array
|
||||
- type: object
|
||||
type: object
|
||||
stop_reason:
|
||||
enum:
|
||||
- not_stopped
|
||||
- finished_ok
|
||||
- max_tokens
|
||||
title: Stop reasons are used to indicate why the model stopped generating
|
||||
text.
|
||||
type: string
|
||||
required:
|
||||
- content
|
||||
- stop_reason
|
||||
title: Normal completion response.
|
||||
type: object
|
||||
Message:
|
||||
additionalProperties: false
|
||||
properties:
|
||||
content:
|
||||
oneOf:
|
||||
- type: string
|
||||
- $ref: '#/components/schemas/Attachment'
|
||||
- items:
|
||||
oneOf:
|
||||
- type: string
|
||||
- $ref: '#/components/schemas/Attachment'
|
||||
type: array
|
||||
role:
|
||||
enum:
|
||||
- system
|
||||
- user
|
||||
- assistant
|
||||
- tool
|
||||
type: string
|
||||
tool_calls:
|
||||
items:
|
||||
additionalProperties: false
|
||||
properties:
|
||||
arguments:
|
||||
additionalProperties:
|
||||
oneOf:
|
||||
- type: 'null'
|
||||
- type: boolean
|
||||
- type: number
|
||||
- type: string
|
||||
- type: array
|
||||
- type: object
|
||||
type: object
|
||||
tool_name:
|
||||
type: string
|
||||
required:
|
||||
- tool_name
|
||||
- arguments
|
||||
title: A tool call is a request to a tool.
|
||||
type: object
|
||||
type: array
|
||||
tool_definitions:
|
||||
items:
|
||||
additionalProperties: false
|
||||
properties:
|
||||
parameters:
|
||||
additionalProperties:
|
||||
oneOf:
|
||||
- type: 'null'
|
||||
- type: boolean
|
||||
- type: number
|
||||
- type: string
|
||||
- type: array
|
||||
- type: object
|
||||
type: object
|
||||
tool_name:
|
||||
type: string
|
||||
required:
|
||||
- tool_name
|
||||
- parameters
|
||||
type: object
|
||||
type: array
|
||||
tool_responses:
|
||||
items:
|
||||
additionalProperties: false
|
||||
properties:
|
||||
response:
|
||||
type: string
|
||||
tool_name:
|
||||
type: string
|
||||
required:
|
||||
- tool_name
|
||||
- response
|
||||
type: object
|
||||
type: array
|
||||
required:
|
||||
- role
|
||||
- content
|
||||
- tool_definitions
|
||||
- tool_calls
|
||||
- tool_responses
|
||||
type: object
|
||||
StreamedChatCompletionResponse:
|
||||
additionalProperties: false
|
||||
properties:
|
||||
stop_reason:
|
||||
enum:
|
||||
- not_stopped
|
||||
- finished_ok
|
||||
- max_tokens
|
||||
title: Stop reasons are used to indicate why the model stopped generating
|
||||
text.
|
||||
type: string
|
||||
text_delta:
|
||||
type: string
|
||||
tool_call:
|
||||
additionalProperties: false
|
||||
properties:
|
||||
arguments:
|
||||
additionalProperties:
|
||||
oneOf:
|
||||
- type: 'null'
|
||||
- type: boolean
|
||||
- type: number
|
||||
- type: string
|
||||
- type: array
|
||||
- type: object
|
||||
type: object
|
||||
tool_name:
|
||||
type: string
|
||||
required:
|
||||
- tool_name
|
||||
- arguments
|
||||
title: A tool call is a request to a tool.
|
||||
type: object
|
||||
required:
|
||||
- text_delta
|
||||
- stop_reason
|
||||
title: Streamed chat completion response.
|
||||
type: object
|
||||
StreamedCompletionResponse:
|
||||
additionalProperties: false
|
||||
properties:
|
||||
logprobs:
|
||||
additionalProperties:
|
||||
oneOf:
|
||||
- type: 'null'
|
||||
- type: boolean
|
||||
- type: number
|
||||
- type: string
|
||||
- type: array
|
||||
- type: object
|
||||
type: object
|
||||
stop_reason:
|
||||
enum:
|
||||
- not_stopped
|
||||
- finished_ok
|
||||
- max_tokens
|
||||
title: Stop reasons are used to indicate why the model stopped generating
|
||||
text.
|
||||
type: string
|
||||
text_delta:
|
||||
type: string
|
||||
required:
|
||||
- text_delta
|
||||
- stop_reason
|
||||
title: streamed completion response.
|
||||
type: object
|
||||
URL:
|
||||
format: uri
|
||||
pattern: ^(https?://|file://|data:)
|
||||
type: string
|
||||
info:
|
||||
description: This is the llama stack
|
||||
title: Llama Stack specification
|
||||
version: '0.1'
|
||||
jsonSchemaDialect: https://json-schema.org/draft/2020-12/schema
|
||||
openapi: 3.1.0
|
||||
paths:
|
||||
/agentic/system/execute:
|
||||
get:
|
||||
parameters: []
|
||||
responses:
|
||||
'200':
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: string
|
||||
description: OK
|
||||
tags:
|
||||
- AgenticSystem
|
||||
/chat_completion:
|
||||
post:
|
||||
parameters: []
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ChatCompletionRequest'
|
||||
required: true
|
||||
responses:
|
||||
'200':
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
oneOf:
|
||||
- $ref: '#/components/schemas/ChatCompletionResponse'
|
||||
- $ref: '#/components/schemas/StreamedChatCompletionResponse'
|
||||
description: Normal chat completion response. **OR** Streamed chat completion
|
||||
response.
|
||||
tags:
|
||||
- Inference
|
||||
/completion:
|
||||
post:
|
||||
parameters: []
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/CompletionRequest'
|
||||
required: true
|
||||
responses:
|
||||
'200':
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
oneOf:
|
||||
- $ref: '#/components/schemas/CompletionResponse'
|
||||
- $ref: '#/components/schemas/StreamedCompletionResponse'
|
||||
description: Normal completion response. **OR** streamed completion response.
|
||||
tags:
|
||||
- Inference
|
||||
security:
|
||||
- Default: []
|
||||
servers:
|
||||
- url: http://llama.meta.com
|
||||
tags:
|
||||
- name: AgenticSystem
|
||||
- name: Inference
|
||||
- description: 'Attachments are used to refer to external resources, such as images,
|
||||
videos, audio, etc.
|
||||
|
||||
|
||||
<SchemaDefinition schemaRef="#/components/schemas/Attachment" />'
|
||||
name: Attachment
|
||||
- description: <SchemaDefinition schemaRef="#/components/schemas/ChatCompletionRequest"
|
||||
/>
|
||||
name: ChatCompletionRequest
|
||||
- description: <SchemaDefinition schemaRef="#/components/schemas/Message" />
|
||||
name: Message
|
||||
- description: <SchemaDefinition schemaRef="#/components/schemas/URL" />
|
||||
name: URL
|
||||
- description: 'Normal chat completion response.
|
||||
|
||||
|
||||
<SchemaDefinition schemaRef="#/components/schemas/ChatCompletionResponse" />'
|
||||
name: ChatCompletionResponse
|
||||
- description: 'Streamed chat completion response.
|
||||
|
||||
|
||||
<SchemaDefinition schemaRef="#/components/schemas/StreamedChatCompletionResponse"
|
||||
/>'
|
||||
name: StreamedChatCompletionResponse
|
||||
- description: <SchemaDefinition schemaRef="#/components/schemas/CompletionRequest"
|
||||
/>
|
||||
name: CompletionRequest
|
||||
- description: 'Normal completion response.
|
||||
|
||||
|
||||
<SchemaDefinition schemaRef="#/components/schemas/CompletionResponse" />'
|
||||
name: CompletionResponse
|
||||
- description: 'streamed completion response.
|
||||
|
||||
|
||||
<SchemaDefinition schemaRef="#/components/schemas/StreamedCompletionResponse"
|
||||
/>'
|
||||
name: StreamedCompletionResponse
|
||||
x-tagGroups:
|
||||
- name: Operations
|
||||
tags:
|
||||
- AgenticSystem
|
||||
- Inference
|
||||
- name: Types
|
||||
tags:
|
||||
- Attachment
|
||||
- ChatCompletionRequest
|
||||
- ChatCompletionResponse
|
||||
- CompletionRequest
|
||||
- CompletionResponse
|
||||
- Message
|
||||
- StreamedChatCompletionResponse
|
||||
- StreamedCompletionResponse
|
||||
- URL
|
Loading…
Add table
Add a link
Reference in a new issue