Skip to content

Commit

Permalink
chore: remove openai JSON schema (instill-ai#260)
Browse files Browse the repository at this point in the history
Because

- Previously, we downloaded the OpenAPI schema from OpenAI and
referenced it, but this approach isn't ideal as some descriptions might
differ.

This commit

- Removes the OpenAI JSON schema and directly writes the schema in our
JSON schema.
  • Loading branch information
donch1989 authored Jul 30, 2024
1 parent 4aeae69 commit 4426596
Show file tree
Hide file tree
Showing 4 changed files with 182 additions and 8,139 deletions.
18 changes: 9 additions & 9 deletions ai/openai/v0/README.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,18 @@ Provide text outputs in response to their inputs.
| Input | ID | Type | Description |
| :--- | :--- | :--- | :--- |
| Task ID (required) | `task` | string | `TASK_TEXT_GENERATION` |
| Model (required) | `model` | string | ID of the model to use. See the <a href="/docs/models/model-endpoint-compatibility">model endpoint compatibility</a> table for details on which models work with the Chat API. |
| Model (required) | `model` | string | ID of the model to use. |
| Prompt (required) | `prompt` | string | The prompt text |
| System message | `system-message` | string | The system message helps set the behavior of the assistant. For example, you can modify the personality of the assistant or provide specific instructions about how it should behave throughout the conversation. By default, the model’s behavior is using a generic message as "You are a helpful assistant." |
| Image | `images` | array[string] | The images |
| Chat history | `chat-history` | array[object] | Incorporate external chat history, specifically previous messages within the conversation. Please note that System Message will be ignored and will not have any effect when this field is populated. Each message should adhere to the format \{"role": "The message role, i.e. 'system', 'user' or 'assistant'", "content": "message content"\}. |
| Temperature | `temperature` | number | What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. We generally recommend altering this or `top_p` but not both. |
| Temperature | `temperature` | number | What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. We generally recommend altering this or `top-p` but not both. |
| N | `n` | integer | How many chat completion choices to generate for each input message. Note that you will be charged based on the number of generated tokens across all of the choices. Keep `n` as `1` to minimize costs. |
| Max Tokens | `max-tokens` | integer | The maximum number of <a href="/tokenizer">tokens</a> that can be generated in the chat completion. The total length of input tokens and generated tokens is limited by the model's context length. <a href="https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken">Example Python code</a> for counting tokens. |
| Max Tokens | `max-tokens` | integer | The maximum number of tokens that can be generated in the chat completion. The total length of input tokens and generated tokens is limited by the model's context length. |
| Response Format | `response-format` | object | An object specifying the format that the model must output. Used to enable JSON mode. |
| Top P | `top-p` | number | An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We generally recommend altering this or `temperature` but not both. |
| Presence Penalty | `presence-penalty` | number | Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics. <a href="/docs/guides/text-generation/parameter-details">See more information about frequency and presence penalties.</a> |
| Frequency Penalty | `frequency-penalty` | number | Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim. <a href="/docs/guides/text-generation/parameter-details">See more information about frequency and presence penalties.<a/> |
| Presence Penalty | `presence-penalty` | number | Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics. |
| Frequency Penalty | `frequency-penalty` | number | Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim. |



Expand All @@ -83,7 +83,7 @@ Turn text into numbers, unlocking use cases like search.
| Input | ID | Type | Description |
| :--- | :--- | :--- | :--- |
| Task ID (required) | `task` | string | `TASK_TEXT_EMBEDDINGS` |
| Model (required) | `model` | string | ID of the model to use. You can use the <a href="/docs/api-reference/models/list">List models</a> API to see all of your available models, or see our <a href="/docs/models/overview">Model overview</a> for descriptions of them. |
| Model (required) | `model` | string | ID of the model to use. |
| Text (required) | `text` | string | The text |
| Dimensions | `dimensions` | integer | The number of dimensions the resulting output embeddings should have. Only supported in text-embedding-3 and later models. |

Expand All @@ -108,7 +108,7 @@ Turn audio into text.
| Task ID (required) | `task` | string | `TASK_SPEECH_RECOGNITION` |
| Model (required) | `model` | string | ID of the model to use. Only `whisper-1` is currently available. |
| Audio (required) | `audio` | string | The audio file object (not file name) to transcribe, in one of these formats: flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm. |
| Prompt | `prompt` | string | An optional text to guide the model's style or continue a previous audio segment. The <a href="/docs/guides/speech-to-text/prompting">prompt</a> should match the audio language. |
| Prompt | `prompt` | string | An optional text to guide the model's style or continue a previous audio segment. The prompt should match the audio language. |
| Language | `language` | string | The language of the input audio. Supplying the input language in <a href="https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes">ISO-639-1</a> format will improve accuracy and latency. |
| Temperature | `temperature` | number | The sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use <a href="https://en.wikipedia.org/wiki/Log_probability">log probability</a> to automatically increase the temperature until certain thresholds are hit. |

Expand All @@ -131,9 +131,9 @@ Turn text into lifelike spoken audio
| Input | ID | Type | Description |
| :--- | :--- | :--- | :--- |
| Task ID (required) | `task` | string | `TASK_TEXT_TO_SPEECH` |
| Model (required) | `model` | string | One of the available <a href="/docs/models/tts">TTS models</a>: `tts-1` or `tts-1-hd` |
| Model (required) | `model` | string | One of the available TTS models: `tts-1` or `tts-1-hd` |
| Text (required) | `text` | string | The text to generate audio for. The maximum length is 4096 characters. |
| Voice (required) | `voice` | string | The voice to use when generating the audio. Supported voices are `alloy`, `echo`, `fable`, `onyx`, `nova`, and `shimmer`. Previews of the voices are available in the <a href="/docs/guides/text-to-speech/voice-options">Text to speech guide</a>. |
| Voice (required) | `voice` | string | The voice to use when generating the audio. Supported voices are `alloy`, `echo`, `fable`, `onyx`, `nova`, and `shimmer`. |
| Response Format | `response-format` | string | The format to audio in. Supported formats are `mp3`, `opus`, `aac`, and `flac`. |
| Speed | `speed` | number | The speed of the generated audio. Select a value from `0.25` to `4.0`. `1.0` is the default. |

Expand Down
Loading

0 comments on commit 4426596

Please sign in to comment.