From d782e232900c7db381141c61a41b408a1391a10a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Istv=C3=A1n=20Zolt=C3=A1n=20Szab=C3=B3?= Date: Wed, 4 Jun 2025 11:33:31 +0200 Subject: [PATCH 1/2] Completes chat completion inference endpoint docs. --- specification/inference/_types/CommonTypes.ts | 77 ++++++++++++++++++- .../PutAmazonBedrockRequest.ts | 2 +- .../put_mistral/PutMistralRequest.ts | 2 +- 3 files changed, 76 insertions(+), 5 deletions(-) diff --git a/specification/inference/_types/CommonTypes.ts b/specification/inference/_types/CommonTypes.ts index 5c0757abd2..8846b7d812 100644 --- a/specification/inference/_types/CommonTypes.ts +++ b/specification/inference/_types/CommonTypes.ts @@ -47,10 +47,47 @@ export class RequestChatCompletion { temperature?: float /** * Controls which tool is called by the model. + * String representation: One of `auto`, `none`, or `requrired`. `auto` allows the model to choose between calling tools and generating a message. `none` causes the model to not call any tools. `required` forces the model to call one or more tools. + * Example (object representation): + * ``` + * { + * "tool_choice": { + * "type": "function", + * "function": { + * "name": "get_current_weather" + * } + * } + * } + * ``` */ tool_choice?: CompletionToolType /** * A list of tools that the model can call. + * Example: + * ``` + * { + * "tools": [ + * { + * "type": "function", + * "function": { + * "name": "get_price_of_item", + * "description": "Get the current price of an item", + * "parameters": { + * "type": "object", + * "properties": { + * "item": { + * "id": "12345" + * }, + * "unit": { + * "type": "currency" + * } + * } + * } + * } + * } + * ] + * } + * ``` */ tools?: Array /** @@ -140,18 +177,52 @@ export type MessageContent = string | Array export interface Message { /** * The content of the message. + * + * String example: + * ``` + * { + * "content": "Some string" + * } + * ``` + * + * Object example: + * ``` + * { + * "content": [ + * { + * "text": "Some text", + * "type": "text" + * } + * ] + * } + * ``` */ content?: MessageContent /** - * The role of the message author. + * The role of the message author. Valid values are `user`, `assistant`, `system`, and `tool`. */ role: string /** - * The tool call that this message is responding to. + * Only for `tool` role messages. The tool call that this message is responding to. */ tool_call_id?: Id /** - * The tool calls generated by the model. + * Only for `assistant` role messages. The tool calls generated by the model. If it's specified, the `content` field is optional. + * Example: + * ``` + * { + * "tool_calls": [ + * { + * "id": "call_KcAjWtAww20AihPHphUh46Gd", + * "type": "function", + * "function": { + * "name": "get_current_weather", + * "arguments": "{\"location\":\"Boston, MA\"}" + * } + * } + * ] + * } + * ``` */ tool_calls?: Array } diff --git a/specification/inference/put_amazonbedrock/PutAmazonBedrockRequest.ts b/specification/inference/put_amazonbedrock/PutAmazonBedrockRequest.ts index 17d8060953..427bcf8e1b 100644 --- a/specification/inference/put_amazonbedrock/PutAmazonBedrockRequest.ts +++ b/specification/inference/put_amazonbedrock/PutAmazonBedrockRequest.ts @@ -30,7 +30,7 @@ import { Id } from '@_types/common' /** * Create an Amazon Bedrock inference endpoint. * - * Creates an inference endpoint to perform an inference task with the `amazonbedrock` service. + * Create an inference endpoint to perform an inference task with the `amazonbedrock` service. * * >info * > You need to provide the access and secret keys only once, during the inference model creation. The get inference API does not retrieve your access or secret keys. After creating the inference model, you cannot change the associated key pairs. If you want to use a different access and secret key pair, delete the inference model and recreate it with the same name and the updated keys. diff --git a/specification/inference/put_mistral/PutMistralRequest.ts b/specification/inference/put_mistral/PutMistralRequest.ts index 835e35eb25..7e1aa9ae9e 100644 --- a/specification/inference/put_mistral/PutMistralRequest.ts +++ b/specification/inference/put_mistral/PutMistralRequest.ts @@ -29,7 +29,7 @@ import { Id } from '@_types/common' /** * Create a Mistral inference endpoint. * - * Creates an inference endpoint to perform an inference task with the `mistral` service. + * Create an inference endpoint to perform an inference task with the `mistral` service. * @rest_spec_name inference.put_mistral * @availability stack since=8.15.0 stability=stable visibility=public * @availability serverless stability=stable visibility=public From b34a5b7d57fb76038de2505332062646f5b51d72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Istv=C3=A1n=20Zolt=C3=A1n=20Szab=C3=B3?= Date: Wed, 4 Jun 2025 12:12:32 +0200 Subject: [PATCH 2/2] Fixes format. --- specification/inference/_types/CommonTypes.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/specification/inference/_types/CommonTypes.ts b/specification/inference/_types/CommonTypes.ts index 8846b7d812..cf1f842223 100644 --- a/specification/inference/_types/CommonTypes.ts +++ b/specification/inference/_types/CommonTypes.ts @@ -177,14 +177,14 @@ export type MessageContent = string | Array export interface Message { /** * The content of the message. - * + * * String example: * ``` * { * "content": "Some string" * } * ``` - * + * * Object example: * ``` * {