From 1f173678896aab58fc70c708bc3dd3530bf69849 Mon Sep 17 00:00:00 2001 From: Adam Grieger Date: Fri, 30 Aug 2024 10:52:27 -0700 Subject: [PATCH] feat: update text gen spec (#99) --- fern/apis/text-gen/openapi/openapi.json | 317 ++++++++++++++++++++---- 1 file changed, 275 insertions(+), 42 deletions(-) diff --git a/fern/apis/text-gen/openapi/openapi.json b/fern/apis/text-gen/openapi/openapi.json index 01e5646..fe6840c 100644 --- a/fern/apis/text-gen/openapi/openapi.json +++ b/fern/apis/text-gen/openapi/openapi.json @@ -88,7 +88,11 @@ "const": "chat.completion.chunk", "default": "chat.completion.chunk", "description": "Object type field which is a constant and preset.", - "title": "Object" + "enum": [ + "chat.completion.chunk" + ], + "title": "Object", + "type": "string" }, "usage": { "anyOf": [ @@ -187,7 +191,7 @@ "anyOf": [ { "items": { - "$ref": "#/components/schemas/ToolCall" + "$ref": "#/components/schemas/ChatCompletionDeltaToolCall" }, "type": "array" }, @@ -202,6 +206,92 @@ "title": "ChatCompletionDelta", "type": "object" }, + "ChatCompletionDeltaToolCall": { + "description": "A single delta representing one partial piece of a tool call.\n\nToday this only supports function calls, but the schema supports\nindirection for different tool calls in the future.", + "properties": { + "function": { + "anyOf": [ + { + "$ref": "#/components/schemas/ChatCompletionDeltaToolCallFunction" + }, + { + "type": "null" + } + ], + "description": "The delta of the function call generated by the model." + }, + "id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "The ID of the tool call.", + "title": "Id" + }, + "index": { + "description": "The sequence index of the tool call.", + "title": "Index", + "type": "integer" + }, + "type": { + "anyOf": [ + { + "const": "function", + "enum": [ + "function" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "default": "function", + "description": "The type of tool. Today only `function` is supported.", + "title": "Type" + } + }, + "required": [ + "index" + ], + "title": "ChatCompletionDeltaToolCall", + "type": "object" + }, + "ChatCompletionDeltaToolCallFunction": { + "description": "A single delta representing one partial piece of a \"function\" tool call.\n\nIt can contain part of the arguments, the name of the function, or both.", + "properties": { + "arguments": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "A partial chunk of the arguments to call the function with.", + "title": "Arguments" + }, + "name": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "A partial chunk of the function name to call.", + "title": "Name" + } + }, + "title": "ChatCompletionDeltaToolCallFunction", + "type": "object" + }, "ChatCompletionResponse": { "description": "An OpenAI API compatible schema for a chat completion response object.", "examples": [ @@ -248,7 +338,11 @@ "const": "chat.completion", "default": "chat.completion", "description": "Object type field which is a constant and preset.", - "title": "Object" + "enum": [ + "chat.completion" + ], + "title": "Object", + "type": "string" }, "usage": { "allOf": [ @@ -304,6 +398,26 @@ { "type": "string" }, + { + "items": { + "discriminator": { + "mapping": { + "image_url": "#/components/schemas/MultiModalImageMessage", + "text": "#/components/schemas/MultiModalTextMessage" + }, + "propertyName": "type" + }, + "oneOf": [ + { + "$ref": "#/components/schemas/MultiModalImageMessage" + }, + { + "$ref": "#/components/schemas/MultiModalTextMessage" + } + ] + }, + "type": "array" + }, { "type": "null" } @@ -424,7 +538,11 @@ "const": "text_completion", "default": "text_completion", "description": "Object type field which is a constant and preset.", - "title": "Object" + "enum": [ + "text_completion" + ], + "title": "Object", + "type": "string" }, "system_fingerprint": { "description": "The system response fingerprint.", @@ -488,6 +606,12 @@ "title": "Ignore Eos", "type": "boolean" }, + "log_prompt": { + "default": false, + "description": "OctoAI stores request prompt if True.", + "title": "Log Prompt", + "type": "boolean" + }, "logit_bias": { "anyOf": [ { @@ -530,8 +654,16 @@ "title": "Messages", "type": "array" }, + "min_p": { + "default": 0.0, + "description": "Sets a dynamic threshold of the top tokens to consider based on the probability value of the most likely next token. Following https://arxiv.org/abs/2407.01082.", + "maximum": 1.0, + "minimum": 0.0, + "title": "Min P", + "type": "number" + }, "model": { - "description": "The identifier of the model to use.Can be a shared tenancy or custom model identifier.", + "description": "The identifier of the model to use. Can be a shared tenancy or custom model identifier.", "title": "Model", "type": "string" }, @@ -608,12 +740,9 @@ "type": "boolean" }, "stream_options": { - "anyOf": [ + "allOf": [ { "$ref": "#/components/schemas/StreamOptions" - }, - { - "type": "null" } ], "description": "If set, usageStats will be streamed on the last content-containing chunk." @@ -629,10 +758,18 @@ "tool_choice": { "anyOf": [ { - "const": "auto" + "const": "auto", + "enum": [ + "auto" + ], + "type": "string" }, { - "const": "required" + "const": "required", + "enum": [ + "required" + ], + "type": "string" }, { "$ref": "#/components/schemas/FunctionChoice" @@ -641,6 +778,7 @@ "type": "null" } ], + "default": "auto", "description": "Controls which (if any) tool is called by the model. none means the model will not call any tool and instead generates a message. auto means the model can pick between generating a message or calling one or more tools. required means the model must call one or more tools. Specifying a particular tool via {\"type\": \"function\", \"function\": {\"name\": \"my_function\"}} forces the model to call that tool. none is the default when no tools are present. auto is the default if tools are present.", "title": "Tool Choice" }, @@ -722,6 +860,12 @@ "title": "Ignore Eos", "type": "boolean" }, + "log_prompt": { + "default": false, + "description": "OctoAI stores request prompt if True.", + "title": "Log Prompt", + "type": "boolean" + }, "logit_bias": { "anyOf": [ { @@ -734,12 +878,12 @@ "type": "null" } ], - "description": "Modify the likelihood of specified tokens appearing in the completion.", + "description": "Modify the likelihood of specified tokens appearing in the completion. Accepts a JSON object that maps tokens (specified by their token ID in the tokenizer) to an associated bias value from -100 to 100. Mathematically, the bias is added to the logits generated by the model prior to sampling. The exact effect will vary per model, but values between -1 and 1 should decrease or increase likelihood of selection; values like -100 or 100 should result in a ban or exclusive selection of the relevant token. As an example, you can pass {'50256': -100} to prevent the <|endoftext|> token from being generated.", "title": "Logit Bias" }, "loglikelihood": { "default": false, - "description": "Switch on loglikelihood regime and return log probabilities from all prompt tokens from prefill.", + "description": "Return log probabilities for all prompt tokens excluding the first one from prefill step if True.", "title": "Loglikelihood", "type": "boolean" }, @@ -758,14 +902,22 @@ "title": "Logprobs" }, "max_tokens": { - "default": 16, + "default": 512, "description": "Maximum number of tokens to generate per output sequence.", "minimum": 1.0, "title": "Max Tokens", "type": "integer" }, + "min_p": { + "default": 0.0, + "description": "Sets a dynamic threshold of the top tokens to consider based on the probability value of the most likely next token. Following https://arxiv.org/abs/2407.01082.", + "maximum": 1.0, + "minimum": 0.0, + "title": "Min P", + "type": "number" + }, "model": { - "description": "Model name to use for completion.", + "description": "The identifier of the model to use. Can be a shared tenancy or custom model identifier.", "title": "Model", "type": "string" }, @@ -860,7 +1012,7 @@ "type": "null" } ], - "description": "Strings that stop the generation when they are generated.", + "description": "Generation stop condition.", "title": "Stop" }, "stream": { @@ -870,12 +1022,9 @@ "type": "boolean" }, "stream_options": { - "anyOf": [ + "allOf": [ { "$ref": "#/components/schemas/StreamOptions" - }, - { - "type": "null" } ], "description": "If set, usageStats will be streamed on the last content-containing chunk." @@ -952,7 +1101,11 @@ "const": "error", "default": "error", "description": "The object type, always error.", - "title": "Object" + "enum": [ + "error" + ], + "title": "Object", + "type": "string" }, "param": { "anyOf": [ @@ -1048,7 +1201,11 @@ "const": "function", "default": "function", "description": "The type of tool. Today only `function` is supported.", - "title": "Type" + "enum": [ + "function" + ], + "title": "Type", + "type": "string" } }, "required": [ @@ -1061,16 +1218,10 @@ "description": "A definition of a function to call in tool use.", "properties": { "description": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], + "default": "", "description": "A description of what the function does. This can used by the model to choose when and how to call the function.", - "title": "Description" + "title": "Description", + "type": "string" }, "name": { "description": "The name of the function to be defined.", @@ -1078,16 +1229,9 @@ "type": "string" }, "parameters": { - "anyOf": [ - { - "type": "object" - }, - { - "type": "null" - } - ], "description": "The parameters the function accepts described as a JSON Schema.", - "title": "Parameters" + "title": "Parameters", + "type": "object" } }, "required": [ @@ -1126,6 +1270,33 @@ "title": "HTTPValidationError", "type": "object" }, + "ImageURL": { + "description": "Image URL for multi modal messages.", + "properties": { + "detail": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Specifies the detail level of the image.", + "title": "Detail" + }, + "url": { + "description": "Either a URL of the image or base64 encoded image data.", + "title": "Url", + "type": "string" + } + }, + "required": [ + "url" + ], + "title": "ImageURL", + "type": "object" + }, "Logprobs": { "description": "An OpenAI API compatible schema for logprobs output.\nSee details in `https://platform.openai.com/docs/api-reference/chat/object#chat-create-logprobs`.", "properties": { @@ -1190,6 +1361,59 @@ "title": "LogprobsContent", "type": "object" }, + "MultiModalImageMessage": { + "description": "Multi modal image message.", + "properties": { + "image_url": { + "allOf": [ + { + "$ref": "#/components/schemas/ImageURL" + } + ], + "description": "The image URL which could be either a URL or base64 encoded image data." + }, + "type": { + "const": "image_url", + "default": "image_url", + "description": "The type of the content part.", + "enum": [ + "image_url" + ], + "title": "Type", + "type": "string" + } + }, + "required": [ + "image_url" + ], + "title": "MultiModalImageMessage", + "type": "object" + }, + "MultiModalTextMessage": { + "description": "Multi modal text message.", + "properties": { + "text": { + "description": "The text content of an multimodal message.", + "title": "Text", + "type": "string" + }, + "type": { + "const": "text", + "default": "text", + "description": "The type of the content part.", + "enum": [ + "text" + ], + "title": "Type", + "type": "string" + } + }, + "required": [ + "text" + ], + "title": "MultiModalTextMessage", + "type": "object" + }, "StreamOptions": { "description": "Streaming options for the request.", "properties": { @@ -1223,7 +1447,11 @@ "const": "function", "default": "function", "description": "The type of tool. Today only `function` is supported.", - "title": "Type" + "enum": [ + "function" + ], + "title": "Type", + "type": "string" } }, "required": [ @@ -1247,7 +1475,11 @@ "const": "function", "default": "function", "description": "The type of tool. Today only `function` is supported.", - "title": "Type" + "enum": [ + "function" + ], + "title": "Type", + "type": "string" } }, "required": [ @@ -1445,6 +1677,7 @@ }, "/v1/completions": { "post": { + "description": "Create a Completion.", "operationId": "create_completion_v1_completions_post", "requestBody": { "content": {