From 476b95b7220dee2f15cc90f7a90219bdeebf30ef Mon Sep 17 00:00:00 2001 From: billytrend-cohere <144115527+billytrend-cohere@users.noreply.github.com> Date: Wed, 7 Aug 2024 09:25:26 -0500 Subject: [PATCH 01/10] Update generators.yml --- fern/generators.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fern/generators.yml b/fern/generators.yml index 459f43f2..b1eab7f4 100644 --- a/fern/generators.yml +++ b/fern/generators.yml @@ -1 +1 @@ -openapi: ./openapi/cohere.yaml +openapi: ../cohere.yaml From cde6b5708e19adfebe97ac3c75dcfac6427deb95 Mon Sep 17 00:00:00 2001 From: billytrend-cohere <144115527+billytrend-cohere@users.noreply.github.com> Date: Wed, 7 Aug 2024 09:26:23 -0500 Subject: [PATCH 02/10] Update generators.yml --- fern/generators.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fern/generators.yml b/fern/generators.yml index b1eab7f4..b833ceda 100644 --- a/fern/generators.yml +++ b/fern/generators.yml @@ -1 +1 @@ -openapi: ../cohere.yaml +openapi: ../cohere-openapi.yaml From ef47b8b9be86d18ee49b463f3fa3a94272233571 Mon Sep 17 00:00:00 2001 From: billytrend-cohere <144115527+billytrend-cohere@users.noreply.github.com> Date: Wed, 7 Aug 2024 09:28:21 -0500 Subject: [PATCH 03/10] Delete fern/openapi directory --- fern/openapi/cohere.yaml | 14364 ------------------------------------- 1 file changed, 14364 deletions(-) delete mode 100644 fern/openapi/cohere.yaml diff --git a/fern/openapi/cohere.yaml b/fern/openapi/cohere.yaml deleted file mode 100644 index 75286a52..00000000 --- a/fern/openapi/cohere.yaml +++ /dev/null @@ -1,14364 +0,0 @@ -openapi: 3.1.0 -info: - title: API Reference - version: "1.0" - description: |- - The Cohere Platform is centered around models. - - Each model has a different amount of power (i.e. parameters), to be used for different tasks. - - Cohere also supports finetuning of baseline models to improve performance on downstream tasks or to teach the model large quantities of information which cannot be extracted with few-shot learning or prompt engineering. - summary: Cohere's API - contact: - name: Cohere Developers - url: https://cohere.com/ - email: team@cohere.com - termsOfService: https://cohere.com/terms-of-use - license: - name: proprietary - url: https://cohere.com/terms-of-use -servers: - - url: https://api.cohere.com/v1 - description: production -security: - - bearerAuth: [] -tags: - - name: /datasets - description: Datasets API - - name: /connectors - description: Connectors API - - name: /embed-jobs - description: Embed Jobs API - - name: /finetuning - description: Finetuning API (Beta) -paths: - /chat: - post: - parameters: - - $ref: "#/components/parameters/RequestSource" - x-fern-audiences: - - public - summary: Chat - operationId: chat - x-fern-streaming: - stream-condition: $request.stream - response: - required: - - text - x-fern-type-name: NonStreamedChatResponse - properties: - text: - type: string - x-fern-audiences: - - public - minLength: 1 - description: Contents of the reply generated by the model. - generation_id: - type: string - x-fern-audiences: - - public - format: uuid - description: - Unique identifier for the generated reply. Useful for submitting - feedback. - citations: - type: array - x-fern-audiences: - - public - minItems: 0 - description: Inline citations for the generated reply. - items: - $ref: "#/components/schemas/ChatCitation" - documents: - type: array - x-fern-audiences: - - public - minItems: 0 - description: Documents seen by the model when generating the reply. - items: - $ref: "#/components/schemas/ChatDocument" - is_search_required: - type: boolean - x-fern-audiences: - - public - description: - Denotes that a search for documents is required during the RAG - flow. - search_queries: - type: array - x-fern-audiences: - - public - description: Generated search queries, meant to be used as part of the RAG flow. - items: - $ref: "#/components/schemas/ChatSearchQuery" - search_results: - type: array - x-fern-audiences: - - public - minItems: 0 - description: Documents retrieved from each of the conducted searches. - items: - $ref: "#/components/schemas/ChatSearchResult" - finish_reason: - x-fern-audiences: - - public - $ref: "#/components/schemas/FinishReason" - tool_calls: - x-fern-audiences: - - public - type: array - items: - $ref: "#/components/schemas/ToolCall" - chat_history: - type: array - x-fern-audiences: - - public - minItems: 0 - items: - $ref: "#/components/schemas/Message" - description: | - A list of previous messages between the user and the model, meant to give the model conversational context for responding to the user's `message`. - prompt: - x-hide-from-docs: true - x-fern-audiences: - - public - type: string - description: - The prompt that was used. Only present when `return_prompt` in the - request is set to true. - meta: - $ref: "#/components/schemas/ApiMeta" - x-fern-audiences: - - public - response-stream: - description: - StreamedChatResponse is returned in streaming mode (specified with - `stream=True` in the request). - x-fern-type-name: StreamedChatResponse - oneOf: - - $ref: "#/components/schemas/ChatStreamStartEvent" - - $ref: "#/components/schemas/ChatSearchQueriesGenerationEvent" - - $ref: "#/components/schemas/ChatSearchResultsEvent" - - $ref: "#/components/schemas/ChatTextGenerationEvent" - - $ref: "#/components/schemas/ChatCitationGenerationEvent" - - $ref: "#/components/schemas/ChatToolCallsGenerationEvent" - - $ref: "#/components/schemas/ChatStreamEndEvent" - - $ref: "#/components/schemas/ChatToolCallsChunkEvent" - discriminator: - propertyName: event_type - mapping: - stream-start: "#/components/schemas/ChatStreamStartEvent" - search-queries-generation: "#/components/schemas/ChatSearchQueriesGenerationEvent" - search-results: "#/components/schemas/ChatSearchResultsEvent" - text-generation: "#/components/schemas/ChatTextGenerationEvent" - citation-generation: "#/components/schemas/ChatCitationGenerationEvent" - tool-calls-generation: "#/components/schemas/ChatToolCallsGenerationEvent" - stream-end: "#/components/schemas/ChatStreamEndEvent" - tool-calls-chunk: "#/components/schemas/ChatToolCallsChunkEvent" - description: | - Generates a text response to a user message. - To learn how to use the Chat API with Streaming and RAG follow our [Text Generation guides](https://docs.cohere.com/docs/chat-api). - requestBody: - content: - application/json: - schema: - type: object - x-fern-audiences: - - public - x-examples: - Chat: - value: - message: Can you give me a global market overview of solar panels? - temperature: 0.3 - stream: false - chat_history: - - role: User - message: Hi! - - role: Chatbot - message: How can I help you today? - prompt_truncation: OFF - Chat with web search: - value: - message: Can you give me a global market overview of solar panels? - temperature: 0.3 - stream: false - chat_history: [] - connectors: - - id: web-search - prompt_truncation: AUTO - Chat with connector: - value: - message: How do I expense a meal? - stream: false - connectors: - - id: custom-connector-id - prompt_truncation: AUTO - required: - - message - properties: - message: - type: string - x-fern-audiences: - - public - description: | - Text input for the model to respond to. - Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments - model: - default: "command-r-plus" - type: string - x-fern-audiences: - - public - description: | - Defaults to `command-r-plus`. - - The name of a compatible [Cohere model](https://docs.cohere.com/docs/models) or the ID of a [fine-tuned](https://docs.cohere.com/docs/chat-fine-tuning) model. - Compatible Deployments: Cohere Platform, Private Deployments - stream: - default: false - description: | - When `true`, the response will be a JSON stream of events. The final event will contain the complete response, and will have an `event_type` of `"stream-end"`. - - Streaming is beneficial for user interfaces that render the contents of the response piece by piece, as it gets generated. - Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments - type: boolean - x-fern-audiences: - - public - preamble: - description: | - When specified, the default Cohere preamble will be replaced with the provided one. Preambles are a part of the prompt used to adjust the model's overall behavior and conversation style, and use the `SYSTEM` role. - - The `SYSTEM` role is also used for the contents of the optional `chat_history=` parameter. When used with the `chat_history=` parameter it adds content throughout a conversation. Conversely, when used with the `preamble=` parameter it adds content at the start of the conversation only. - Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments - type: string - x-fern-audiences: - - public - chat_history: - type: array - x-fern-audiences: - - public - minItems: 0 - items: - $ref: "#/components/schemas/Message" - description: | - A list of previous messages between the user and the model, giving the model conversational context for responding to the user's `message`. - - Each item represents a single message in the chat history, excluding the current user turn. It has two properties: `role` and `message`. The `role` identifies the sender (`CHATBOT`, `SYSTEM`, or `USER`), while the `message` contains the text content. - - The chat_history parameter should not be used for `SYSTEM` messages in most cases. Instead, to add a `SYSTEM` role message at the beginning of a conversation, the `preamble` parameter should be used. - Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments - conversation_id: - type: string - x-fern-audiences: - - public - description: | - An alternative to `chat_history`. - - Providing a `conversation_id` creates or resumes a persisted conversation with the specified ID. The ID can be any non empty string. - Compatible Deployments: Cohere Platform - prompt_truncation: - type: string - x-fern-audiences: - - public - enum: - - OFF - - AUTO - - AUTO_PRESERVE_ORDER - description: | - Defaults to `AUTO` when `connectors` are specified and `OFF` in all other cases. - - Dictates how the prompt will be constructed. - - With `prompt_truncation` set to "AUTO", some elements from `chat_history` and `documents` will be dropped in an attempt to construct a prompt that fits within the model's context length limit. During this process the order of the documents and chat history will be changed and ranked by relevance. - - With `prompt_truncation` set to "AUTO_PRESERVE_ORDER", some elements from `chat_history` and `documents` will be dropped in an attempt to construct a prompt that fits within the model's context length limit. During this process the order of the documents and chat history will be preserved as they are inputted into the API. - - With `prompt_truncation` set to "OFF", no elements will be dropped. If the sum of the inputs exceeds the model's context length limit, a `TooManyTokens` error will be returned. - Compatible Deployments: Cohere Platform Only AUTO_PRESERVE_ORDER: Azure, AWS Sagemaker/Bedrock, Private Deployments - connectors: - type: array - x-fern-audiences: - - public - minItems: 0 - items: - $ref: "#/components/schemas/ChatConnector" - description: | - Accepts `{"id": "web-search"}`, and/or the `"id"` for a custom [connector](https://docs.cohere.com/docs/connectors), if you've [created](https://docs.cohere.com/docs/creating-and-deploying-a-connector) one. - - When specified, the model's reply will be enriched with information found by querying each of the connectors (RAG). - Compatible Deployments: Cohere Platform - search_queries_only: - type: boolean - x-fern-audiences: - - public - description: | - Defaults to `false`. - - When `true`, the response will only contain a list of generated search queries, but no search will take place, and no reply from the model to the user's `message` will be generated. - Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments - documents: - description: | - A list of relevant documents that the model can cite to generate a more accurate reply. Each document is a string-string dictionary. - - Example: - ``` - [ - { "title": "Tall penguins", "text": "Emperor penguins are the tallest." }, - { "title": "Penguin habitats", "text": "Emperor penguins only live in Antarctica." }, - ] - ``` - - Keys and values from each document will be serialized to a string and passed to the model. The resulting generation will include citations that reference some of these documents. - - Some suggested keys are "text", "author", and "date". For better generation quality, it is recommended to keep the total word count of the strings in the dictionary to under 300 words. - - An `id` field (string) can be optionally supplied to identify the document in the citations. This field will not be passed to the model. - - An `_excludes` field (array of strings) can be optionally supplied to omit some key-value pairs from being shown to the model. The omitted fields will still show up in the citation object. The "_excludes" field will not be passed to the model. - - See ['Document Mode'](https://docs.cohere.com/docs/retrieval-augmented-generation-rag#document-mode) in the guide for more information. - Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments - type: array - x-fern-audiences: - - public - items: - $ref: "#/components/schemas/ChatDocument" - citation_quality: - type: string - x-fern-audiences: - - public - description: | - Dictates the approach taken to generating citations as part of the RAG flow by allowing the user to specify whether they want `"accurate"` results, `"fast"` results or no results. - Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments - enum: - - fast - - accurate - - off - default: accurate - temperature: - type: number - x-fern-audiences: - - public - format: float - minimum: 0 - maximum: 1 - description: | - Defaults to `0.3`. - - A non-negative float that tunes the degree of randomness in generation. Lower temperatures mean less random generations, and higher temperatures mean more random generations. - - Randomness can be further maximized by increasing the value of the `p` parameter. - Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments - max_tokens: - type: integer - x-fern-audiences: - - public - description: | - The maximum number of tokens the model will generate as part of the response. Note: Setting a low value may result in incomplete generations. - Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments - writeOnly: true - max_input_tokens: - type: integer - x-fern-audiences: - - public - description: | - The maximum number of input tokens to send to the model. If not specified, `max_input_tokens` is the model's context length limit minus a small buffer. - - Input will be truncated according to the `prompt_truncation` parameter. - Compatible Deployments: Cohere Platform - writeOnly: true - k: - type: integer - x-fern-audiences: - - public - description: | - Ensures only the top `k` most likely tokens are considered for generation at each step. - Defaults to `0`, min value of `0`, max value of `500`. - Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments - writeOnly: true - default: 0 - minimum: 0 - maximum: 500 - p: - type: number - x-fern-audiences: - - public - description: | - Ensures that only the most likely tokens, with total probability mass of `p`, are considered for generation at each step. If both `k` and `p` are enabled, `p` acts after `k`. - Defaults to `0.75`. min value of `0.01`, max value of `0.99`. - Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments - writeOnly: true - default: 0.75 - minimum: 0.01 - maximum: 0.99 - seed: - x-fern-audiences: - - public - minimum: 0 - maximum: 18446744073709552000 - type: integer - description: | - If specified, the backend will make a best effort to sample tokens - deterministically, such that repeated requests with the same - seed and parameters should return the same result. However, - determinism cannot be totally guaranteed. - Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments - stop_sequences: - x-fern-audiences: - - public - writeOnly: true - type: array - items: - type: string - description: | - A list of up to 5 strings that the model will use to stop generation. If the model generates a string that matches any of the strings in the list, it will stop generating tokens and return the generated text up to that point not including the stop sequence. - Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments - connectors_search_options: - x-internal: true - type: object - description: - (internal) Sets inference and model options for RAG search query - and tool use generations. Defaults are used when options are - not specified here, meaning that other parameters outside of - connectors_search_options are ignored (such as model= or - temperature=). - properties: - model: - description: - The model to use for search query or tool use generations. See - model= description for more details. - temperature: - description: - The temperature to use for search query or tool use generations. - See temperature= for more details. - max_tokens: - description: - The maximum number of tokens to generate for search query (default - 50) or tool use (default null) generations. - preamble: - description: - Overrides the default preamble for search query generation. Has no - effect on tool use generations. - seed: - x-internal: true - x-fern-audiences: - - public - minimum: 0 - maximum: 18446744073709552000 - type: integer - description: | - If specified, the backend will make a best effort to sample tokens - deterministically, such that repeated requests with the same - seed and parameters should return the same result. However, - determinism cannot be totally guaranteed. - Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments - frequency_penalty: - type: number - x-fern-audiences: - - public - description: | - Defaults to `0.0`, min value of `0.0`, max value of `1.0`. - - Used to reduce repetitiveness of generated tokens. The higher the value, the stronger a penalty is applied to previously present tokens, proportional to how many times they have already appeared in the prompt or prior generation. - Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments - writeOnly: true - presence_penalty: - type: number - x-fern-audiences: - - public - description: | - Defaults to `0.0`, min value of `0.0`, max value of `1.0`. - - Used to reduce repetitiveness of generated tokens. Similar to `frequency_penalty`, except that this penalty is applied equally to all tokens that have already appeared, regardless of their exact frequencies. - Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments - writeOnly: true - raw_prompting: - x-hide-from-docs: true - x-fern-audiences: - - public - type: boolean - description: | - When enabled, the user's prompt will be sent to the model without - any pre-processing. - Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments - return_prompt: - x-hide-from-docs: true - x-fern-audiences: - - public - type: boolean - description: - The prompt is returned in the `prompt` response field when this is - enabled. - tools: - x-fern-audiences: - - public - description: | - A list of available tools (functions) that the model may suggest invoking before producing a text response. - - When `tools` is passed (without `tool_results`), the `text` field in the response will be `""` and the `tool_calls` field in the response will be populated with a list of tool calls that need to be made. If no calls need to be made, the `tool_calls` array will be empty. - Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments - type: array - items: - $ref: "#/components/schemas/Tool" - minItems: 0 - tool_results: - x-fern-audiences: - - public - description: | - A list of results from invoking tools recommended by the model in the previous chat turn. Results are used to produce a text response and will be referenced in citations. When using `tool_results`, `tools` must be passed as well. - Each tool_result contains information about how it was invoked, as well as a list of outputs in the form of dictionaries. - - **Note**: `outputs` must be a list of objects. If your tool returns a single object (eg `{"status": 200}`), make sure to wrap it in a list. - ``` - tool_results = [ - { - "call": { - "name": , - "parameters": { - : - } - }, - "outputs": [{ - : - }] - }, - ... - ] - ``` - **Note**: Chat calls with `tool_results` should not be included in the Chat history to avoid duplication of the message text. - Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments - type: array - minItems: 0 - items: - $ref: "#/components/schemas/ToolResult" - force_single_step: - x-fern-audiences: - - public - type: boolean - description: Forces the chat to be single step. Defaults to `false`. - response_format: - x-fern-audiences: - - public - $ref: "#/components/schemas/ResponseFormat" - responses: - "200": - description: OK - content: - application/json: - schema: - oneOf: - - $ref: "#/components/schemas/NonStreamedChatResponse" - - $ref: "#/components/schemas/StreamedChatResponse" - "400": - $ref: "#/components/responses/BadRequest" - "401": - $ref: "#/components/responses/Unauthorized" - "403": - $ref: "#/components/responses/Forbidden" - "404": - $ref: "#/components/responses/NotFound" - "422": - $ref: "#/components/responses/UnprocessableEntity" - "429": - $ref: "#/components/responses/RateLimit" - "498": - $ref: "#/components/responses/InvalidToken" - "499": - $ref: "#/components/responses/RequestCancelled" - "500": - $ref: "#/components/responses/InternalServerError" - "501": - $ref: "#/components/responses/NotImplemented" - "503": - $ref: "#/components/responses/ServiceUnavailable" - "504": - $ref: "#/components/responses/GatewayTimeout" - x-fern-examples: - - request: - stream: true - message: What year was he born? - connectors: - - id: web-search - chat_history: - - role: USER - message: Who discovered gravity? - - role: CHATBOT - message: The man who is widely credited with discovering gravity is Sir Isaac Newton - response: - stream: - - event_type: text-generation - text: "Isaac" - - event_type: text-generation - text: " Newton" - - event_type: text-generation - text: " was" - - event_type: text-generation - text: " born" - - event_type: text-generation - text: " on" - - event_type: text-generation - text: " 2" - - event_type: text-generation - text: "5" - - event_type: text-generation - text: " December" - - event_type: text-generation - text: " 1" - - event_type: text-generation - text: "6" - - event_type: text-generation - text: "4" - - event_type: text-generation - text: "2" - - event_type: text-generation - text: "," - - event_type: text-generation - text: " according" - - event_type: text-generation - text: " to" - - event_type: text-generation - text: " the" - - event_type: text-generation - text: " Julian" - - event_type: text-generation - text: " calendar" - - event_type: text-generation - text: " in" - - event_type: text-generation - text: " use" - - event_type: text-generation - text: " in" - - event_type: text-generation - text: " England" - - event_type: text-generation - text: " at" - - event_type: text-generation - text: " the" - - event_type: text-generation - text: " time" - - event_type: text-generation - text: "." - - event_type: text-generation - text: " In" - - event_type: text-generation - text: " the" - - event_type: text-generation - text: " Gregorian" - - event_type: text-generation - text: " calendar" - - event_type: text-generation - text: "," - - event_type: text-generation - text: " this" - - event_type: text-generation - text: " date" - - event_type: text-generation - text: " is" - - event_type: text-generation - text: " 4" - - event_type: text-generation - text: " January" - - event_type: text-generation - text: " 1" - - event_type: text-generation - text: "6" - - event_type: text-generation - text: "4" - - event_type: text-generation - text: "3" - - event_type: text-generation - text: "." - - finish_reason: COMPLETE - event_type: stream-end - response: - text: "Isaac Newton was born on 25 December 1642, according to the Julian calendar in use in England at the time. In the Gregorian calendar, this date is 4 January 1643." - generation_id: 6f752c91-1ec2-4ead-aef4-2e58b1236bdd - chat_history: - - role: USER - message: Who discovered gravity? - - role: CHATBOT - message: The man who is widely credited with discovering gravity is Sir Isaac Newton - - role: USER - message: What year was he born? - - role: CHATBOT - message: Isaac Newton was born on 25 December 1642, according to the Julian calendar in use in England at the time. In the Gregorian calendar, this date is 4 January 1643. - code-samples: - - language: curl - name: cURL - code: >- - curl --request POST \ - --url https://api.cohere.com/v1/chat \ - --header 'accept: application/json' \ - --header 'content-type: application/json' \ - --header "Authorization: bearer $CO_API_KEY" \ - --data '{ - "stream": true, - "chat_history": [ - {"role": "USER", "message": "Who discovered gravity?"}, - {"role": "CHATBOT", "message": "The man who is widely credited with discovering gravity is Sir Isaac Newton"} - ], - "message": "What year was he born?", - "connectors": [{"id": "web-search"}] - }' - - language: go - name: Go - install: go get github.com/cohere-ai/cohere-go/v2 - code: > - package main - - - import ( - "context" - "errors" - "io" - "log" - - cohere "github.com/cohere-ai/cohere-go/v2" - client "github.com/cohere-ai/cohere-go/v2/client" - ) - - - func main() { - co := client.NewClient(client.WithToken("<>")) - - resp, err := co.ChatStream( - context.TODO(), - &cohere.ChatStreamRequest{ - ChatHistory: []*cohere.Message{ - { - Role: "USER", - User: &cohere.ChatMessage{ - Message: "Who discovered gravity?", - }, - }, - { - Role: "CHATBOT", - Chatbot: &cohere.ChatMessage{ - Message: "The man who is widely credited with discovering gravity is Sir Isaac Newton", - }, - }}, - Message: "What year was he born?", - Connectors: []*cohere.ChatConnector{ - {Id: "web-search"}, - }, - }, - ) - - if err != nil { - log.Fatal(err) - } - - // Make sure to close the stream when you're done reading. - // This is easily handled with defer. - defer resp.Close() - - for { - message, err := resp.Recv() - - if errors.Is(err, io.EOF) { - // An io.EOF error means the server is done sending messages - // and should be treated as a success. - break - } - - if message.TextGeneration != nil { - log.Printf("%+v", resp) - } - } - - } - - language: node - name: Node - install: npm i cohere-ai - code: > - const { CohereClient } = require('cohere-ai'); - - - const cohere = new CohereClient({ - token: '<>', - }); - - - (async () => { - const chatStream = await cohere.chatStream({ - chatHistory: [ - { role: 'USER', message: 'Who discovered gravity?' }, - { - role: 'CHATBOT', - message: 'The man who is widely credited with discovering gravity is Sir Isaac Newton', - }, - ], - message: 'What year was he born?', - // perform web search before answering the question. You can also use your own custom connector. - connectors: [{ id: 'web-search' }], - }); - - for await (const message of chatStream) { - if (message.eventType === 'text-generation') { - process.stdout.write(message); - } - } - })(); - - language: python - name: Python - install: python -m pip install cohere --upgrade - code: > - import cohere - - - co = cohere.Client("<>") - - - response = co.chat_stream( - chat_history=[ - {"role": "USER", "message": "Who discovered gravity?"}, - { - "role": "CHATBOT", - "message": "The man who is widely credited with discovering gravity is Sir Isaac Newton", - }, - ], - message="What year was he born?", - # perform web search before answering the question. You can also use your own custom connector. - connectors=[{"id": "web-search"}], - ) - - - for event in response: - if event.event_type == "text-generation": - print(event.text, end='') - - language: java - name: Java - install: implementation 'com.cohere:cohere-java:1.x.x' - code: > - /* (C)2024 */ - - package chatpost; - - - import com.cohere.api.Cohere; - - import com.cohere.api.requests.ChatStreamRequest; - - import com.cohere.api.types.ChatMessage; - - import com.cohere.api.types.ChatMessageRole; - - import com.cohere.api.types.ChatTextGenerationEvent; - - import com.cohere.api.types.StreamedChatResponse; - - import java.util.List; - - - public class Stream { - public static void main(String[] args) { - Cohere cohere = Cohere.builder().token("<>").clientName("snippet").build(); - - Iterable response = - cohere.chatStream( - ChatStreamRequest.builder() - .message("What year was he born?") - .chatHistory( - List.of( - ChatMessage.builder() - .role(ChatMessageRole.USER) - .message("Who discovered gravity?") - .build(), - ChatMessage.builder() - .role(ChatMessageRole.CHATBOT) - .message( - "The man who is widely credited" - + " with discovering gravity is" - + " Sir Isaac Newton") - .build())) - .build()); - - for (StreamedChatResponse chatResponse : response) { - if (chatResponse.isTextGeneration()) { - System.out.println( - chatResponse - .getTextGeneration() - .map(ChatTextGenerationEvent::getText) - .orElse("")); - } - } - - System.out.println(response); - } - } - - request: - stream: false - message: What year was he born? - connectors: - - id: web-search - chat_history: - - role: USER - message: Who discovered gravity? - - role: CHATBOT - message: The man who is widely credited with discovering gravity is Sir Isaac Newton - response: - body: - text: "Isaac Newton was born on 25 December 1642, according to the Julian calendar in use in England at the time. This date is equivalent to 4 January 1643 in the Gregorian calendar." - generation_id: "b05f3457-840d-4445-91b6-aed302b702de" - citations: - - start: 1 - end: 1 - text: "25 December 1642" - document_ids: - - "web-search_0" - - code-samples: - - language: curl - name: cURL - code: >- - curl --request POST \ - --url https://api.cohere.com/v1/chat \ - --header 'accept: application/json' \ - --header 'content-type: application/json' \ - --header "Authorization: bearer $CO_API_KEY" \ - --data '{ - "chat_history": [ - {"role": "USER", "message": "Who discovered gravity?"}, - {"role": "CHATBOT", "message": "The man who is widely credited with discovering gravity is Sir Isaac Newton"} - ], - "message": "What year was he born?", - "connectors": [{"id": "web-search"}] - }' - - language: go - name: Default - install: go get github.com/cohere-ai/cohere-go/v2 - code: > - package main - - - import ( - "context" - "log" - - cohere "github.com/cohere-ai/cohere-go/v2" - client "github.com/cohere-ai/cohere-go/v2/client" - ) - - - func main() { - co := client.NewClient(client.WithToken("<>")) - - resp, err := co.Chat( - context.TODO(), - &cohere.ChatRequest{ - ChatHistory: []*cohere.Message{ - { - Role: "USER", - User: &cohere.ChatMessage{ - Message: "Who discovered gravity?", - }, - }, - { - Role: "CHATBOT", - Chatbot: &cohere.ChatMessage{ - Message: "The man who is widely credited with discovering gravity is Sir Isaac Newton", - }, - }}, - Message: "What year was he born?", - Connectors: []*cohere.ChatConnector{ - {Id: "web-search"}, - }, - }, - ) - - if err != nil { - log.Fatal(err) - } - - log.Printf("%+v", resp) - } - - language: go - name: Documents - install: go get github.com/cohere-ai/cohere-go/v2 - code: > - package main - - - import ( - "context" - "errors" - "io" - "log" - - cohere "github.com/cohere-ai/cohere-go/v2" - client "github.com/cohere-ai/cohere-go/v2/client" - ) - - - func main() { - co := client.NewClient(client.WithToken("<>")) - - resp, err := co.ChatStream( - context.TODO(), - &cohere.ChatStreamRequest{ - ChatHistory: []*cohere.Message{ - { - Role: "USER", - User: &cohere.ChatMessage{ - Message: "Who discovered gravity?", - }, - }, - { - Role: "CHATBOT", - Chatbot: &cohere.ChatMessage{ - Message: "The man who is widely credited with discovering gravity is Sir Isaac Newton", - }, - }}, - Message: "What year was he born?", - Connectors: []*cohere.ChatConnector{ - {Id: "web-search"}, - }, - }, - ) - - if err != nil { - log.Fatal(err) - } - - // Make sure to close the stream when you're done reading. - // This is easily handled with defer. - defer resp.Close() - - for { - message, err := resp.Recv() - - if errors.Is(err, io.EOF) { - // An io.EOF error means the server is done sending messages - // and should be treated as a success. - break - } - - if message.TextGeneration != nil { - log.Printf("%+v", resp) - } - } - - } - - language: go - name: Tools - install: go get github.com/cohere-ai/cohere-go/v2 - code: > - package main - - - import ( - "context" - "log" - - cohere "github.com/cohere-ai/cohere-go/v2" - client "github.com/cohere-ai/cohere-go/v2/client" - ) - - - func main() { - co := client.NewClient(client.WithToken("<>")) - - resp, err := co.Chat( - context.TODO(), - &cohere.ChatRequest{ - Message: "Can you provide a sales summary for 29th September 2023, and also give me some details about the products in the 'Electronics' category, for example their prices and stock levels?", - Tools: []*cohere.Tool{ - { - Name: "query_daily_sales_report", - Description: "Connects to a database to retrieve overall sales volumes and sales information for a given day.", - ParameterDefinitions: map[string]*cohere.ToolParameterDefinitionsValue{ - "day": { - Description: cohere.String("Retrieves sales data for this day, formatted as YYYY-MM-DD."), - Type: "str", - Required: cohere.Bool(true), - }, - }, - }, - { - Name: "query_product_catalog", - Description: "Connects to a a product catalog with information about all the products being sold, including categories, prices, and stock levels.", - ParameterDefinitions: map[string]*cohere.ToolParameterDefinitionsValue{ - "category": { - Description: cohere.String("Retrieves product information data for all products in this category."), - Type: "str", - Required: cohere.Bool(true), - }, - }, - }, - }, - }, - ) - - if err != nil { - log.Fatal(err) - } - - log.Printf("%+v", resp) - } - - language: node - name: Default - install: npm i cohere-ai - code: > - const { CohereClient } = require('cohere-ai'); - - - const cohere = new CohereClient({ - token: '<>', - }); - - - (async () => { - const response = await cohere.chat({ - chatHistory: [ - { role: 'USER', message: 'Who discovered gravity?' }, - { - role: 'CHATBOT', - message: 'The man who is widely credited with discovering gravity is Sir Isaac Newton', - }, - ], - message: 'What year was he born?', - // perform web search before answering the question. You can also use your own custom connector. - connectors: [{ id: 'web-search' }], - }); - - console.log(response); - })(); - - language: node - name: Documents - install: npm i cohere-ai - code: > - const { CohereClient } = require('cohere-ai'); - - - const cohere = new CohereClient({ - token: '<>', - }); - - - (async () => { - const response = await cohere.chat({ - message: 'Who is more popular: Nsync or Backstreet Boys?', - documents: [ - { - title: 'CSPC: Backstreet Boys Popularity Analysis - ChartMasters', - snippet: - '↓ Skip to Main Content\n\nMusic industry – One step closer to being accurate\n\nCSPC: Backstreet Boys Popularity Analysis\n\nHernán Lopez Posted on February 9, 2017 Posted in CSPC 72 Comments Tagged with Backstreet Boys, Boy band\n\nAt one point, Backstreet Boys defined success: massive albums sales across the globe, great singles sales, plenty of chart topping releases, hugely hyped tours and tremendous media coverage.\n\nIt is true that they benefited from extraordinarily good market conditions in all markets. After all, the all-time record year for the music business, as far as revenues in billion dollars are concerned, was actually 1999. That is, back when this five men group was at its peak.', - }, - { - title: 'CSPC: NSYNC Popularity Analysis - ChartMasters', - snippet: - "↓ Skip to Main Content\n\nMusic industry – One step closer to being accurate\n\nCSPC: NSYNC Popularity Analysis\n\nMJD Posted on February 9, 2018 Posted in CSPC 27 Comments Tagged with Boy band, N'Sync\n\nAt the turn of the millennium three teen acts were huge in the US, the Backstreet Boys, Britney Spears and NSYNC. The latter is the only one we haven’t study so far. It took 15 years and Adele to break their record of 2,4 million units sold of No Strings Attached in its first week alone.\n\nIt wasn’t a fluke, as the second fastest selling album of the Soundscan era prior 2015, was also theirs since Celebrity debuted with 1,88 million units sold.", - }, - { - title: 'CSPC: Backstreet Boys Popularity Analysis - ChartMasters', - snippet: - ' 1997, 1998, 2000 and 2001 also rank amongst some of the very best years.\n\nYet the way many music consumers – especially teenagers and young women’s – embraced their output deserves its own chapter. If Jonas Brothers and more recently One Direction reached a great level of popularity during the past decade, the type of success achieved by Backstreet Boys is in a completely different level as they really dominated the business for a few years all over the world, including in some countries that were traditionally hard to penetrate for Western artists.\n\nWe will try to analyze the extent of that hegemony with this new article with final results which will more than surprise many readers.', - }, - { - title: 'CSPC: NSYNC Popularity Analysis - ChartMasters', - snippet: - ' Was the teen group led by Justin Timberlake really that big? Was it only in the US where they found success? Or were they a global phenomenon?\n\nAs usual, I’ll be using the Commensurate Sales to Popularity Concept in order to relevantly gauge their results. This concept will not only bring you sales information for all NSYNC‘s albums, physical and download singles, as well as audio and video streaming, but it will also determine their true popularity. If you are not yet familiar with the CSPC method, the next page explains it with a short video. I fully recommend watching the video before getting into the sales figures.', - }, - ], - }); - - console.log(response); - })(); - - language: node - name: Tools - install: npm i cohere-ai - code: > - const { CohereClient } = require('cohere-ai'); - - - const cohere = new CohereClient({ - token: '<>', - }); - - - (async () => { - const response = await cohere.chat({ - message: - "Can you provide a sales summary for 29th September 2023, and also give me some details about the products in the 'Electronics' category, for example their prices and stock levels?", - tools: [ - { - name: 'query_daily_sales_report', - description: - 'Connects to a database to retrieve overall sales volumes and sales information for a given day.', - parameterDefinitions: { - day: { - description: 'Retrieves sales data for this day, formatted as YYYY-MM-DD.', - type: 'str', - required: true, - }, - }, - }, - { - name: 'query_product_catalog', - description: - 'Connects to a a product catalog with information about all the products being sold, including categories, prices, and stock levels.', - parameterDefinitions: { - category: { - description: 'Retrieves product information data for all products in this category.', - type: 'str', - required: true, - }, - }, - }, - ], - }); - - console.log(response); - })(); - - language: python - name: Sync - install: python -m pip install cohere --upgrade - code: > - import cohere - - - co = cohere.Client("<>") - - - response = co.chat( - chat_history=[ - {"role": "USER", "message": "Who discovered gravity?"}, - { - "role": "CHATBOT", - "message": "The man who is widely credited with discovering gravity is Sir Isaac Newton", - }, - ], - message="What year was he born?", - # perform web search before answering the question. You can also use your own custom connector. - connectors=[{"id": "web-search"}], - ) - - - print(response) - - language: python - name: Async - install: python -m pip install cohere --upgrade - code: > - import cohere - - import asyncio - - - co = cohere.AsyncClient("<>") - - - - async def main(): - return await co.chat( - chat_history=[ - {"role": "USER", "message": "Who discovered gravity?"}, - { - "role": "CHATBOT", - "message": "The man who is widely credited with discovering gravity is Sir Isaac Newton", - }, - ], - message="What year was he born?", - # perform web search before answering the question. You can also use your own custom connector. - connectors=[{"id": "web-search"}], - ) - - asyncio.run(main()) - - language: python - name: Documents - install: python -m pip install cohere --upgrade - code: > - import cohere - - - co = cohere.Client("<>") - - - response = co.chat( - model="command", - message="Who is more popular: Nsync or Backstreet Boys?", - documents=[ - { - "title": "CSPC: Backstreet Boys Popularity Analysis - ChartMasters", - "snippet": "↓ Skip to Main Content\n\nMusic industry – One step closer to being accurate\n\nCSPC: Backstreet Boys Popularity Analysis\n\nHernán Lopez Posted on February 9, 2017 Posted in CSPC 72 Comments Tagged with Backstreet Boys, Boy band\n\nAt one point, Backstreet Boys defined success: massive albums sales across the globe, great singles sales, plenty of chart topping releases, hugely hyped tours and tremendous media coverage.\n\nIt is true that they benefited from extraordinarily good market conditions in all markets. After all, the all-time record year for the music business, as far as revenues in billion dollars are concerned, was actually 1999. That is, back when this five men group was at its peak." - }, - { - "title": "CSPC: NSYNC Popularity Analysis - ChartMasters", - "snippet": "↓ Skip to Main Content\n\nMusic industry – One step closer to being accurate\n\nCSPC: NSYNC Popularity Analysis\n\nMJD Posted on February 9, 2018 Posted in CSPC 27 Comments Tagged with Boy band, N'Sync\n\nAt the turn of the millennium three teen acts were huge in the US, the Backstreet Boys, Britney Spears and NSYNC. The latter is the only one we haven’t study so far. It took 15 years and Adele to break their record of 2,4 million units sold of No Strings Attached in its first week alone.\n\nIt wasn’t a fluke, as the second fastest selling album of the Soundscan era prior 2015, was also theirs since Celebrity debuted with 1,88 million units sold." - }, - { - "title": "CSPC: Backstreet Boys Popularity Analysis - ChartMasters", - "snippet": " 1997, 1998, 2000 and 2001 also rank amongst some of the very best years.\n\nYet the way many music consumers – especially teenagers and young women’s – embraced their output deserves its own chapter. If Jonas Brothers and more recently One Direction reached a great level of popularity during the past decade, the type of success achieved by Backstreet Boys is in a completely different level as they really dominated the business for a few years all over the world, including in some countries that were traditionally hard to penetrate for Western artists.\n\nWe will try to analyze the extent of that hegemony with this new article with final results which will more than surprise many readers." - }, - { - "title": "CSPC: NSYNC Popularity Analysis - ChartMasters", - "snippet": " Was the teen group led by Justin Timberlake really that big? Was it only in the US where they found success? Or were they a global phenomenon?\n\nAs usual, I’ll be using the Commensurate Sales to Popularity Concept in order to relevantly gauge their results. This concept will not only bring you sales information for all NSYNC‘s albums, physical and download singles, as well as audio and video streaming, but it will also determine their true popularity. If you are not yet familiar with the CSPC method, the next page explains it with a short video. I fully recommend watching the video before getting into the sales figures." - } - ]) - - print(response) - - language: python - name: Tools - install: python -m pip install cohere --upgrade - code: > - import cohere - - - co = cohere.Client("<>") - - - # tool descriptions that the model has access to - - tools = [ - { - "name": "query_daily_sales_report", - "description": "Connects to a database to retrieve overall sales volumes and sales information for a given day.", - "parameter_definitions": { - "day": { - "description": "Retrieves sales data for this day, formatted as YYYY-MM-DD.", - "type": "str", - "required": True - } - } - }, - { - "name": "query_product_catalog", - "description": "Connects to a a product catalog with information about all the products being sold, including categories, prices, and stock levels.", - "parameter_definitions": { - "category": { - "description": "Retrieves product information data for all products in this category.", - "type": "str", - "required": True - } - } - } - ] - - - - # user request - - message = "Can you provide a sales summary for 29th September - 2023, and also give me some details about the products in the - 'Electronics' category, for example their prices and stock - levels?" - - - response = co.chat( - message=message, - tools=tools, - ) - - - print(response) - - language: java - name: Default - install: implementation 'com.cohere:cohere-java:1.x.x' - code: > - /* (C)2024 */ - - package chatpost; - - - import com.cohere.api.Cohere; - - import com.cohere.api.requests.ChatRequest; - - import com.cohere.api.types.ChatMessage; - - import com.cohere.api.types.ChatMessageRole; - - import com.cohere.api.types.NonStreamedChatResponse; - - import java.util.List; - - - public class Default { - public static void main(String[] args) { - Cohere cohere = Cohere.builder().token("<>").clientName("snippet").build(); - - NonStreamedChatResponse response = - cohere.chat( - ChatRequest.builder() - .message("What year was he born?") - .chatHistory( - List.of( - ChatMessage.builder() - .role(ChatMessageRole.USER) - .message("Who discovered gravity?") - .build(), - ChatMessage.builder() - .role(ChatMessageRole.CHATBOT) - .message( - "The man who is widely credited" - + " with discovering gravity is" - + " Sir Isaac Newton") - .build())) - .build()); - - System.out.println(response); - } - } - - language: java - name: Documents - install: implementation 'com.cohere:cohere-java:1.x.x' - code: > - /* (C)2024 */ - - package chatpost; - - - import com.cohere.api.Cohere; - - import com.cohere.api.requests.ChatRequest; - - import com.cohere.api.types.NonStreamedChatResponse; - - import java.util.List; - - import java.util.Map; - - - public class Documents { - public static void main(String[] args) { - Cohere cohere = Cohere.builder().token("<>").clientName("snippet").build(); - - NonStreamedChatResponse response = - cohere.chat( - ChatRequest.builder() - .message("What year was he born?") - .documents( - List.of( - Map.of( - "title", - "CSPC: Backstreet Boys Popularity" - + " Analysis - ChartMasters", - "snippet", - "↓ Skip to Main Content\n\n" - + "Music industry – One step" - + " closer to being" - + " accurate\n\n" - + "CSPC: Backstreet Boys" - + " Popularity Analysis\n\n" - + "Hernán Lopez Posted on" - + " February 9, 2017 Posted in" - + " CSPC 72 Comments Tagged" - + " with Backstreet Boys, Boy" - + " band\n\n" - + "At one point, Backstreet" - + " Boys defined success:" - + " massive albums sales across" - + " the globe, great singles" - + " sales, plenty of chart" - + " topping releases, hugely" - + " hyped tours and tremendous" - + " media coverage.\n\n" - + "It is true that they" - + " benefited from" - + " extraordinarily good market" - + " conditions in all markets." - + " After all, the all-time" - + " record year for the music" - + " business, as far as" - + " revenues in billion dollars" - + " are concerned, was actually" - + " 1999. That is, back when" - + " this five men group was at" - + " its peak."), - Map.of( - "title", - "CSPC: NSYNC Popularity Analysis -" - + " ChartMasters", - "snippet", - "↓ Skip to Main Content\n\n" - + "Music industry – One step" - + " closer to being" - + " accurate\n\n" - + "CSPC: NSYNC Popularity" - + " Analysis\n\n" - + "MJD Posted on February 9," - + " 2018 Posted in CSPC 27" - + " Comments Tagged with Boy" - + " band, N'Sync\n\n" - + "At the turn of the" - + " millennium three teen acts" - + " were huge in the US, the" - + " Backstreet Boys, Britney" - + " Spears and NSYNC. The" - + " latter is the only one we" - + " haven’t study so far. It" - + " took 15 years and Adele to" - + " break their record of 2,4" - + " million units sold of No" - + " Strings Attached in its" - + " first week alone.\n\n" - + "It wasn’t a fluke, as the" - + " second fastest selling" - + " album of the Soundscan era" - + " prior 2015, was also theirs" - + " since Celebrity debuted" - + " with 1,88 million units" - + " sold."), - Map.of( - "title", - "CSPC: Backstreet Boys Popularity" - + " Analysis - ChartMasters", - "snippet", - " 1997, 1998, 2000 and 2001 also" - + " rank amongst some of the" - + " very best years.\n\n" - + "Yet the way many music" - + " consumers – especially" - + " teenagers and young women’s" - + " – embraced their output" - + " deserves its own chapter." - + " If Jonas Brothers and more" - + " recently One Direction" - + " reached a great level of" - + " popularity during the past" - + " decade, the type of success" - + " achieved by Backstreet Boys" - + " is in a completely" - + " different level as they" - + " really dominated the" - + " business for a few years" - + " all over the world," - + " including in some countries" - + " that were traditionally" - + " hard to penetrate for" - + " Western artists.\n\n" - + "We will try to analyze the" - + " extent of that hegemony" - + " with this new article with" - + " final results which will" - + " more than surprise many" - + " readers."), - Map.of( - "title", - "CSPC: NSYNC Popularity Analysis -" - + " ChartMasters", - "snippet", - " Was the teen group led by Justin" - + " Timberlake really that big? Was it" - + " only in the US where they found" - + " success? Or were they a global" - + " phenomenon?\n\n" - + "As usual, I’ll be using the" - + " Commensurate Sales to Popularity" - + " Concept in order to relevantly" - + " gauge their results. This concept" - + " will not only bring you sales" - + " information for all NSYNC‘s albums," - + " physical and download singles, as" - + " well as audio and video streaming," - + " but it will also determine their" - + " true popularity. If you are not yet" - + " familiar with the CSPC method, the" - + " next page explains it with a short" - + " video. I fully recommend watching" - + " the video before getting into the" - + " sales figures."))) - .build()); - - System.out.println(response); - } - } - - language: java - name: Tools - install: implementation 'com.cohere:cohere-java:1.x.x' - code: > - /* (C)2024 */ - - package chatpost; - - - import com.cohere.api.Cohere; - - import com.cohere.api.requests.ChatRequest; - - import com.cohere.api.types.NonStreamedChatResponse; - - import com.cohere.api.types.Tool; - - import com.cohere.api.types.ToolParameterDefinitionsValue; - - import java.util.List; - - import java.util.Map; - - - public class Tools { - public static void main(String[] args) { - Cohere cohere = Cohere.builder().token("<>").clientName("snippet").build(); - - NonStreamedChatResponse response = - cohere.chat( - ChatRequest.builder() - .message( - "Can you provide a sales summary for 29th September 2023," - + " and also give me some details about the products in" - + " the 'Electronics' category, for example their" - + " prices and stock levels?") - .tools( - List.of( - Tool.builder() - .name("query_daily_sales_report") - .description( - "Connects to a database to retrieve" - + " overall sales volumes and" - + " sales information for a" - + " given day.") - .parameterDefinitions( - Map.of( - "day", - ToolParameterDefinitionsValue - .builder() - .type("str") - .description( - "Retrieves" - + " sales" - + " data" - + " for this" - + " day," - + " formatted" - + " as YYYY-MM-DD.") - .required(true) - .build())) - .build(), - Tool.builder() - .name("query_product_catalog") - .description( - "Connects to a a product catalog" - + " with information about all" - + " the products being sold," - + " including categories," - + " prices, and stock levels.") - .parameterDefinitions( - Map.of( - "category", - ToolParameterDefinitionsValue - .builder() - .type("str") - .description( - "Retrieves" - + " product" - + " information" - + " data" - + " for all" - + " products" - + " in this" - + " category.") - .required(true) - .build())) - .build())) - .build()); - - System.out.println(response); - } - } - /generate: - post: - x-fern-audiences: - - public - summary: Generate - operationId: generate - x-fern-streaming: - stream-condition: $request.stream - response: - type: object - x-fern-type-name: Generation - required: - - id - - generations - properties: - id: - type: string - x-fern-audiences: - - public - prompt: - type: string - x-fern-audiences: - - public - description: Prompt used for generations. - generations: - type: array - x-fern-audiences: - - public - description: List of generated results - items: - type: object - x-fern-audiences: - - public - $ref: "#/components/schemas/SingleGeneration" - meta: - $ref: "#/components/schemas/ApiMeta" - x-fern-audiences: - - public - response-stream: - description: - Response in content type stream when `stream` is `true` in the - request parameters. Generation tokens are streamed with the - GenerationStream response. The final response is of type - GenerationFinalResponse. - x-fern-type-name: GenerateStreamedResponse - oneOf: - - $ref: "#/components/schemas/GenerateStreamText" - - $ref: "#/components/schemas/GenerateStreamEnd" - - $ref: "#/components/schemas/GenerateStreamError" - discriminator: - propertyName: event_type - mapping: - text-generation: "#/components/schemas/GenerateStreamText" - stream-end: "#/components/schemas/GenerateStreamEnd" - stream-error: "#/components/schemas/GenerateStreamError" - parameters: - - $ref: "#/components/parameters/RequestSource" - x-readme: - samples-languages: - - python - - java - - curl - - node - - go - code-samples: - - language: go - name: Cohere Go SDK - install: go get github.com/cohere-ai/cohere-go/v2 - code: | - package main - - import ( - "context" - "errors" - "io" - "log" - - cohere "github.com/cohere-ai/cohere-go/v2" - client "github.com/cohere-ai/cohere-go/v2/client" - ) - - func main() { - co := client.NewClient(client.WithToken("<>")) - - resp, err := co.GenerateStream( - context.TODO(), - &cohere.GenerateStreamRequest{ - Prompt: "Please explain to me how LLMs work", - }, - ) - - if err != nil { - log.Fatal(err) - } - - // Make sure to close the stream when you're done reading. - // This is easily handled with defer. - defer resp.Close() - - for { - message, err := resp.Recv() - - if errors.Is(err, io.EOF) { - // An io.EOF error means the server is done sending messages - // and should be treated as a success. - break - } - - if message.TextGeneration != nil { - log.Printf("%+v", resp) - } - } - } - - language: node - name: Cohere TypeScript SDK - install: npm i cohere-ai - code: | - const { CohereClient } = require('cohere-ai'); - - const cohere = new CohereClient({ - token: '<>', - }); - - (async () => { - const generate = await cohere.generate({ - prompt: 'Please explain to me how LLMs work', - }); - - console.log(generate); - })(); - - language: python - name: Sync - install: python -m pip install cohere --upgrade - code: | - import cohere - - co = cohere.Client("<>") - - response = co.generate( - prompt="Please explain to me how LLMs work", - ) - print(response) - - language: python - name: Async - install: python -m pip install cohere --upgrade - code: | - import cohere - import asyncio - - co = cohere.AsyncClient("<>") - - - async def main(): - response = await co.generate( - prompt="Please explain to me how LLMs work", - ) - print(response) - - asyncio.run(main()) - - language: java - name: Cohere java SDK - install: implementation 'com.cohere:cohere-java:1.0.4' - code: > - import com.cohere.api.Cohere; - - import com.cohere.api.requests.GenerateRequest; - - import com.cohere.api.types.Generation; - - - - public class GeneratePost { - public static void main(String[] args) { - Cohere cohere = Cohere.builder().token("<>").clientName("snippet").build(); - - Generation response = cohere.generate(GenerateRequest.builder().prompt("Please explain to me how LLMs work").build()); - - System.out.println(response); - } - } - - language: curl - name: cURL - code: |- - curl --request POST \ - --url https://api.cohere.com/v1/generate \ - --header 'accept: application/json' \ - --header 'content-type: application/json' \ - --header "Authorization: bearer $CO_API_KEY" \ - --data '{ - "prompt": "Please explain to me how LLMs work" - }' - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: "#/components/schemas/Generation" - application/stream+json: - schema: - $ref: "#/components/schemas/GenerateStreamedResponse" - headers: - X-API-Warning: - schema: - type: string - x-fern-audiences: - - public - description: Warning description for incorrect usage of the API - "400": - $ref: "#/components/responses/BadRequest" - "401": - $ref: "#/components/responses/Unauthorized" - "403": - $ref: "#/components/responses/Forbidden" - "404": - $ref: "#/components/responses/NotFound" - "422": - $ref: "#/components/responses/UnprocessableEntity" - "429": - $ref: "#/components/responses/RateLimit" - "498": - $ref: "#/components/responses/InvalidToken" - "499": - $ref: "#/components/responses/RequestCancelled" - "500": - $ref: "#/components/responses/InternalServerError" - "501": - $ref: "#/components/responses/NotImplemented" - "503": - $ref: "#/components/responses/ServiceUnavailable" - "504": - $ref: "#/components/responses/GatewayTimeout" - description: | - > 🚧 Warning - > - > This API is marked as "Legacy" and is no longer maintained. Follow the [migration guide](/docs/migrating-from-cogenerate-to-cochat) to start using the Chat API. - - Generates realistic text conditioned on a given input. - requestBody: - content: - application/json: - schema: - type: object - x-fern-audiences: - - public - x-examples: - Example: - prompt: Please explain to me how LLMs work - max_tokens: 50 - temperature: 1 - k: 0 - p: 0.75 - properties: - prompt: - type: string - x-fern-audiences: - - public - example: Please explain to me how LLMs work - description: | - The input text that serves as the starting point for generating the response. - Note: The prompt will be pre-processed and modified before reaching the model. - writeOnly: true - model: - type: string - x-fern-audiences: - - public - description: |- - The identifier of the model to generate with. Currently available models are `command` (default), `command-nightly` (experimental), `command-light`, and `command-light-nightly` (experimental). - Smaller, "light" models are faster, while larger models will perform better. [Custom models](/docs/training-custom-models) can also be supplied with their full ID. - writeOnly: true - num_generations: - type: integer - x-fern-audiences: - - public - description: | - The maximum number of generations that will be returned. Defaults to `1`, min value of `1`, max value of `5`. - writeOnly: true - stream: - type: boolean - x-fern-audiences: - - public - description: | - When `true`, the response will be a JSON stream of events. Streaming is beneficial for user interfaces that render the contents of the response piece by piece, as it gets generated. - - The final event will contain the complete response, and will contain an `is_finished` field set to `true`. The event will also contain a `finish_reason`, which can be one of the following: - - `COMPLETE` - the model sent back a finished reply - - `MAX_TOKENS` - the reply was cut off because the model reached the maximum number of tokens for its context length - - `ERROR` - something went wrong when generating the reply - - `ERROR_TOXIC` - the model generated a reply that was deemed toxic - max_tokens: - type: integer - x-fern-audiences: - - public - description: | - The maximum number of tokens the model will generate as part of the response. Note: Setting a low value may result in incomplete generations. - - This parameter is off by default, and if it's not specified, the model will continue generating until it emits an EOS completion token. See [BPE Tokens](/bpe-tokens-wiki) for more details. - - Can only be set to `0` if `return_likelihoods` is set to `ALL` to get the likelihood of the prompt. - writeOnly: true - truncate: - type: string - x-fern-audiences: - - public - default: END - enum: - - NONE - - START - - END - description: |- - One of `NONE|START|END` to specify how the API will handle inputs longer than the maximum token length. - - Passing `START` will discard the start of the input. `END` will discard the end of the input. In both cases, input is discarded until the remaining input is exactly the maximum input token length for the model. - - If `NONE` is selected, when the input exceeds the maximum input token length an error will be returned. - writeOnly: true - temperature: - type: number - x-fern-audiences: - - public - description: | - A non-negative float that tunes the degree of randomness in generation. Lower temperatures mean less random generations. See [Temperature](/temperature-wiki) for more details. - Defaults to `0.75`, min value of `0.0`, max value of `5.0`. - writeOnly: true - seed: - x-fern-audiences: - - public - minimum: 0 - maximum: 18446744073709552000 - type: integer - description: | - If specified, the backend will make a best effort to sample tokens - deterministically, such that repeated requests with the same - seed and parameters should return the same result. However, - determinism cannot be totally guaranteed. - Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments - preset: - type: string - x-fern-audiences: - - public - example: my-preset-a58sbd - description: | - Identifier of a custom preset. A preset is a combination of parameters, such as prompt, temperature etc. You can create presets in the [playground](https://dashboard.cohere.com/playground/generate). - When a preset is specified, the `prompt` parameter becomes optional, and any included parameters will override the preset's parameters. - writeOnly: true - end_sequences: - type: array - x-fern-audiences: - - public - description: - The generated text will be cut at the beginning of the earliest - occurrence of an end sequence. The sequence will be excluded - from the text. - items: - type: string - x-fern-audiences: - - public - writeOnly: true - stop_sequences: - type: array - x-fern-audiences: - - public - description: - The generated text will be cut at the end of the earliest - occurrence of a stop sequence. The sequence will be included - the text. - items: - type: string - x-fern-audiences: - - public - writeOnly: true - k: - type: integer - x-fern-audiences: - - public - description: | - Ensures only the top `k` most likely tokens are considered for generation at each step. - Defaults to `0`, min value of `0`, max value of `500`. - writeOnly: true - p: - type: number - x-fern-audiences: - - public - description: | - Ensures that only the most likely tokens, with total probability mass of `p`, are considered for generation at each step. If both `k` and `p` are enabled, `p` acts after `k`. - Defaults to `0.75`. min value of `0.01`, max value of `0.99`. - writeOnly: true - frequency_penalty: - type: number - x-fern-audiences: - - public - description: | - Used to reduce repetitiveness of generated tokens. The higher the value, the stronger a penalty is applied to previously present tokens, proportional to how many times they have already appeared in the prompt or prior generation. - - Using `frequency_penalty` in combination with `presence_penalty` is not supported on newer models. - writeOnly: true - presence_penalty: - type: number - x-fern-audiences: - - public - description: | - Defaults to `0.0`, min value of `0.0`, max value of `1.0`. - - Can be used to reduce repetitiveness of generated tokens. Similar to `frequency_penalty`, except that this penalty is applied equally to all tokens that have already appeared, regardless of their exact frequencies. - - Using `frequency_penalty` in combination with `presence_penalty` is not supported on newer models. - writeOnly: true - return_likelihoods: - type: string - x-fern-audiences: - - public - description: |- - One of `GENERATION|ALL|NONE` to specify how and if the token likelihoods are returned with the response. - - If `GENERATION` is selected, the token likelihoods will only be provided for generated text. - - If `ALL` is selected, the token likelihoods will be provided both for the prompt and the generated text. - enum: - - GENERATION - - ALL - - NONE - default: NONE - raw_prompting: - type: boolean - x-fern-audiences: - - public - description: - When enabled, the user's prompt will be sent to the model without - any pre-processing. - required: - - prompt - writeOnly: true - examples: - Example: - value: - prompt: Please explain to me how LLMs work - description: "" - /embed: - post: - x-fern-audiences: - - public - summary: Embed - operationId: embed - parameters: - - $ref: "#/components/parameters/RequestSource" - x-readme: - samples-languages: - - python - - java - - curl - - node - - go - code-samples: - - language: go - name: Cohere Go SDK - install: go get github.com/cohere-ai/cohere-go/v2 - code: | - package main - - import ( - "context" - "log" - - cohere "github.com/cohere-ai/cohere-go/v2" - client "github.com/cohere-ai/cohere-go/v2/client" - ) - - func main() { - co := client.NewClient(client.WithToken("<>")) - - resp, err := co.Embed( - context.TODO(), - &cohere.EmbedRequest{ - Texts: []string{"hello", "goodbye"}, - Model: cohere.String("embed-english-v3.0"), - InputType: cohere.EmbedInputTypeSearchDocument.Ptr(), - }, - ) - - if err != nil { - log.Fatal(err) - } - - log.Printf("%+v", resp) - } - - language: node - name: Cohere TypeScript SDK - install: npm i cohere-ai - code: | - const { CohereClient } = require('cohere-ai'); - - const cohere = new CohereClient({ - token: '<>', - }); - - (async () => { - const embed = await cohere.embed({ - texts: ['hello', 'goodbye'], - model: 'embed-english-v3.0', - inputType: 'classification', - }); - console.log(embed); - })(); - - language: python - name: Sync - install: python -m pip install cohere --upgrade - code: > - import cohere - - - co = cohere.Client("<>") - - - response = co.embed( - texts=["hello", "goodbye"], model="embed-english-v3.0", input_type="classification" - ) - - print(response) - - language: python - name: Async - install: python -m pip install cohere --upgrade - code: > - import cohere - - import asyncio - - - co = cohere.AsyncClient("<>") - - - - async def main(): - response = await co.embed( - texts=["hello", "goodbye"], model="embed-english-v3.0", input_type="classification" - ) - print(response) - - asyncio.run(main()) - - language: java - name: Cohere java SDK - install: implementation 'com.cohere:cohere-java:1.0.4' - code: > - import com.cohere.api.Cohere; - - import com.cohere.api.requests.EmbedRequest; - - import com.cohere.api.types.EmbedInputType; - - import com.cohere.api.types.EmbedResponse; - - - import java.util.List; - - - - public class EmbedPost { - public static void main(String[] args) { - Cohere cohere = Cohere.builder().token("<>").clientName("snippet").build(); - - EmbedResponse response = cohere.embed(EmbedRequest.builder().texts(List.of("hello", "goodbye")).model("embed-english-v3.0").inputType(EmbedInputType.CLASSIFICATION).build()); - - System.out.println(response); - } - } - - language: curl - name: cURL - code: |- - curl --request POST \ - --url https://api.cohere.com/v1/embed \ - --header 'accept: application/json' \ - --header 'content-type: application/json' \ - --header "Authorization: bearer $CO_API_KEY" \ - --data '{ - "model": "embed-english-v3.0", - "texts": ["hello", "goodbye"], - "input_type": "classification" - }' - responses: - "200": - description: OK - content: - application/json: - schema: - oneOf: - - $ref: "#/components/schemas/EmbedFloatsResponse" - - $ref: "#/components/schemas/EmbedByTypeResponse" - discriminator: - propertyName: response_type - mapping: - embeddings_floats: "#/components/schemas/EmbedFloatsResponse" - embeddings_by_type: "#/components/schemas/EmbedByTypeResponse" - headers: - X-API-Warning: - schema: - type: string - x-fern-audiences: - - public - description: Warning description for incorrect usage of the API - "400": - $ref: "#/components/responses/BadRequest" - "401": - $ref: "#/components/responses/Unauthorized" - "403": - $ref: "#/components/responses/Forbidden" - "404": - $ref: "#/components/responses/NotFound" - "422": - $ref: "#/components/responses/UnprocessableEntity" - "429": - $ref: "#/components/responses/RateLimit" - "498": - $ref: "#/components/responses/InvalidToken" - "499": - $ref: "#/components/responses/RequestCancelled" - "500": - $ref: "#/components/responses/InternalServerError" - "501": - $ref: "#/components/responses/NotImplemented" - "503": - $ref: "#/components/responses/ServiceUnavailable" - "504": - $ref: "#/components/responses/GatewayTimeout" - description: |- - This endpoint returns text embeddings. An embedding is a list of floating point numbers that captures semantic information about the text that it represents. - - Embeddings can be used to create text classifiers as well as empower semantic search. To learn more about embeddings, see the embedding page. - - If you want to learn more how to use the embedding model, have a look at the [Semantic Search Guide](/docs/semantic-search). - requestBody: - content: - application/json: - schema: - type: object - x-fern-audiences: - - public - properties: - texts: - type: array - x-fern-audiences: - - public - minItems: 1 - maxItems: 96 - description: - An array of strings for the model to embed. Maximum number of texts - per call is `96`. We recommend reducing the length of each - text to be under `512` tokens for optimal quality. - items: - type: string - x-fern-audiences: - - public - writeOnly: true - writeOnly: true - model: - type: string - x-fern-audiences: - - public - description: |- - Defaults to embed-english-v2.0 - - The identifier of the model. Smaller "light" models are faster, while larger models will perform better. [Custom models](/docs/training-custom-models) can also be supplied with their full ID. - - Available models and corresponding embedding dimensions: - - * `embed-english-v3.0` 1024 - * `embed-multilingual-v3.0` 1024 - * `embed-english-light-v3.0` 384 - * `embed-multilingual-light-v3.0` 384 - - * `embed-english-v2.0` 4096 - * `embed-english-light-v2.0` 1024 - * `embed-multilingual-v2.0` 768 - writeOnly: true - input_type: - x-fern-audiences: - - public - $ref: "#/components/schemas/EmbedInputType" - embedding_types: - type: array - x-fern-audiences: - - public - items: - $ref: "#/components/schemas/EmbeddingType" - description: |- - Specifies the types of embeddings you want to get back. Not required and default is None, which returns the Embed Floats response type. Can be one or more of the following types. - - * `"float"`: Use this when you want to get back the default float embeddings. Valid for all models. - * `"int8"`: Use this when you want to get back signed int8 embeddings. Valid for only v3 models. - * `"uint8"`: Use this when you want to get back unsigned int8 embeddings. Valid for only v3 models. - * `"binary"`: Use this when you want to get back signed binary embeddings. Valid for only v3 models. - * `"ubinary"`: Use this when you want to get back unsigned binary embeddings. Valid for only v3 models. - writeOnly: true - truncate: - type: string - x-fern-audiences: - - public - default: END - enum: - - NONE - - START - - END - description: |- - One of `NONE|START|END` to specify how the API will handle inputs longer than the maximum token length. - - Passing `START` will discard the start of the input. `END` will discard the end of the input. In both cases, input is discarded until the remaining input is exactly the maximum input token length for the model. - - If `NONE` is selected, when the input exceeds the maximum input token length an error will be returned. - writeOnly: true - required: - - texts - examples: - Example: - value: - texts: - - hello - - goodbye - description: "" - /embed-jobs: - post: - x-fern-audiences: - - public - parameters: - - $ref: "#/components/parameters/RequestSource" - summary: Create an Embed Job - operationId: create-embed-job - tags: - - /embed-jobs - x-fern-sdk-group-name: embed-jobs - x-fern-sdk-method-name: create - x-readme: - samples-languages: - - python - - java - - python - - java - - node - - curl - - go - code-samples: - - language: go - name: Cohere Go SDK - install: go get github.com/cohere-ai/cohere-go/v2 - code: | - package main - - import ( - "context" - "log" - - cohere "github.com/cohere-ai/cohere-go/v2" - client "github.com/cohere-ai/cohere-go/v2/client" - ) - - func main() { - co := client.NewClient(client.WithToken("<>")) - - resp, err := co.EmbedJobs.Create( - context.TODO(), - &cohere.CreateEmbedJobRequest{ - DatasetId: "dataset_id", - InputType: cohere.EmbedInputTypeSearchDocument, - }, - ) - - if err != nil { - log.Fatal(err) - } - - log.Printf("%+v", resp) - } - - language: python - name: Sync - install: python -m pip install cohere --upgrade - code: > - import cohere - - - co = cohere.Client("<>") - - - # start an embed job - - response = co.embed_jobs.create( - dataset_id=ds.id, input_type="search_document", model="embed-english-v3.0" - ) - - - # poll the server until the job is complete - - response = co.wait(job) - - - print(response) - - language: python - name: Async - install: python -m pip install cohere --upgrade - code: > - import cohere - - import asyncio - - - co = cohere.AsyncClient("<>") - - - - async def main(): - # start an embed job - response = await co.embed_jobs.create( - dataset_id=ds.id, input_type="search_document", model="embed-english-v3.0" - ) - - # poll the server until the job is complete - response = await co.wait(job) - - print(response) - - asyncio.run(main()) - - language: java - name: Cohere java SDK - install: implementation 'com.cohere:cohere-java:1.0.4' - code: > - import com.cohere.api.Cohere; - - import - com.cohere.api.resources.embedjobs.requests.CreateEmbedJobRequest; - - import com.cohere.api.types.CreateEmbedJobResponse; - - import com.cohere.api.types.EmbedInputType; - - - - public class EmbedJobsPost { - public static void main(String[] args) { - Cohere cohere = Cohere.builder().token("<>").clientName("snippet").build(); - - CreateEmbedJobResponse response = cohere.embedJobs().create(CreateEmbedJobRequest.builder().model("embed-english-v3.0").datasetId("ds.id").inputType(EmbedInputType.SEARCH_DOCUMENT).build()); - - System.out.println(response); - } - } - - language: node - name: Cohere TypeScript SDK - install: npm i cohere-ai - code: | - const { CohereClient } = require('cohere-ai'); - - const cohere = new CohereClient({ - token: '<>', - }); - - (async () => { - const embedJob = await cohere.embedJobs.create({ - datasetId: 'my-dataset', - inputType: 'search_document', - model: 'embed-english-v3.0', - }); - - console.log(embedJob); - })(); - - language: curl - name: cURL - code: |- - curl --request POST \ - --url https://api.cohere.com/v1/embed-jobs \ - --header 'accept: application/json' \ - --header 'content-type: application/json' \ - --header "Authorization: bearer $CO_API_KEY" \ - --data '{ - "model": "embed-english-v3.0", - "dataset_id": "my-dataset" - }' - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: "#/components/schemas/CreateEmbedJobResponse" - headers: - X-API-Warning: - schema: - type: string - x-fern-audiences: - - public - description: Warning description for incorrect usage of the API - "400": - $ref: "#/components/responses/BadRequest" - "401": - $ref: "#/components/responses/Unauthorized" - "403": - $ref: "#/components/responses/Forbidden" - "404": - $ref: "#/components/responses/NotFound" - "422": - $ref: "#/components/responses/UnprocessableEntity" - "429": - $ref: "#/components/responses/RateLimit" - "498": - $ref: "#/components/responses/InvalidToken" - "499": - $ref: "#/components/responses/RequestCancelled" - "500": - $ref: "#/components/responses/InternalServerError" - "501": - $ref: "#/components/responses/NotImplemented" - "503": - $ref: "#/components/responses/ServiceUnavailable" - "504": - $ref: "#/components/responses/GatewayTimeout" - description: This API launches an async Embed job for a - [Dataset](https://docs.cohere.com/docs/datasets) of type `embed-input`. - The result of a completed embed job is new Dataset of type - `embed-output`, which contains the original text entries and the - corresponding embeddings. - requestBody: - content: - application/json: - schema: - $ref: "#/components/schemas/CreateEmbedJobRequest" - get: - x-fern-audiences: - - public - parameters: - - $ref: "#/components/parameters/RequestSource" - summary: List Embed Jobs - operationId: list-embed-jobs - tags: - - /embed-jobs - x-fern-sdk-group-name: embed-jobs - x-fern-sdk-method-name: list - x-readme: - samples-languages: - - python - - java - - python - - java - - node - - curl - - go - code-samples: - - language: go - name: Cohere Go SDK - install: go get github.com/cohere-ai/cohere-go/v2 - code: | - package main - - import ( - "context" - "log" - - client "github.com/cohere-ai/cohere-go/v2/client" - ) - - func main() { - co := client.NewClient(client.WithToken("<>")) - - resp, err := co.EmbedJobs.Get(context.TODO(), "embed_job_id") - - if err != nil { - log.Fatal(err) - } - - log.Printf("%+v", resp) - } - - language: python - name: Sync - install: python -m pip install cohere --upgrade - code: | - import cohere - - co = cohere.Client("<>") - - # list embed jobs - response = co.embed_jobs.list() - - print(response) - - language: python - name: Async - install: python -m pip install cohere --upgrade - code: | - import cohere - import asyncio - - co = cohere.AsyncClient("<>") - - - async def main(): - response = await co.embed_jobs.list() - - print(response) - - asyncio.run(main()) - - language: java - name: Cohere java SDK - install: implementation 'com.cohere:cohere-java:1.0.4' - code: > - import com.cohere.api.Cohere; - - import com.cohere.api.types.ListEmbedJobResponse; - - - - public class EmbedJobsGet { - public static void main(String[] args) { - Cohere cohere = Cohere.builder().token("<>").clientName("snippet").build(); - - ListEmbedJobResponse response = cohere.embedJobs().list(); - - System.out.println(response); - } - } - - language: node - name: Cohere TypeScript SDK - install: npm i cohere-ai - code: | - const { CohereClient } = require('cohere-ai'); - - const cohere = new CohereClient({ - token: '<>', - }); - - (async () => { - const embedJobs = await cohere.embedJobs.list(); - - console.log(embedJobs); - })(); - - language: curl - name: cURL - code: |- - curl --request GET \ - --url https://api.cohere.com/v1/embed-jobs \ - --header 'accept: application/json' \ - --header "Authorization: bearer $CO_API_KEY" - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: "#/components/schemas/ListEmbedJobResponse" - headers: - X-API-Warning: - schema: - type: string - x-fern-audiences: - - public - description: Warning description for incorrect usage of the API - "400": - $ref: "#/components/responses/BadRequest" - "401": - $ref: "#/components/responses/Unauthorized" - "403": - $ref: "#/components/responses/Forbidden" - "404": - $ref: "#/components/responses/NotFound" - "422": - $ref: "#/components/responses/UnprocessableEntity" - "429": - $ref: "#/components/responses/RateLimit" - "498": - $ref: "#/components/responses/InvalidToken" - "499": - $ref: "#/components/responses/RequestCancelled" - "500": - $ref: "#/components/responses/InternalServerError" - "501": - $ref: "#/components/responses/NotImplemented" - "503": - $ref: "#/components/responses/ServiceUnavailable" - "504": - $ref: "#/components/responses/GatewayTimeout" - description: - The list embed job endpoint allows users to view all embed jobs - history for that specific user. - "/embed-jobs/{id}": - get: - x-fern-audiences: - - public - parameters: - - name: id - in: path - required: true - description: The ID of the embed job to retrieve. - schema: - type: string - x-fern-audiences: - - public - - $ref: "#/components/parameters/RequestSource" - summary: Fetch an Embed Job - operationId: get-embed-job - tags: - - /embed-jobs - x-fern-sdk-group-name: embed-jobs - x-fern-sdk-method-name: get - x-readme: - samples-languages: - - python - - java - - python - - java - - node - - curl - - go - code-samples: - - language: go - name: Cohere Go SDK - install: go get github.com/cohere-ai/cohere-go/v2 - code: | - package main - - import ( - "context" - "log" - - client "github.com/cohere-ai/cohere-go/v2/client" - ) - - func main() { - co := client.NewClient(client.WithToken("<>")) - - resp, err := co.EmbedJobs.List(context.TODO()) - - if err != nil { - log.Fatal(err) - } - - log.Printf("%+v", resp) - } - - language: python - name: Sync - install: python -m pip install cohere --upgrade - code: | - import cohere - - co = cohere.Client("<>") - - # get embed job - response = co.embed_jobs.get("job_id") - - print(response) - - language: python - name: Async - install: python -m pip install cohere --upgrade - code: | - import cohere - import asyncio - - co = cohere.AsyncClient("<>") - - - async def main(): - response = await co.embed_jobs.get("job_id") - - print(response) - - asyncio.run(main()) - - language: java - name: Cohere java SDK - install: implementation 'com.cohere:cohere-java:1.0.4' - code: > - import com.cohere.api.Cohere; - - import com.cohere.api.types.ListEmbedJobResponse; - - - - public class EmbedJobsGet { - public static void main(String[] args) { - Cohere cohere = Cohere.builder().token("<>").clientName("snippet").build(); - - ListEmbedJobResponse response = cohere.embedJobs().list(); - - System.out.println(response); - } - } - - language: node - name: Cohere TypeScript SDK - install: npm i cohere-ai - code: | - const { CohereClient } = require('cohere-ai'); - - const cohere = new CohereClient({ - token: '<>', - }); - - (async () => { - const embedJob = await cohere.embedJobs.get('job_id'); - - console.log(embedJob); - })(); - - language: curl - name: cURL - code: |- - curl --request GET \ - --url https://api.cohere.com/v1/embed-jobs/id \ - --header 'accept: application/json' \ - --header "Authorization: bearer $CO_API_KEY" - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: "#/components/schemas/EmbedJob" - headers: - X-API-Warning: - schema: - type: string - x-fern-audiences: - - public - description: Warning message for potentially incorrect usage of the API - "400": - $ref: "#/components/responses/BadRequest" - "401": - $ref: "#/components/responses/Unauthorized" - "403": - $ref: "#/components/responses/Forbidden" - "404": - $ref: "#/components/responses/NotFound" - "422": - $ref: "#/components/responses/UnprocessableEntity" - "429": - $ref: "#/components/responses/RateLimit" - "498": - $ref: "#/components/responses/InvalidToken" - "499": - $ref: "#/components/responses/RequestCancelled" - "500": - $ref: "#/components/responses/InternalServerError" - "501": - $ref: "#/components/responses/NotImplemented" - "503": - $ref: "#/components/responses/ServiceUnavailable" - "504": - $ref: "#/components/responses/GatewayTimeout" - description: - This API retrieves the details about an embed job started by the - same user. - "/embed-jobs/{id}/cancel": - post: - x-fern-audiences: - - public - parameters: - - name: id - in: path - required: true - description: The ID of the embed job to cancel. - schema: - type: string - x-fern-audiences: - - public - - $ref: "#/components/parameters/RequestSource" - summary: Cancel an Embed Job - operationId: cancel-embed-job - tags: - - /embed-jobs - x-fern-sdk-group-name: embed-jobs - x-fern-sdk-method-name: cancel - x-readme: - samples-languages: - - python - - java - - python - - java - - node - - curl - - go - code-samples: - - language: go - name: Cohere Go SDK - install: go get github.com/cohere-ai/cohere-go/v2 - code: | - package main - - import ( - "context" - "log" - - client "github.com/cohere-ai/cohere-go/v2/client" - ) - - func main() { - co := client.NewClient(client.WithToken("<>")) - - err := co.EmbedJobs.Cancel(context.TODO(), "embed_job_id") - - if err != nil { - log.Fatal(err) - } - - } - - language: python - name: Sync - install: python -m pip install cohere --upgrade - code: | - import cohere - - co = cohere.Client("<>") - - # cancel an embed job - co.embed_jobs.cancel("job_id") - - language: python - name: Async - install: python -m pip install cohere --upgrade - code: | - import cohere - import asyncio - - co = cohere.AsyncClient("<>") - - - async def main(): - await co.embed_jobs.cancel("job_id") - - language: java - name: Cohere java SDK - install: implementation 'com.cohere:cohere-java:1.0.4' - code: > - import com.cohere.api.Cohere; - - - - public class EmbedJobsCancel { - public static void main(String[] args) { - Cohere cohere = Cohere.builder().token("<>").clientName("snippet").build(); - - cohere.embedJobs().cancel("job_id"); - } - } - - language: node - name: Cohere TypeScript SDK - install: npm i cohere-ai - code: | - const { CohereClient } = require('cohere-ai'); - - const cohere = new CohereClient({ - token: '<>', - }); - - (async () => { - const embedJob = await cohere.embedJobs.cancel('job_id'); - - console.log(embedJob); - })(); - - language: curl - name: cURL - code: |- - curl --request POST \ - --url https://api.cohere.com/v1/embed-jobs/id/cancel \ - --header 'accept: application/json' \ - --header 'content-type: application/json' \ - --header "Authorization: bearer $CO_API_KEY" - responses: - "200": - description: OK - headers: - X-API-Warning: - schema: - type: string - x-fern-audiences: - - public - description: Warning description for incorrect usage of the API - "400": - $ref: "#/components/responses/BadRequest" - "401": - $ref: "#/components/responses/Unauthorized" - "403": - $ref: "#/components/responses/Forbidden" - "404": - $ref: "#/components/responses/NotFound" - "422": - $ref: "#/components/responses/UnprocessableEntity" - "429": - $ref: "#/components/responses/RateLimit" - "498": - $ref: "#/components/responses/InvalidToken" - "499": - $ref: "#/components/responses/RequestCancelled" - "500": - $ref: "#/components/responses/InternalServerError" - "501": - $ref: "#/components/responses/NotImplemented" - "503": - $ref: "#/components/responses/ServiceUnavailable" - "504": - $ref: "#/components/responses/GatewayTimeout" - description: - This API allows users to cancel an active embed job. Once invoked, - the embedding process will be terminated, and users will be charged for - the embeddings processed up to the cancellation point. It's important to - note that partial results will not be available to users after - cancellation. - /rerank: - post: - x-fern-audiences: - - public - summary: Rerank - operationId: rerank - parameters: - - $ref: "#/components/parameters/RequestSource" - responses: - "200": - description: OK - content: - application/json: - schema: - type: object - x-fern-audiences: - - public - properties: - id: - type: string - x-fern-audiences: - - public - results: - type: array - x-fern-audiences: - - public - description: An ordered list of ranked documents - items: - type: object - x-fern-audiences: - - public - properties: - document: - type: object - x-fern-audiences: - - public - description: - If `return_documents` is set as `false` this will return none, if - `true` it will return the documents passed in - properties: - text: - type: string - x-fern-audiences: - - public - description: The text of the document to rerank - required: - - text - index: - type: integer - x-fern-audiences: - - public - description: - Corresponds to the index in the original list of documents to which - the ranked document belongs. (i.e. if the first - value in the `results` object has an `index` value - of 3, it means in the list of documents passed in, - the document at `index=3` had the highest relevance) - relevance_score: - type: number - x-fern-audiences: - - public - format: float - description: - Relevance scores are normalized to be in the range `[0, 1]`. Scores - close to `1` indicate a high relevance to the query, - and scores closer to `0` indicate low relevance. It - is not accurate to assume a score of 0.9 means the - document is 2x more relevant than a document with a - score of 0.45 - readOnly: true - required: - - index - - relevance_score - meta: - $ref: "#/components/schemas/ApiMeta" - x-fern-audiences: - - public - required: - - results - "400": - $ref: "#/components/responses/BadRequest" - "401": - $ref: "#/components/responses/Unauthorized" - "403": - $ref: "#/components/responses/Forbidden" - "404": - $ref: "#/components/responses/NotFound" - "422": - $ref: "#/components/responses/UnprocessableEntity" - "429": - $ref: "#/components/responses/RateLimit" - "498": - $ref: "#/components/responses/InvalidToken" - "499": - $ref: "#/components/responses/RequestCancelled" - "500": - $ref: "#/components/responses/InternalServerError" - "501": - $ref: "#/components/responses/NotImplemented" - "503": - $ref: "#/components/responses/ServiceUnavailable" - "504": - $ref: "#/components/responses/GatewayTimeout" - requestBody: - content: - application/json: - schema: - type: object - x-fern-audiences: - - public - properties: - model: - type: string - x-fern-audiences: - - public - description: "The identifier of the model to use, one of : - `rerank-english-v3.0`, `rerank-multilingual-v3.0`, - `rerank-english-v2.0`, `rerank-multilingual-v2.0`" - query: - type: string - x-fern-audiences: - - public - description: The search query - documents: - type: array - x-fern-audiences: - - public - description: |- - A list of document objects or strings to rerank. - If a document is provided the text fields is required and all other fields will be preserved in the response. - - The total max chunks (length of documents * max_chunks_per_doc) must be less than 10000. - - We recommend a maximum of 1,000 documents for optimal endpoint performance. - items: - oneOf: - - type: string - - $ref: "#/components/schemas/RerankDocument" - top_n: - type: integer - x-fern-audiences: - - public - minimum: 1 - description: - The number of most relevant documents or indices to return, - defaults to the length of the documents - rank_fields: - type: array - x-fern-audiences: - - public - items: - type: string - x-fern-audiences: - - public - description: - If a JSON object is provided, you can specify which keys you would - like to have considered for reranking. The model will rerank - based on order of the fields passed in (i.e. - rank_fields=['title','author','text'] will rerank using the - values in title, author, text sequentially. If the length - of title, author, and text exceeds the context length of the - model, the chunking will not re-consider earlier fields). If - not provided, the model will use the default text field for - ranking. - return_documents: - type: boolean - x-fern-audiences: - - public - default: false - description: |- - - If false, returns results without the doc text - the api will return a list of {index, relevance score} where index is inferred from the list passed into the request. - - If true, returns results with the doc text passed in - the api will return an ordered list of {index, text, relevance score} where index + text refers to the list passed into the request. - max_chunks_per_doc: - type: integer - x-fern-audiences: - - public - description: The maximum number of chunks to produce internally from a document - default: 10 - required: - - query - - documents - examples: - Example: - value: - model: rerank-english-v3.0 - query: What is the capital of the United States? - documents: - - Carson City is the capital city of the American state of - Nevada. - - The Commonwealth of the Northern Mariana Islands is a - group of islands in the Pacific Ocean. Its capital is - Saipan. - - Washington, D.C. (also known as simply Washington or D.C., - and officially as the District of Columbia) is the capital - of the United States. It is a federal district. - - Capital punishment (the death penalty) has existed in the - United States since beforethe United States was a country. - As of 2017, capital punishment is legal in 30 of the 50 - states. - description: "" - description: - This endpoint takes in a query and a list of texts and produces an - ordered array with each text assigned a relevance score. - x-readme: - samples-languages: - - python - - java - - curl - - node - - go - code-samples: - - language: go - name: Cohere Go SDK - install: go get github.com/cohere-ai/cohere-go/v2 - code: > - package main - - - import ( - "context" - "log" - - cohere "github.com/cohere-ai/cohere-go/v2" - client "github.com/cohere-ai/cohere-go/v2/client" - ) - - - func main() { - co := client.NewClient(client.WithToken("<>")) - - resp, err := co.Rerank( - context.TODO(), - &cohere.RerankRequest{ - Query: "What is the capital of the United States?", - Documents: []*cohere.RerankRequestDocumentsItem{ - {String: "Carson City is the capital city of the American state of Nevada."}, - {String: "The Commonwealth of the Northern Mariana Islands is a group of islands in the Pacific Ocean. Its capital is Saipan."}, - {String: "Capitalization or capitalisation in English grammar is the use of a capital letter at the start of a word. English usage varies from capitalization in other languages."}, - {String: "Washington, D.C. (also known as simply Washington or D.C., and officially as the District of Columbia) is the capital of the United States. It is a federal district."}, - }, - Model: cohere.String("rerank-english-v3.0"), - }, - ) - - if err != nil { - log.Fatal(err) - } - - log.Printf("%+v", resp) - } - - language: node - name: Cohere TypeScript SDK - install: npm i cohere-ai - code: > - const { CohereClient } = require('cohere-ai'); - - - const cohere = new CohereClient({ - token: '<>', - }); - - - (async () => { - const rerank = await cohere.rerank({ - documents: [ - { text: 'Carson City is the capital city of the American state of Nevada.' }, - { - text: 'The Commonwealth of the Northern Mariana Islands is a group of islands in the Pacific Ocean. Its capital is Saipan.', - }, - { - text: 'Capitalization or capitalisation in English grammar is the use of a capital letter at the start of a word. English usage varies from capitalization in other languages.', - }, - { - text: 'Washington, D.C. (also known as simply Washington or D.C., and officially as the District of Columbia) is the capital of the United States. It is a federal district.', - }, - { - text: 'Capital punishment (the death penalty) has existed in the United States since beforethe United States was a country. As of 2017, capital punishment is legal in 30 of the 50 states.', - }, - ], - query: 'What is the capital of the United States?', - topN: 3, - model: 'rerank-english-v3.0', - }); - - console.log(rerank); - })(); - - language: python - name: Sync - install: python -m pip install cohere --upgrade - code: > - import cohere - - - co = cohere.Client("<>") - - - docs = [ - "Carson City is the capital city of the American state of Nevada.", - "The Commonwealth of the Northern Mariana Islands is a group of islands in the Pacific Ocean. Its capital is Saipan.", - "Capitalization or capitalisation in English grammar is the use of a capital letter at the start of a word. English usage varies from capitalization in other languages.", - "Washington, D.C. (also known as simply Washington or D.C., and officially as the District of Columbia) is the capital of the United States. It is a federal district.", - "Capital punishment (the death penalty) has existed in the United States since beforethe United States was a country. As of 2017, capital punishment is legal in 30 of the 50 states.", - ] - - - response = co.rerank( - model="rerank-english-v3.0", - query="What is the capital of the United States?", - documents=docs, - top_n=3, - ) - - print(response) - - language: python - name: Async - install: python -m pip install cohere --upgrade - code: > - import cohere - - import asyncio - - - co = cohere.AsyncClient("<>") - - - docs = [ - "Carson City is the capital city of the American state of Nevada.", - "The Commonwealth of the Northern Mariana Islands is a group of islands in the Pacific Ocean. Its capital is Saipan.", - "Capitalization or capitalisation in English grammar is the use of a capital letter at the start of a word. English usage varies from capitalization in other languages.", - "Washington, D.C. (also known as simply Washington or D.C., and officially as the District of Columbia) is the capital of the United States. It is a federal district.", - "Capital punishment (the death penalty) has existed in the United States since beforethe United States was a country. As of 2017, capital punishment is legal in 30 of the 50 states.", - ] - - - - async def main(): - response = await co.rerank( - model="rerank-english-v2.0", - query="What is the capital of the United States?", - documents=docs, - top_n=3, - ) - print(response) - - asyncio.run(main()) - - language: java - name: Cohere java SDK - install: implementation 'com.cohere:cohere-java:1.0.4' - code: > - import com.cohere.api.Cohere; - - import com.cohere.api.requests.RerankRequest; - - import com.cohere.api.types.RerankRequestDocumentsItem; - - import com.cohere.api.types.RerankResponse; - - - import java.util.List; - - - - public class RerankPost { - public static void main(String[] args) { - Cohere cohere = Cohere.builder().token("<>").clientName("snippet").build(); - - RerankResponse response = cohere.rerank(RerankRequest.builder().query("What is the capital of the United States?").documents(List.of( - RerankRequestDocumentsItem.of("Carson City is the capital city of the American state of Nevada."), - RerankRequestDocumentsItem.of("The Commonwealth of the Northern Mariana Islands is a group of islands in the Pacific Ocean. Its capital is Saipan."), - RerankRequestDocumentsItem.of("Capitalization or capitalisation in English grammar is the use of a capital letter at the start of a word. English usage varies from capitalization in other languages."), - RerankRequestDocumentsItem.of("Washington, D.C. (also known as simply Washington or D.C., and officially as the District of Columbia) is the capital of the United States. It is a federal district."), - RerankRequestDocumentsItem.of("Capital punishment (the death penalty) has existed in the United States since beforethe United States was a country. As of 2017, capital punishment is legal in 30 of the 50 states.") - )).model("rerank-english-v3.0").topN(3).build()); - - System.out.println(response); - } - } - - language: curl - name: cURL - code: >- - curl --request POST \ - --url https://api.cohere.com/v1/rerank \ - --header 'accept: application/json' \ - --header 'content-type: application/json' \ - --header "Authorization: bearer $CO_API_KEY" \ - --data '{ - "model": "rerank-english-v3.0", - "query": "What is the capital of the United States?", - "top_n": 3, - "documents": ["Carson City is the capital city of the American state of Nevada.", - "The Commonwealth of the Northern Mariana Islands is a group of islands in the Pacific Ocean. Its capital is Saipan.", - "Washington, D.C. (also known as simply Washington or D.C., and officially as the District of Columbia) is the capital of the United States. It is a federal district.", - "Capitalization or capitalisation in English grammar is the use of a capital letter at the start of a word. English usage varies from capitalization in other languages.", - "Capital punishment (the death penalty) has existed in the United States since beforethe United States was a country. As of 2017, capital punishment is legal in 30 of the 50 states."] - }' - /classify: - post: - parameters: - - $ref: "#/components/parameters/RequestSource" - x-fern-audiences: - - public - summary: Classify - operationId: classify - x-readme: - samples-languages: - - python - - java - - curl - - node - - go - code-samples: - - language: go - name: Cohere Go SDK - install: go get github.com/cohere-ai/cohere-go/v2 - code: | - package main - - import ( - "context" - "log" - - cohere "github.com/cohere-ai/cohere-go/v2" - client "github.com/cohere-ai/cohere-go/v2/client" - ) - - func main() { - co := client.NewClient(client.WithToken("<>")) - - resp, err := co.Classify( - context.TODO(), - &cohere.ClassifyRequest{ - Examples: []*cohere.ClassifyExample{ - { - Text: cohere.String("orange"), - Label: cohere.String("fruit"), - }, - { - Text: cohere.String("pear"), - Label: cohere.String("fruit"), - }, - { - Text: cohere.String("lettuce"), - Label: cohere.String("vegetable"), - }, - { - Text: cohere.String("cauliflower"), - Label: cohere.String("vegetable"), - }, - }, - Inputs: []string{"peach"}, - }, - ) - - if err != nil { - log.Fatal(err) - } - - log.Printf("%+v", resp) - } - - language: node - name: Cohere TypeScript SDK - install: npm i cohere-ai - code: > - const { CohereClient } = require('cohere-ai'); - - - const cohere = new CohereClient({ - token: '<>', - }); - - - (async () => { - const classify = await cohere.classify({ - examples: [ - { text: "Dermatologists don't like her!", label: 'Spam' }, - { text: "'Hello, open to this?'", label: 'Spam' }, - { text: 'I need help please wire me $1000 right now', label: 'Spam' }, - { text: 'Nice to know you ;)', label: 'Spam' }, - { text: 'Please help me?', label: 'Spam' }, - { text: 'Your parcel will be delivered today', label: 'Not spam' }, - { text: 'Review changes to our Terms and Conditions', label: 'Not spam' }, - { text: 'Weekly sync notes', label: 'Not spam' }, - { text: "'Re: Follow up from today's meeting'", label: 'Not spam' }, - { text: 'Pre-read for tomorrow', label: 'Not spam' }, - ], - inputs: ['Confirm your email address', 'hey i need u to send some $'], - }); - - console.log(classify); - })(); - - language: python - name: Sync - install: python -m pip install cohere --upgrade - code: > - import cohere - - from cohere import ClassifyExample - - - co = cohere.Client("<>") - - examples = [ - ClassifyExample(text="Dermatologists don't like her!", label="Spam"), - ClassifyExample(text="'Hello, open to this?'", label="Spam"), - ClassifyExample( - text="I need help please wire me $1000 right now", label="Spam"), - ClassifyExample(text="Nice to know you ;)", label="Spam"), - ClassifyExample(text="Please help me?", label="Spam"), - ClassifyExample(text="Your parcel will be delivered today", - label="Not spam"), - ClassifyExample( - text="Review changes to our Terms and Conditions", label="Not spam" - ), - ClassifyExample(text="Weekly sync notes", label="Not spam"), - ClassifyExample(text="'Re: Follow up from today's meeting'", - label="Not spam"), - ClassifyExample(text="Pre-read for tomorrow", label="Not spam"), - ] - - inputs = [ - "Confirm your email address", - "hey i need u to send some $", - ] - - response = co.classify( - inputs=inputs, - examples=examples, - ) - - print(response) - - language: python - name: Async - install: python -m pip install cohere --upgrade - code: > - import cohere - - import asyncio - - from cohere import ClassifyExample - - - co = cohere.AsyncClient("<>") - - examples = [ - ClassifyExample(text="Dermatologists don't like her!", label="Spam"), - ClassifyExample(text="'Hello, open to this?'", label="Spam"), - ClassifyExample( - text="I need help please wire me $1000 right now", label="Spam"), - ClassifyExample(text="Nice to know you ;)", label="Spam"), - ClassifyExample(text="Please help me?", label="Spam"), - ClassifyExample(text="Your parcel will be delivered today", - label="Not spam"), - ClassifyExample( - text="Review changes to our Terms and Conditions", label="Not spam" - ), - ClassifyExample(text="Weekly sync notes", label="Not spam"), - ClassifyExample(text="'Re: Follow up from today's meeting'", - label="Not spam"), - ClassifyExample(text="Pre-read for tomorrow", label="Not spam"), - ] - - inputs = [ - "Confirm your email address", - "hey i need u to send some $", - ] - - - - async def main(): - response = await co.classify( - inputs=inputs, - examples=examples, - ) - print(response) - - asyncio.run(main()) - - language: java - name: Cohere java SDK - install: implementation 'com.cohere:cohere-java:1.0.4' - code: > - import com.cohere.api.Cohere; - - import com.cohere.api.requests.ClassifyRequest; - - import com.cohere.api.types.ClassifyExample; - - import com.cohere.api.types.ClassifyResponse; - - - import java.util.List; - - - - public class ClassifyPost { - public static void main(String[] args) { - Cohere cohere = Cohere.builder().token("<>").clientName("snippet").build(); - - ClassifyResponse response = cohere.classify(ClassifyRequest.builder().addAllInputs( - List.of("Confirm your email address", "hey i need u to send some $") - ).examples(List.of( - ClassifyExample.builder().text("Dermatologists don't like her!").label("Spam").build(), - ClassifyExample.builder().text("'Hello, open to this?'").label("Spam").build(), - ClassifyExample.builder().text("I need help please wire me $1000 right now").label("Spam").build(), - ClassifyExample.builder().text("Nice to know you ;)").label("Spam").build(), - ClassifyExample.builder().text("Please help me?").label("Spam").build(), - ClassifyExample.builder().text("Your parcel will be delivered today").label("Not spam").build(), - ClassifyExample.builder().text("Review changes to our Terms and Conditions").label("Not spam").build(), - ClassifyExample.builder().text("Weekly sync notes").label("Not spam").build(), - ClassifyExample.builder().text("'Re: Follow up from today's meeting'").label("Not spam").build(), - ClassifyExample.builder().text("Pre-read for tomorrow").label("Not spam").build() - )).build()); - - System.out.println(response); - } - } - - language: curl - name: cURL - code: >- - curl --request POST \ - --url https://api.cohere.com/v1/classify \ - --header 'accept: application/json' \ - --header 'content-type: application/json' \ - --header "Authorization: bearer $CO_API_KEY" \ - --data '{ - "inputs": ["Confirm your email address", "hey i need u to send some $"], - "examples": [ - {"text": "Dermatologists don'\''t like her!","label": "Spam"}, - {"text": "'\''Hello, open to this?'\''","label": "Spam"}, - {"text": "I need help please wire me $1000 right now","label": "Spam"}, - {"text": "Nice to know you ;)","label": "Spam"}, - {"text": "Please help me?","label": "Spam"}, - {"text": "Your parcel will be delivered today","label": "Not spam"}, - {"text": "Review changes to our Terms and Conditions","label": "Not spam"}, - {"text": "Weekly sync notes","label": "Not spam"}, - {"text": "'\''Re: Follow up from today'\''s meeting'\''","label": "Not spam"}, - {"text": "Pre-read for tomorrow","label": "Not spam"} - ] - }' - responses: - "200": - description: OK - content: - application/json: - schema: - type: object - x-fern-audiences: - - public - x-examples: - Example: - id: ca245541-8841-456e-b306-293370789a30 - classifications: - - id: c50ab0d9-95d8-44de-ba90-9647a1718744 - input: Confirm your email address - prediction: Not spam - predictions: - - Not spam - confidence: 0.7581943 - confidences: - - 0.7581943 - labels: - Not spam: - confidence: 0.7581943 - Spam: - confidence: 0.24180566 - classification_type: single-label - - id: 8a841de2-027f-49d4-8c91-e88fa1865b89 - input: hey i need u to send some $ - prediction: Spam - predictions: - - Spam - confidence: 0.9965721 - confidences: - - 0.9965721 - labels: - Not spam: - confidence: 0.0034279241 - Spam: - confidence: 0.9965721 - classification_type: single-label - properties: - id: - type: string - x-fern-audiences: - - public - readOnly: true - classifications: - type: array - x-fern-audiences: - - public - items: - type: object - x-fern-audiences: - - public - properties: - id: - type: string - x-fern-audiences: - - public - readOnly: true - input: - type: string - x-fern-audiences: - - public - description: The input text that was classified - readOnly: true - prediction: - type: string - x-fern-audiences: - - public - description: - The predicted label for the associated query (only filled for - single-label models) - readOnly: true - deprecated: true - predictions: - type: array - x-fern-audiences: - - public - items: - type: string - x-fern-audiences: - - public - description: - An array containing the predicted labels for the associated query - (only filled for single-label classification) - readOnly: true - confidence: - type: number - x-fern-audiences: - - public - format: float - description: - The confidence score for the top predicted class (only filled for - single-label classification) - readOnly: true - deprecated: true - confidences: - type: array - x-fern-audiences: - - public - items: - type: number - x-fern-audiences: - - public - format: float - description: - An array containing the confidence scores of all the predictions in - the same order - readOnly: true - labels: - type: object - x-fern-audiences: - - public - additionalProperties: - type: object - x-fern-audiences: - - public - properties: - confidence: - type: number - x-fern-audiences: - - public - format: float - readOnly: true - readOnly: true - description: - A map containing each label and its confidence score according to - the classifier. All the confidence scores add up to - 1 for single-label classification. For multi-label - classification the label confidences are independent - of each other, so they don't have to sum up to 1. - readOnly: true - classification_type: - type: string - x-fern-audiences: - - public - enum: - - single-label - - multi-label - description: The type of classification performed - readOnly: true - required: - - id - - predictions - - confidences - - labels - - classification_type - readOnly: true - readOnly: true - meta: - $ref: "#/components/schemas/ApiMeta" - x-fern-audiences: - - public - required: - - id - - classifications - examples: - Example: - value: - id: ca245541-8841-456e-b306-293370789a30 - classifications: - - id: c50ab0d9-95d8-44de-ba90-9647a1718744 - input: Confirm your email address - prediction: Not spam - predictions: - - Not spam - confidence: 0.7581943 - confidences: - - 0.7581943 - labels: - Not spam: - confidence: 0.7581943 - Spam: - confidence: 0.24180566 - classification_type: single-label - - id: 8a841de2-027f-49d4-8c91-e88fa1865b89 - input: hey i need u to send some $ - prediction: Spam - predictions: - - Spam - confidence: 0.9965721 - confidences: - - 0.9965721 - labels: - Not spam: - confidence: 0.0034279241 - Spam: - confidence: 0.9965721 - classification_type: single-label - meta: - api_version: - version: "1" - headers: - X-API-Warning: - schema: - type: string - x-fern-audiences: - - public - description: Warning description for incorrect usage of the API - "400": - $ref: "#/components/responses/BadRequest" - "401": - $ref: "#/components/responses/Unauthorized" - "403": - $ref: "#/components/responses/Forbidden" - "404": - $ref: "#/components/responses/NotFound" - "422": - $ref: "#/components/responses/UnprocessableEntity" - "429": - $ref: "#/components/responses/RateLimit" - "498": - $ref: "#/components/responses/InvalidToken" - "499": - $ref: "#/components/responses/RequestCancelled" - "500": - $ref: "#/components/responses/InternalServerError" - "501": - $ref: "#/components/responses/NotImplemented" - "503": - $ref: "#/components/responses/ServiceUnavailable" - "504": - $ref: "#/components/responses/GatewayTimeout" - description: |- - This endpoint makes a prediction about which label fits the specified text inputs best. To make a prediction, Classify uses the provided `examples` of text + label pairs as a reference. - Note: [Fine-tuned models](https://docs.cohere.com/docs/classify-fine-tuning) trained on classification examples don't require the `examples` parameter to be passed in explicitly. - requestBody: - content: - application/json: - schema: - type: object - x-fern-audiences: - - public - x-examples: - Example: - inputs: - - Confirm your email address - - hey i need u to send some $ - examples: - - text: Dermatologists don't like her! - label: Spam - - text: Hello, open to this? - label: Spam - - text: I need help please wire me $1000 right now - label: Spam - - text: Nice to know you ;) - label: Spam - - text: Please help me? - label: Spam - - text: Your parcel will be delivered today - label: Not spam - - text: Review changes to our Terms and Conditions - label: Not spam - - text: Weekly sync notes - label: Not spam - - text: "Re: Follow up from today’s meeting" - label: Not spam - - text: Pre-read for tomorrow - label: Not spam - properties: - inputs: - type: array - x-fern-audiences: - - public - maxItems: 96 - description: |- - A list of up to 96 texts to be classified. Each one must be a non-empty string. - There is, however, no consistent, universal limit to the length a particular input can be. We perform classification on the first `x` tokens of each input, and `x` varies depending on which underlying model is powering classification. The maximum token length for each model is listed in the "max tokens" column [here](https://docs.cohere.com/docs/models). - Note: by default the `truncate` parameter is set to `END`, so tokens exceeding the limit will be automatically dropped. This behavior can be disabled by setting `truncate` to `NONE`, which will result in validation errors for longer texts. - items: - type: string - x-fern-audiences: - - public - writeOnly: true - writeOnly: true - examples: - type: array - x-fern-audiences: - - public - description: |- - An array of examples to provide context to the model. Each example is a text string and its associated label/class. Each unique label requires at least 2 examples associated with it; the maximum number of examples is 2500, and each example has a maximum length of 512 tokens. The values should be structured as `{text: "...",label: "..."}`. - Note: [Fine-tuned Models](https://docs.cohere.com/docs/classify-fine-tuning) trained on classification examples don't require the `examples` parameter to be passed in explicitly. - maxItems: 2500 - items: - x-fern-audiences: - - public - $ref: "#/components/schemas/ClassifyExample" - writeOnly: true - model: - type: string - x-fern-audiences: - - public - description: - The identifier of the model. Currently available models are - `embed-multilingual-v2.0`, `embed-english-light-v2.0`, and - `embed-english-v2.0` (default). Smaller "light" models are - faster, while larger models will perform better. [Fine-tuned - models](https://docs.cohere.com/docs/fine-tuning) can also - be supplied with their full ID. - writeOnly: true - preset: - type: string - x-fern-audiences: - - public - example: my-preset-a58sbd - description: - The ID of a custom playground preset. You can create presets in the - [playground](https://dashboard.cohere.com/playground/classify?model=large). - If you use a preset, all other parameters become optional, - and any included parameters will override the preset's - parameters. - writeOnly: true - truncate: - type: string - x-fern-audiences: - - public - default: END - enum: - - NONE - - START - - END - description: |- - One of `NONE|START|END` to specify how the API will handle inputs longer than the maximum token length. - Passing `START` will discard the start of the input. `END` will discard the end of the input. In both cases, input is discarded until the remaining input is exactly the maximum input token length for the model. - If `NONE` is selected, when the input exceeds the maximum input token length an error will be returned. - writeOnly: true - required: - - inputs - examples: - Example: - value: - inputs: - - Confirm your email address - - hey i need u to send some $ - examples: - - text: Dermatologists don't like her! - label: Spam - - text: Hello, open to this? - label: Spam - - text: I need help please wire me $1000 right now - label: Spam - - text: Nice to know you ;) - label: Spam - - text: Please help me? - label: Spam - - text: Your parcel will be delivered today - label: Not spam - - text: Review changes to our Terms and Conditions - label: Not spam - - text: Weekly sync notes - label: Not spam - - text: "Re: Follow up from today’s meeting" - label: Not spam - - text: Pre-read for tomorrow - label: Not spam - description: "" - /datasets: - post: - x-fern-audiences: - - public - summary: Create a Dataset - operationId: create-dataset - description: Create a dataset by uploading a file. See ['Dataset - Creation'](https://docs.cohere.com/docs/datasets#dataset-creation) for - more information. - tags: - - /datasets - x-fern-sdk-group-name: datasets - x-fern-sdk-method-name: create - requestBody: - content: - multipart/form-data: - schema: - type: object - x-fern-audiences: - - public - properties: - data: - type: string - x-fern-audiences: - - public - format: binary - description: The file to upload - eval_data: - type: string - x-fern-audiences: - - public - format: binary - description: An optional evaluation file to upload - required: - - data - parameters: - - in: query - name: name - required: true - schema: - type: string - x-fern-audiences: - - public - description: The name of the uploaded dataset. - - in: query - name: type - required: true - schema: - $ref: "#/components/schemas/DatasetType" - description: - The dataset type, which is used to validate the data. Valid types - are `embed-input`, `reranker-finetune-input`, - `single-label-classification-finetune-input`, `chat-finetune-input`, - and `multi-label-classification-finetune-input`. - - in: query - name: keep_original_file - schema: - type: boolean - x-fern-audiences: - - public - description: Indicates if the original file should be stored. - - in: query - name: skip_malformed_input - schema: - type: boolean - x-fern-audiences: - - public - description: - Indicates whether rows with malformed input should be dropped - (instead of failing the validation check). Dropped rows will be - returned in the warnings field. - - in: query - name: keep_fields - schema: - type: array - items: - type: string - x-fern-audiences: - - public - description: - List of names of fields that will be persisted in the Dataset. By - default the Dataset will retain only the required fields indicated - in the [schema for the corresponding Dataset - type](https://docs.cohere.com/docs/datasets#dataset-types). For - example, datasets of type `embed-input` will drop all fields other - than the required `text` field. If any of the fields in - `keep_fields` are missing from the uploaded file, Dataset validation - will fail. - - in: query - name: optional_fields - schema: - type: array - items: - type: string - x-fern-audiences: - - public - description: - List of names of fields that will be persisted in the Dataset. By - default the Dataset will retain only the required fields indicated - in the [schema for the corresponding Dataset - type](https://docs.cohere.com/docs/datasets#dataset-types). For - example, Datasets of type `embed-input` will drop all fields other - than the required `text` field. If any of the fields in - `optional_fields` are missing from the uploaded file, Dataset - validation will pass. - - in: query - name: text_separator - schema: - type: string - x-fern-audiences: - - public - description: Raw .txt uploads will be split into entries using the - text_separator value. - - in: query - name: csv_delimiter - schema: - type: string - x-fern-audiences: - - public - description: The delimiter used for .csv uploads. - - in: query - x-internal: true - name: dry_run - schema: - type: boolean - description: flag to enable dry_run mode - - $ref: "#/components/parameters/RequestSource" - x-readme: - samples-languages: - - python - - java - - python - - java - - node - - curl - - go - code-samples: - - language: go - name: Cohere Go SDK - install: go get github.com/cohere-ai/cohere-go/v2 - code: > - package main - - - import ( - "context" - "io" - "log" - "strings" - - cohere "github.com/cohere-ai/cohere-go/v2" - client "github.com/cohere-ai/cohere-go/v2/client" - ) - - - type MyReader struct { - io.Reader - name string - } - - - func (m *MyReader) Name() string { - return m.name - } - - - func main() { - co := client.NewClient(client.WithToken("<>")) - - resp, err := co.Datasets.Create( - context.TODO(), - &MyReader{Reader: strings.NewReader(`{"text": "The quick brown fox jumps over the lazy dog"}`), name: "test.jsonl"}, - &MyReader{Reader: strings.NewReader(""), name: "a.jsonl"}, - &cohere.DatasetsCreateRequest{ - Name: "prompt-completion-dataset", - Type: cohere.DatasetTypeEmbedResult, - }, - ) - - if err != nil { - log.Fatal(err) - } - - log.Printf("%+v", resp) - } - - language: python - name: Sync - install: python -m pip install cohere --upgrade - code: | - import cohere - - co = cohere.Client("<>") - - # upload a dataset - response = co.datasets.create( - name="prompt-completion-dataset", - data=open("./prompt-completion.jsonl", "rb"), - type="prompt-completion-finetune-input", - ) - - # wait for validation to complete - response = co.wait(my_dataset) - - print(response) - - language: python - name: Async - install: python -m pip install cohere --upgrade - code: | - import cohere - import asyncio - - co = cohere.AsyncClient("<>") - - - async def main(): - - # upload a dataset - response = await co.datasets.create( - name="prompt-completion-dataset", - data=open("./prompt-completion.jsonl", "rb"), - type="prompt-completion-finetune-input", - ) - - # wait for validation to complete - response = await co.wait(response) - - print(response) - - asyncio.run(main()) - - language: java - name: Cohere java SDK - install: implementation 'com.cohere:cohere-java:1.0.4' - code: > - import com.cohere.api.Cohere; - - import - com.cohere.api.resources.datasets.requests.DatasetsCreateRequest; - - import - com.cohere.api.resources.datasets.types.DatasetsCreateResponse; - - import com.cohere.api.types.DatasetType; - - - import java.util.Optional; - - - - public class DatasetPost { - public static void main(String[] args) { - Cohere cohere = Cohere.builder().token("<>").clientName("snippet").build(); - - DatasetsCreateResponse response = cohere.datasets().create(null, Optional.empty(), DatasetsCreateRequest.builder().name("prompt-completion-dataset").type(DatasetType.PROMPT_COMPLETION_FINETUNE_INPUT).build()); - - System.out.println(response); - } - } - - language: node - name: Cohere TypeScript SDK - install: npm i cohere-ai - code: > - const { CohereClient } = require('cohere-ai'); - - const fs = require('fs'); - - - const cohere = new CohereClient({ - token: '<>', - }); - - - (async () => { - const file = fs.createReadStream('embed_jobs_sample_data.jsonl'); // {"text": "The quick brown fox jumps over the lazy dog"} - - const dataset = await cohere.datasets.create({ name: 'my-dataset', type: 'embed-input' }, file); - - console.log(dataset); - })(); - - language: curl - name: cURL - code: >- - curl --request POST \ - --url "https://api.cohere.com/v1/datasets?name=my-dataset&type=generative-finetune-input" \ - --header 'Content-Type: multipart/form-data' \ - --header "Authorization: Bearer $CO_API_KEY" \ - --form file=@./path/to/file.jsonl - responses: - "200": - description: A successful response. - content: - application/json: - schema: - type: object - x-fern-audiences: - - public - properties: - id: - type: string - x-fern-audiences: - - public - description: The dataset ID - validation_status: - x-internal: true - $ref: "#/components/schemas/DatasetValidationStatus" - validation_errors: - x-internal: true - type: array - items: - type: string - description: Errors found during validation - validation_warnings: - x-internal: true - type: array - items: - type: string - description: Warnings found during validation - schema: - x-internal: true - type: string - description: the avro schema of the dataset - metrics: - x-internal: true - $ref: "#/components/schemas/Metrics" - dataset_parts: - x-internal: true - type: array - items: - type: object - properties: - name: - type: string - description: the name of the dataset part - num_rows: - type: number - description: the number of rows in the dataset part - samples: - type: array - items: - type: string - description: the first few rows of the dataset part - part_kind: - type: string - description: the kind of dataset part - description: the underlying files that make up the dataset - "400": - $ref: "#/components/responses/BadRequest" - "401": - $ref: "#/components/responses/Unauthorized" - "403": - $ref: "#/components/responses/Forbidden" - "404": - $ref: "#/components/responses/NotFound" - "422": - $ref: "#/components/responses/UnprocessableEntity" - "429": - $ref: "#/components/responses/RateLimit" - "498": - $ref: "#/components/responses/InvalidToken" - "499": - $ref: "#/components/responses/RequestCancelled" - "500": - $ref: "#/components/responses/InternalServerError" - "501": - $ref: "#/components/responses/NotImplemented" - "503": - $ref: "#/components/responses/ServiceUnavailable" - "504": - $ref: "#/components/responses/GatewayTimeout" - get: - x-fern-audiences: - - public - summary: List Datasets - operationId: list-datasets - description: List datasets that have been created. - tags: - - /datasets - x-fern-sdk-group-name: datasets - x-fern-sdk-method-name: list - parameters: - - name: datasetType - in: query - description: optional filter by dataset type - schema: - type: string - x-fern-audiences: - - public - - name: before - in: query - description: optional filter before a date - schema: - type: string - x-fern-audiences: - - public - format: date-time - - name: after - in: query - description: optional filter after a date - schema: - type: string - x-fern-audiences: - - public - format: date-time - - name: limit - in: query - description: optional limit to number of results - schema: - type: number - x-fern-audiences: - - public - - name: offset - in: query - description: optional offset to start of results - schema: - type: number - x-fern-audiences: - - public - - name: validationStatus - in: query - description: optional filter by validation status - schema: - $ref: "#/components/schemas/DatasetValidationStatus" - - $ref: "#/components/parameters/RequestSource" - x-readme: - samples-languages: - - python - - java - - python - - java - - node - - curl - - go - code-samples: - - language: go - name: Cohere Go SDK - install: go get github.com/cohere-ai/cohere-go/v2 - code: | - package main - - import ( - "context" - "log" - - client "github.com/cohere-ai/cohere-go/v2/client" - ) - - func main() { - co := client.NewClient(client.WithToken("<>")) - - resp, err := co.Datasets.Get(context.TODO(), "dataset_id") - - if err != nil { - log.Fatal(err) - } - - log.Printf("%+v", resp) - } - - language: python - name: Sync - install: python -m pip install cohere --upgrade - code: | - import cohere - - co = cohere.Client("<>") - - # get dataset - response = co.datasets.get(id="<>") - - print(response) - - language: python - name: Async - install: python -m pip install cohere --upgrade - code: | - import cohere - import asyncio - - co = cohere.AsyncClient("<>") - - - async def main(): - response = await co.datasets.get(id="<>") - - print(response) - - asyncio.run(main()) - - language: java - name: Cohere java SDK - install: implementation 'com.cohere:cohere-java:1.0.4' - code: > - import com.cohere.api.Cohere; - - import - com.cohere.api.resources.datasets.types.DatasetsGetResponse; - - - - public class DatasetGet { - public static void main(String[] args) { - Cohere cohere = Cohere.builder().token("<>").clientName("snippet").build(); - - DatasetsGetResponse response = cohere.datasets().get("dataset_id"); - - System.out.println(response); - } - } - - language: node - name: Cohere TypeScript SDK - install: npm i cohere-ai - code: | - const { CohereClient } = require('cohere-ai'); - - const cohere = new CohereClient({ - token: '<>', - }); - - (async () => { - const datasets = await cohere.datasets.get('<>'); - - console.log(datasets); - })(); - - language: curl - name: cURL - code: |- - curl --request GET \ - --url https://api.cohere.com/v1/datasets \ - --header 'accept: application/json' \ - --header "Authorization: bearer $CO_API_KEY" - responses: - "200": - description: A successful response. - content: - application/json: - schema: - type: object - x-fern-audiences: - - public - properties: - datasets: - type: array - x-fern-audiences: - - public - items: - $ref: "#/components/schemas/Dataset" - "400": - $ref: "#/components/responses/BadRequest" - "401": - $ref: "#/components/responses/Unauthorized" - "403": - $ref: "#/components/responses/Forbidden" - "404": - $ref: "#/components/responses/NotFound" - "422": - $ref: "#/components/responses/UnprocessableEntity" - "429": - $ref: "#/components/responses/RateLimit" - "498": - $ref: "#/components/responses/InvalidToken" - "499": - $ref: "#/components/responses/RequestCancelled" - "500": - $ref: "#/components/responses/InternalServerError" - "501": - $ref: "#/components/responses/NotImplemented" - "503": - $ref: "#/components/responses/ServiceUnavailable" - "504": - $ref: "#/components/responses/GatewayTimeout" - /datasets/usage: - get: - x-fern-audiences: - - public - summary: Get Dataset Usage - operationId: get-dataset-usage - description: View the dataset storage usage for your Organization. Each - Organization can have up to 10GB of storage across all their users. - tags: - - /datasets - parameters: - - $ref: "#/components/parameters/RequestSource" - x-fern-sdk-group-name: datasets - x-fern-sdk-method-name: getUsage - x-readme: - samples-languages: - - python - - java - - python - - java - - node - - curl - - go - code-samples: - - language: go - name: Cohere Go SDK - install: go get github.com/cohere-ai/cohere-go/v2 - code: | - package main - - import ( - "context" - "log" - - client "github.com/cohere-ai/cohere-go/v2/client" - ) - - func main() { - co := client.NewClient(client.WithToken("<>")) - - resp, err := co.Datasets.GetUsage(context.TODO()) - - if err != nil { - log.Fatal(err) - } - - log.Printf("%+v", resp) - } - - language: python - name: Sync - install: python -m pip install cohere --upgrade - code: | - import cohere - - co = cohere.Client("<>") - - # get usage - response = co.datasets.get_usage() - - print(response) - - language: python - name: Async - install: python -m pip install cohere --upgrade - code: | - import cohere - import asyncio - - co = cohere.AsyncClient("<>") - - - async def main(): - response = await co.datasets.get_usage() - - print(response) - - asyncio.run(main()) - - language: java - name: Cohere java SDK - install: implementation 'com.cohere:cohere-java:1.0.4' - code: > - import com.cohere.api.Cohere; - - import - com.cohere.api.resources.datasets.types.DatasetsGetUsageResponse; - - - - public class DatasetUsageGet { - public static void main(String[] args) { - Cohere cohere = Cohere.builder().token("<>").clientName("snippet").build(); - - DatasetsGetUsageResponse response = cohere.datasets().getUsage(); - - System.out.println(response); - } - } - - language: node - name: Cohere TypeScript SDK - install: npm i cohere-ai - code: | - const { CohereClient } = require('cohere-ai'); - - const cohere = new CohereClient({ - token: '<>', - }); - - (async () => { - const usage = await cohere.datasets.getUsage('id'); - - console.log(usage); - })(); - - language: curl - name: cURL - code: |- - curl --request GET \ - --url https://api.cohere.com/v1/datasets/usage \ - --header 'accept: application/json' \ - --header "Authorization: bearer $CO_API_KEY" - responses: - "200": - description: A successful response. - content: - application/json: - schema: - type: object - x-fern-audiences: - - public - properties: - organization_usage: - type: number - x-fern-audiences: - - public - # format: int64 - format: long - description: The total number of bytes used by the organization. - "400": - $ref: "#/components/responses/BadRequest" - "401": - $ref: "#/components/responses/Unauthorized" - "403": - $ref: "#/components/responses/Forbidden" - "404": - $ref: "#/components/responses/NotFound" - "422": - $ref: "#/components/responses/UnprocessableEntity" - "429": - $ref: "#/components/responses/RateLimit" - "498": - $ref: "#/components/responses/InvalidToken" - "499": - $ref: "#/components/responses/RequestCancelled" - "500": - $ref: "#/components/responses/InternalServerError" - "501": - $ref: "#/components/responses/NotImplemented" - "503": - $ref: "#/components/responses/ServiceUnavailable" - "504": - $ref: "#/components/responses/GatewayTimeout" - "/datasets/{id}": - get: - x-fern-audiences: - - public - summary: Get a Dataset - operationId: get-dataset - description: Retrieve a dataset by ID. See - ['Datasets'](https://docs.cohere.com/docs/datasets) for more - information. - tags: - - /datasets - x-fern-sdk-group-name: datasets - x-fern-sdk-method-name: get - parameters: - - name: id - in: path - required: true - schema: - type: string - x-fern-audiences: - - public - pattern: ^(?!usage$).*$ - - $ref: "#/components/parameters/RequestSource" - x-readme: - samples-languages: - - python - - java - - python - - java - - node - - curl - - go - code-samples: - - language: go - name: Cohere Go SDK - install: go get github.com/cohere-ai/cohere-go/v2 - code: | - package main - - import ( - "context" - "log" - - client "github.com/cohere-ai/cohere-go/v2/client" - ) - - func main() { - co := client.NewClient(client.WithToken("<>")) - - resp, err := co.Datasets.Get(context.TODO(), "dataset_id") - - if err != nil { - log.Fatal(err) - } - - log.Printf("%+v", resp) - } - - language: python - name: Sync - install: python -m pip install cohere --upgrade - code: | - import cohere - - co = cohere.Client("<>") - - # get dataset - response = co.datasets.get(id="<>") - - print(response) - - language: python - name: Async - install: python -m pip install cohere --upgrade - code: | - import cohere - import asyncio - - co = cohere.AsyncClient("<>") - - - async def main(): - response = await co.datasets.get(id="<>") - - print(response) - - asyncio.run(main()) - - language: java - name: Cohere java SDK - install: implementation 'com.cohere:cohere-java:1.0.4' - code: > - import com.cohere.api.Cohere; - - import - com.cohere.api.resources.datasets.types.DatasetsGetResponse; - - - - public class DatasetGet { - public static void main(String[] args) { - Cohere cohere = Cohere.builder().token("<>").clientName("snippet").build(); - - DatasetsGetResponse response = cohere.datasets().get("dataset_id"); - - System.out.println(response); - } - } - - language: node - name: Cohere TypeScript SDK - install: npm i cohere-ai - code: | - const { CohereClient } = require('cohere-ai'); - - const cohere = new CohereClient({ - token: '<>', - }); - - (async () => { - const datasets = await cohere.datasets.get('<>'); - - console.log(datasets); - })(); - - language: curl - name: cURL - code: |- - curl --request GET \ - --url https://api.cohere.com/v1/datasets \ - --header 'accept: application/json' \ - --header "Authorization: bearer $CO_API_KEY" - responses: - "200": - description: A successful response. - content: - application/json: - schema: - type: object - x-fern-audiences: - - public - required: - - dataset - properties: - dataset: - $ref: "#/components/schemas/Dataset" - "400": - $ref: "#/components/responses/BadRequest" - "401": - $ref: "#/components/responses/Unauthorized" - "403": - $ref: "#/components/responses/Forbidden" - "404": - $ref: "#/components/responses/NotFound" - "422": - $ref: "#/components/responses/UnprocessableEntity" - "429": - $ref: "#/components/responses/RateLimit" - "498": - $ref: "#/components/responses/InvalidToken" - "499": - $ref: "#/components/responses/RequestCancelled" - "500": - $ref: "#/components/responses/InternalServerError" - "501": - $ref: "#/components/responses/NotImplemented" - "503": - $ref: "#/components/responses/ServiceUnavailable" - "504": - $ref: "#/components/responses/GatewayTimeout" - delete: - x-fern-audiences: - - public - summary: Delete a Dataset - operationId: delete-dataset - description: - Delete a dataset by ID. Datasets are automatically deleted after 30 - days, but they can also be deleted manually. - tags: - - /datasets - x-fern-sdk-group-name: datasets - x-fern-sdk-method-name: delete - parameters: - - name: id - in: path - required: true - schema: - type: string - x-fern-audiences: - - public - pattern: ^(?!usage$).*$ - - $ref: "#/components/parameters/RequestSource" - x-readme: - samples-languages: - - python - - java - - python - - java - - node - - curl - - go - code-samples: - - language: go - name: Cohere Go SDK - install: go get github.com/cohere-ai/cohere-go/v2 - code: | - package main - - import ( - "context" - "log" - - client "github.com/cohere-ai/cohere-go/v2/client" - ) - - func main() { - co := client.NewClient(client.WithToken("<>")) - - _, err := co.Datasets.Delete(context.TODO(), "dataset_id") - - if err != nil { - log.Fatal(err) - } - - } - - language: python - name: Sync - install: python -m pip install cohere --upgrade - code: | - import cohere - - co = cohere.Client("<>") - - # delete dataset - co.datasets.delete("id") - - language: python - name: Async - install: python -m pip install cohere --upgrade - code: | - import cohere - import asyncio - - co = cohere.AsyncClient("<>") - - - async def main(): - await co.delete_dataset("id") - - asyncio.run(main()) - - language: java - name: Cohere java SDK - install: implementation 'com.cohere:cohere-java:1.0.4' - code: > - import com.cohere.api.Cohere; - - - - public class DatasetDelete { - public static void main(String[] args) { - Cohere cohere = Cohere.builder().token("<>").clientName("snippet").build(); - - cohere.datasets().delete("id"); - - } - } - - language: curl - name: cURL - code: |- - curl --request DELETE \ - --url https://api.cohere.com/v1/datasets/id \ - --header 'accept: application/json' \ - --header 'content-type: application/json' \ - --header "Authorization: bearer $CO_API_KEY" - responses: - "200": - description: A successful response. - content: - application/json: - schema: - type: object - x-fern-audiences: - - public - "400": - $ref: "#/components/responses/BadRequest" - "401": - $ref: "#/components/responses/Unauthorized" - "403": - $ref: "#/components/responses/Forbidden" - "404": - $ref: "#/components/responses/NotFound" - "422": - $ref: "#/components/responses/UnprocessableEntity" - "429": - $ref: "#/components/responses/RateLimit" - "498": - $ref: "#/components/responses/InvalidToken" - "499": - $ref: "#/components/responses/RequestCancelled" - "500": - $ref: "#/components/responses/InternalServerError" - "501": - $ref: "#/components/responses/NotImplemented" - "503": - $ref: "#/components/responses/ServiceUnavailable" - "504": - $ref: "#/components/responses/GatewayTimeout" - /summarize: - post: - x-fern-audiences: - - public - summary: Summarize - operationId: summarize - parameters: - - $ref: "#/components/parameters/RequestSource" - x-readme: - samples-languages: - - python - - java - - curl - - node - - go - code-samples: - - language: go - name: Cohere Go SDK - install: go get github.com/cohere-ai/cohere-go/v2 - code: > - package main - - - import ( - "context" - "log" - - cohere "github.com/cohere-ai/cohere-go/v2" - client "github.com/cohere-ai/cohere-go/v2/client" - ) - - - func main() { - co := client.NewClient(client.WithToken("<>")) - - resp, err := co.Summarize( - context.TODO(), - &cohere.SummarizeRequest{ - Text: "the quick brown fox jumped over the lazy dog and then the dog jumped over the fox the quick brown fox jumped over the lazy dog the quick brown fox jumped over the lazy dog the quick brown fox jumped over the lazy dog the quick brown fox jumped over the lazy dog", - }, - ) - - if err != nil { - log.Fatal(err) - } - - log.Printf("%+v", resp) - } - - language: node - name: Cohere TypeScript SDK - install: npm i cohere-ai - code: > - const { CohereClient } = require('cohere-ai'); - - - const cohere = new CohereClient({ - token: '<>', - }); - - - (async () => { - const summarize = await cohere.summarize({ - text: - 'Ice cream is a sweetened frozen food typically eaten as a snack or dessert. ' + - 'It may be made from milk or cream and is flavoured with a sweetener, ' + - 'either sugar or an alternative, and a spice, such as cocoa or vanilla, ' + - 'or with fruit such as strawberries or peaches. ' + - 'It can also be made by whisking a flavored cream base and liquid nitrogen together. ' + - 'Food coloring is sometimes added, in addition to stabilizers. ' + - 'The mixture is cooled below the freezing point of water and stirred to incorporate air spaces ' + - 'and to prevent detectable ice crystals from forming. The result is a smooth, ' + - 'semi-solid foam that is solid at very low temperatures (below 2 °C or 35 °F). ' + - 'It becomes more malleable as its temperature increases.\n\n' + - 'The meaning of the name "ice cream" varies from one country to another. ' + - 'In some countries, such as the United States, "ice cream" applies only to a specific variety, ' + - 'and most governments regulate the commercial use of the various terms according to the ' + - 'relative quantities of the main ingredients, notably the amount of cream. ' + - 'Products that do not meet the criteria to be called ice cream are sometimes labelled ' + - '"frozen dairy dessert" instead. In other countries, such as Italy and Argentina, ' + - 'one word is used fo\r all variants. Analogues made from dairy alternatives, ' + - "such as goat's or sheep's milk, or milk substitutes " + - '(e.g., soy, cashew, coconut, almond milk or tofu), are available for those who are ' + - 'lactose intolerant, allergic to dairy protein or vegan.', - }); - - console.log(summarize); - })(); - - language: python - name: Sync - install: python -m pip install cohere --upgrade - code: > - import cohere - - - co = cohere.Client("<>") - - - text = ( - "Ice cream is a sweetened frozen food typically eaten as a snack or dessert. " - "It may be made from milk or cream and is flavoured with a sweetener, " - "either sugar or an alternative, and a spice, such as cocoa or vanilla, " - "or with fruit such as strawberries or peaches. " - "It can also be made by whisking a flavored cream base and liquid nitrogen together. " - "Food coloring is sometimes added, in addition to stabilizers. " - "The mixture is cooled below the freezing point of water and stirred to incorporate air spaces " - "and to prevent detectable ice crystals from forming. The result is a smooth, " - "semi-solid foam that is solid at very low temperatures (below 2 °C or 35 °F). " - "It becomes more malleable as its temperature increases.\n\n" - 'The meaning of the name "ice cream" varies from one country to another. ' - 'In some countries, such as the United States, "ice cream" applies only to a specific variety, ' - "and most governments regulate the commercial use of the various terms according to the " - "relative quantities of the main ingredients, notably the amount of cream. " - "Products that do not meet the criteria to be called ice cream are sometimes labelled " - '"frozen dairy dessert" instead. In other countries, such as Italy and Argentina, ' - "one word is used fo\r all variants. Analogues made from dairy alternatives, " - "such as goat's or sheep's milk, or milk substitutes " - "(e.g., soy, cashew, coconut, almond milk or tofu), are available for those who are " - "lactose intolerant, allergic to dairy protein or vegan." - ) - - - response = co.summarize( - text=text, - ) - - print(response) - - language: python - name: Async - install: python -m pip install cohere --upgrade - code: > - import cohere - - import asyncio - - - co = cohere.AsyncClient("<>") - - - text = ( - "Ice cream is a sweetened frozen food typically eaten as a snack or dessert. " - "It may be made from milk or cream and is flavoured with a sweetener, " - "either sugar or an alternative, and a spice, such as cocoa or vanilla, " - "or with fruit such as strawberries or peaches. " - "It can also be made by whisking a flavored cream base and liquid nitrogen together. " - "Food coloring is sometimes added, in addition to stabilizers. " - "The mixture is cooled below the freezing point of water and stirred to incorporate air spaces " - "and to prevent detectable ice crystals from forming. The result is a smooth, " - "semi-solid foam that is solid at very low temperatures (below 2 °C or 35 °F). " - "It becomes more malleable as its temperature increases.\n\n" - 'The meaning of the name "ice cream" varies from one country to another. ' - 'In some countries, such as the United States, "ice cream" applies only to a specific variety, ' - "and most governments regulate the commercial use of the various terms according to the " - "relative quantities of the main ingredients, notably the amount of cream. " - "Products that do not meet the criteria to be called ice cream are sometimes labelled " - '"frozen dairy dessert" instead. In other countries, such as Italy and Argentina, ' - "one word is used fo\r all variants. Analogues made from dairy alternatives, " - "such as goat's or sheep's milk, or milk substitutes " - "(e.g., soy, cashew, coconut, almond milk or tofu), are available for those who are " - "lactose intolerant, allergic to dairy protein or vegan." - ) - - - - async def main(): - response = await co.summarize( - text=text, - ) - print(response) - - asyncio.run(main()) - - language: java - name: Cohere java SDK - install: implementation 'com.cohere:cohere-java:1.0.4' - code: > - import com.cohere.api.Cohere; - - import com.cohere.api.requests.SummarizeRequest; - - import com.cohere.api.types.SummarizeResponse; - - - - public class SummarizePost { - public static void main(String[] args) { - Cohere cohere = Cohere.builder().token("<>").clientName("snippet").build(); - - SummarizeResponse response = cohere.summarize(SummarizeRequest.builder().text( - """ - Ice cream is a sweetened frozen food typically eaten as a snack or dessert.\s - It may be made from milk or cream and is flavoured with a sweetener,\s - either sugar or an alternative, and a spice, such as cocoa or vanilla,\s - or with fruit such as strawberries or peaches.\s - It can also be made by whisking a flavored cream base and liquid nitrogen together.\s - Food coloring is sometimes added, in addition to stabilizers.\s - The mixture is cooled below the freezing point of water and stirred to incorporate air spaces\s - and to prevent detectable ice crystals from forming. The result is a smooth,\s - semi-solid foam that is solid at very low temperatures (below 2 °C or 35 °F).\s - It becomes more malleable as its temperature increases.\\n\\n - The meaning of the name "ice cream" varies from one country to another.\s - In some countries, such as the United States, "ice cream" applies only to a specific variety,\s - and most governments regulate the commercial use of the various terms according to the\s - relative quantities of the main ingredients, notably the amount of cream.\s - Products that do not meet the criteria to be called ice cream are sometimes labelled\s - "frozen dairy dessert" instead. In other countries, such as Italy and Argentina,\s - one word is used fo\\r all variants. Analogues made from dairy alternatives,\s - such as goat's or sheep's milk, or milk substitutes\s - (e.g., soy, cashew, coconut, almond milk or tofu), are available for those who are\s - lactose intolerant, allergic to dairy protein or vegan. - """ - ).build()); - - System.out.println(response); - } - } - - language: curl - name: cURL - code: >- - curl --request POST \ - --url https://api.cohere.com/v1/summarize \ - --header 'accept: application/json' \ - --header 'content-type: application/json' \ - --header "Authorization: bearer $CO_API_KEY" \ - --data '{ - "text": "Ice cream is a sweetened frozen food typically eaten as a snack or dessert. It may be made from milk or cream and is flavoured with a sweetener, either sugar or an alternative, and a spice, such as cocoa or vanilla, or with fruit such as strawberries or peaches. It can also be made by whisking a flavored cream base and liquid nitrogen together. Food coloring is sometimes added, in addition to stabilizers. The mixture is cooled below the freezing point of water and stirred to incorporate air spaces and to prevent detectable ice crystals from forming. The result is a smooth, semi-solid foam that is solid at very low temperatures (below 2 °C or 35 °F). It becomes more malleable as its temperature increases.\n\nThe meaning of the name \"ice cream\" varies from one country to another. In some countries, such as the United States, \"ice cream\" applies only to a specific variety, and most governments regulate the commercial use of the various terms according to the relative quantities of the main ingredients, notably the amount of cream. Products that do not meet the criteria to be called ice cream are sometimes labelled \"frozen dairy dessert\" instead. In other countries, such as Italy and Argentina, one word is used for all variants. Analogues made from dairy alternatives, such as goat'\''s or sheep'\''s milk, or milk substitutes (e.g., soy, cashew, coconut, almond milk or tofu), are available for those who are lactose intolerant, allergic to dairy protein or vegan." - }' - responses: - "200": - description: OK - headers: - X-API-Warning: - schema: - type: string - x-fern-audiences: - - public - description: Warning description for incorrect usage of the API - content: - application/json: - schema: - type: object - x-fern-audiences: - - public - properties: - id: - type: string - x-fern-audiences: - - public - description: Generated ID for the summary - summary: - type: string - x-fern-audiences: - - public - description: Generated summary for the text - meta: - $ref: "#/components/schemas/ApiMeta" - x-fern-audiences: - - public - "400": - $ref: "#/components/responses/BadRequest" - "401": - $ref: "#/components/responses/Unauthorized" - "403": - $ref: "#/components/responses/Forbidden" - "404": - $ref: "#/components/responses/NotFound" - "422": - $ref: "#/components/responses/UnprocessableEntity" - "429": - $ref: "#/components/responses/RateLimit" - "498": - $ref: "#/components/responses/InvalidToken" - "499": - $ref: "#/components/responses/RequestCancelled" - "500": - $ref: "#/components/responses/InternalServerError" - "501": - $ref: "#/components/responses/NotImplemented" - "503": - $ref: "#/components/responses/ServiceUnavailable" - "504": - $ref: "#/components/responses/GatewayTimeout" - description: | - > 🚧 Warning - > - > This API is marked as "Legacy" and is no longer maintained. Follow the [migration guide](/docs/migrating-from-cogenerate-to-cochat) to start using the Chat API. - - Generates a summary in English for a given text. - requestBody: - content: - application/json: - schema: - type: object - x-fern-audiences: - - public - properties: - text: - type: string - x-fern-audiences: - - public - description: - The text to generate a summary for. Can be up to 100,000 characters - long. Currently the only supported language is English. - minLength: 250 - maxLength: 50000 - writeOnly: true - length: - type: string - x-fern-audiences: - - public - description: - One of `short`, `medium`, `long`, or `auto` defaults to `auto`. - Indicates the approximate length of the summary. If `auto` - is selected, the best option will be picked based on the - input text. - default: medium - enum: - - short - - medium - - long - writeOnly: true - format: - type: string - x-fern-audiences: - - public - default: paragraph - enum: - - paragraph - - bullets - description: - One of `paragraph`, `bullets`, or `auto`, defaults to `auto`. - Indicates the style in which the summary will be delivered - - in a free form paragraph or in bullet points. If `auto` is - selected, the best option will be picked based on the input - text. - writeOnly: true - model: - type: string - x-fern-audiences: - - public - description: - The identifier of the model to generate the summary with. Currently - available models are `command` (default), `command-nightly` - (experimental), `command-light`, and `command-light-nightly` - (experimental). Smaller, "light" models are faster, while - larger models will perform better. - writeOnly: true - extractiveness: - type: string - x-fern-audiences: - - public - description: - One of `low`, `medium`, `high`, or `auto`, defaults to `auto`. - Controls how close to the original text the summary is. - `high` extractiveness summaries will lean towards reusing - sentences verbatim, while `low` extractiveness summaries - will tend to paraphrase more. If `auto` is selected, the - best option will be picked based on the input text. - default: low - enum: - - low - - medium - - high - writeOnly: true - temperature: - type: number - x-fern-audiences: - - public - description: - Ranges from 0 to 5. Controls the randomness of the output. Lower - values tend to generate more “predictable” output, while - higher values tend to generate more “creative” output. The - sweet spot is typically between 0 and 1. - default: 0.3 - minimum: 0 - maximum: 5 - writeOnly: true - additional_command: - type: string - x-fern-audiences: - - public - description: - A free-form instruction for modifying how the summaries get - generated. Should complete the sentence "Generate a summary - _". Eg. "focusing on the next steps" or "written by Yoda" - writeOnly: true - required: - - text - examples: - Example: - value: - text: - "Ice cream is a sweetened frozen food typically eaten as a snack or - dessert. It may be made from milk or cream and is flavoured - with a sweetener, either sugar or an alternative, and a - spice, such as cocoa or vanilla, or with fruit such as - strawberries or peaches. It can also be made by whisking a - flavored cream base and liquid nitrogen together. Food - coloring is sometimes added, in addition to stabilizers. The - mixture is cooled below the freezing point of water and - stirred to incorporate air spaces and to prevent detectable - ice crystals from forming. The result is a smooth, - semi-solid foam that is solid at very low temperatures - (below 2 °C or 35 °F). It becomes more malleable as its - temperature increases. - - - The meaning of the name \"ice cream\" varies from one - country to another. In some countries, such as the United - States, \"ice cream\" applies only to a specific variety, - and most governments regulate the commercial use of the - various terms according to the relative quantities of the - main ingredients, notably the amount of cream. Products that - do not meet the criteria to be called ice cream are - sometimes labelled \"frozen dairy dessert\" instead. In - other countries, such as Italy and Argentina, one word is - used fo\r all variants. Analogues made from dairy - alternatives, such as goat's or sheep's milk, or milk - substitutes (e.g., soy, cashew, coconut, almond milk or - tofu), are available for those who are lactose intolerant, - allergic to dairy protein or vegan." - description: "" - /tokenize: - post: - x-fern-audiences: - - public - summary: Tokenize - operationId: tokenize - parameters: - - $ref: "#/components/parameters/RequestSource" - x-readme: - samples-languages: - - python - - java - - curl - - node - - go - code-samples: - - language: go - name: Cohere Go SDK - install: go get github.com/cohere-ai/cohere-go/v2 - code: | - package main - - import ( - "context" - "log" - - cohere "github.com/cohere-ai/cohere-go/v2" - client "github.com/cohere-ai/cohere-go/v2/client" - ) - - func main() { - co := client.NewClient(client.WithToken("<>")) - - resp, err := co.Tokenize( - context.TODO(), - &cohere.TokenizeRequest{ - Text: "cohere <3", - Model: "base", - }, - ) - - if err != nil { - log.Fatal(err) - } - - log.Printf("%+v", resp) - } - - language: node - name: Cohere TypeScript SDK - install: npm i cohere-ai - code: | - const cohere = require('cohere-ai'); - cohere.init('<>')(async () => { - const response = await cohere.tokenize({ - text: 'tokenize me! :D', - model: 'command', // optional - }); - console.log(response); - })(); - - language: python - name: Sync - install: python -m pip install cohere --upgrade - code: > - import cohere - - - co = cohere.Client("<>") - - - response = co.tokenize(text="tokenize me! :D", model="command") # - optional - - print(response) - - language: python - name: Async - install: python -m pip install cohere --upgrade - code: > - import cohere - - import asyncio - - - co = cohere.AsyncClient("<>") - - - - async def main(): - response = await co.tokenize(text="tokenize me! :D", model="command") - print(response) - - asyncio.run(main()) - - language: java - name: Cohere java SDK - install: implementation 'com.cohere:cohere-java:1.0.4' - code: > - import com.cohere.api.Cohere; - - import com.cohere.api.requests.TokenizeRequest; - - import com.cohere.api.types.TokenizeResponse; - - - - public class TokenizePost { - public static void main(String[] args) { - Cohere cohere = Cohere.builder().token("<>").clientName("snippet").build(); - - TokenizeResponse response = cohere.tokenize(TokenizeRequest.builder().text("tokenize me").model("command").build()); - - System.out.println(response); - } - } - - language: node - name: Cohere Node.js SDK - install: npm install cohere-ai - code: | - const cohere = require('cohere-ai'); - cohere.init('<>')(async () => { - const response = await cohere.tokenize({ - text: 'tokenize me! :D', - model: 'command', // optional - }); - console.log(response); - })(); - - language: curl - name: cURL - code: |- - curl --request POST \ - --url https://api.cohere.com/v1/tokenize \ - --header 'accept: application/json' \ - --header 'content-type: application/json' \ - --header "Authorization: bearer $CO_API_KEY" \ - --data '{ - "model": "command", - "text": "tokenize me! :D" - }' - responses: - "200": - description: OK - headers: - X-API-Warning: - schema: - type: string - x-fern-audiences: - - public - description: Warning description for incorrect usage of the API - content: - application/json: - schema: - type: object - x-fern-audiences: - - public - properties: - tokens: - type: array - x-fern-audiences: - - public - description: An array of tokens, where each token is an integer. - items: - type: integer - x-fern-audiences: - - public - readOnly: true - readOnly: true - token_strings: - type: array - x-fern-audiences: - - public - items: - type: string - x-fern-audiences: - - public - meta: - $ref: "#/components/schemas/ApiMeta" - x-fern-audiences: - - public - required: - - tokens - - token_strings - examples: - Example: - value: - tokens: - - 34160 - - 974 - - 514 - - 34 - - 1420 - - 69 - token_strings: - - token - - ize' - - " me" - - "!" - - " :" - - D - meta: - api_version: - version: "1" - "400": - $ref: "#/components/responses/BadRequest" - "401": - $ref: "#/components/responses/Unauthorized" - "403": - $ref: "#/components/responses/Forbidden" - "404": - $ref: "#/components/responses/NotFound" - "422": - $ref: "#/components/responses/UnprocessableEntity" - "429": - $ref: "#/components/responses/RateLimit" - "498": - $ref: "#/components/responses/InvalidToken" - "499": - $ref: "#/components/responses/RequestCancelled" - "500": - $ref: "#/components/responses/InternalServerError" - "501": - $ref: "#/components/responses/NotImplemented" - "503": - $ref: "#/components/responses/ServiceUnavailable" - "504": - $ref: "#/components/responses/GatewayTimeout" - description: - This endpoint splits input text into smaller units called tokens - using byte-pair encoding (BPE). To learn more about tokenization and - byte pair encoding, see the tokens page. - requestBody: - content: - application/json: - schema: - type: object - x-fern-audiences: - - public - properties: - text: - type: string - x-fern-audiences: - - public - description: - The string to be tokenized, the minimum text length is 1 character, - and the maximum text length is 65536 characters. - minLength: 1 - maxLength: 65536 - model: - type: string - x-fern-audiences: - - public - description: - An optional parameter to provide the model name. This will ensure - that the tokenization uses the tokenizer used by that model. - required: - - text - - model - examples: - Example: - value: - text: tokenize me! :D - model: command - description: "" - /detokenize: - post: - x-fern-audiences: - - public - summary: Detokenize - operationId: detokenize - parameters: - - $ref: "#/components/parameters/RequestSource" - x-readme: - samples-languages: - - python - - java - - curl - - node - - go - code-samples: - - language: go - name: Cohere Go SDK - install: go get github.com/cohere-ai/cohere-go/v2 - code: | - package main - - import ( - "context" - "log" - - cohere "github.com/cohere-ai/cohere-go/v2" - client "github.com/cohere-ai/cohere-go/v2/client" - ) - - func main() { - co := client.NewClient(client.WithToken("<>")) - - resp, err := co.Detokenize( - context.TODO(), - &cohere.DetokenizeRequest{ - Tokens: []int{10002, 1706, 1722, 5169, 4328}, - }, - ) - - if err != nil { - log.Fatal(err) - } - - log.Printf("%+v", resp) - } - - language: node - name: Cohere TypeScript SDK - install: npm i cohere-ai - code: | - const { CohereClient } = require('cohere-ai'); - - const cohere = new CohereClient({ - token: '<>', - }); - - (async () => { - const detokenize = await cohere.detokenize({ - tokens: [10002, 2261, 2012, 8, 2792, 43], - model: 'command', - }); - - console.log(detokenize); - })(); - - language: python - name: Sync - install: python -m pip install cohere --upgrade - code: > - import cohere - - - co = cohere.Client("<>") - - - response = co.detokenize( - tokens=[8466, 5169, 2594, 8, 2792, 43], model="command" # optional - ) - - print(response) - - language: python - name: Async - install: python -m pip install cohere --upgrade - code: > - import cohere - - import asyncio - - - co = cohere.AsyncClient("<>") - - - - async def main(): - response = await co.detokenize( - tokens=[8466, 5169, 2594, 8, 2792, 43], model="command" # optional - ) - print(response) - - asyncio.run(main()) - - language: java - name: Cohere java SDK - install: implementation 'com.cohere:cohere-java:1.0.4' - code: > - import com.cohere.api.Cohere; - - import com.cohere.api.requests.DetokenizeRequest; - - import com.cohere.api.types.DetokenizeResponse; - - - import java.util.List; - - - - public class DetokenizePost { - public static void main(String[] args) { - Cohere cohere = Cohere.builder().token("<>").clientName("snippet").build(); - - DetokenizeResponse response = cohere.detokenize( - DetokenizeRequest.builder().model("command").tokens(List.of(8466, 5169, 2594, 8, 2792, 43)).build() - ); - - System.out.println(response); - } - } - - language: curl - name: cURL - code: |- - curl --request POST \ - --url https://api.cohere.com/v1/detokenize \ - --header 'accept: application/json' \ - --header 'content-type: application/json' \ - --header "Authorization: bearer $CO_API_KEY" \ - --data '{ - "model": "command", - "tokens": [8466, 5169, 2594, 8, 2792, 43] - }' - responses: - "200": - description: OK - headers: - X-API-Warning: - schema: - type: string - x-fern-audiences: - - public - description: Warning description for incorrect usage of the API - content: - application/json: - schema: - type: object - x-fern-audiences: - - public - properties: - text: - type: string - x-fern-audiences: - - public - description: A string representing the list of tokens. - readOnly: true - meta: - $ref: "#/components/schemas/ApiMeta" - x-fern-audiences: - - public - required: - - text - examples: - Example: - value: - text: detokenized! :D - meta: - api_version: - version: "1" - "400": - $ref: "#/components/responses/BadRequest" - "401": - $ref: "#/components/responses/Unauthorized" - "403": - $ref: "#/components/responses/Forbidden" - "404": - $ref: "#/components/responses/NotFound" - "422": - $ref: "#/components/responses/UnprocessableEntity" - "429": - $ref: "#/components/responses/RateLimit" - "498": - $ref: "#/components/responses/InvalidToken" - "499": - $ref: "#/components/responses/RequestCancelled" - "500": - $ref: "#/components/responses/InternalServerError" - "501": - $ref: "#/components/responses/NotImplemented" - "503": - $ref: "#/components/responses/ServiceUnavailable" - "504": - $ref: "#/components/responses/GatewayTimeout" - description: - This endpoint takes tokens using byte-pair encoding and returns - their text representation. To learn more about tokenization and byte - pair encoding, see the tokens page. - requestBody: - content: - application/json: - schema: - type: object - x-fern-audiences: - - public - properties: - tokens: - type: array - x-fern-audiences: - - public - description: The list of tokens to be detokenized. - minItems: 1 - maxItems: 65536 - items: - type: integer - x-fern-audiences: - - public - writeOnly: true - model: - type: string - x-fern-audiences: - - public - description: - An optional parameter to provide the model name. This will ensure - that the detokenization is done by the tokenizer used by - that model. - required: - - tokens - - model - examples: - Example: - value: - tokens: - - 10104 - - 12221 - - 1315 - - 34 - - 1420 - - 69 - model: command - description: "" - parameters: [] - /connectors: - get: - x-fern-audiences: - - public - summary: List Connectors - tags: - - /connectors - operationId: list-connectors - x-fern-sdk-method-name: list - x-fern-sdk-group-name: connectors - description: - Returns a list of connectors ordered by descending creation date - (newer first). See ['Managing your - Connector'](https://docs.cohere.com/docs/managing-your-connector) for - more information. - parameters: - - name: limit - in: query - description: Maximum number of connectors to return [0, 100]. - schema: - default: 30 - type: number - x-fern-audiences: - - public - - name: offset - in: query - description: Number of connectors to skip before returning results [0, inf]. - schema: - default: 0 - type: number - x-fern-audiences: - - public - - $ref: "#/components/parameters/RequestSource" - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: "#/components/schemas/ListConnectorsResponse" - "400": - $ref: "#/components/responses/BadRequest" - "401": - $ref: "#/components/responses/Unauthorized" - "403": - $ref: "#/components/responses/Forbidden" - "404": - $ref: "#/components/responses/NotFound" - "422": - $ref: "#/components/responses/UnprocessableEntity" - "429": - $ref: "#/components/responses/RateLimit" - "498": - $ref: "#/components/responses/InvalidToken" - "499": - $ref: "#/components/responses/RequestCancelled" - "500": - $ref: "#/components/responses/InternalServerError" - "501": - $ref: "#/components/responses/NotImplemented" - "503": - $ref: "#/components/responses/ServiceUnavailable" - "504": - $ref: "#/components/responses/GatewayTimeout" - x-readme: - samples-languages: - - python - - java - - python - - java - - node - - curl - - go - code-samples: - - language: go - name: Cohere Go SDK - install: go get github.com/cohere-ai/cohere-go/v2 - code: | - package main - - import ( - "context" - "log" - - cohere "github.com/cohere-ai/cohere-go/v2" - client "github.com/cohere-ai/cohere-go/v2/client" - ) - - func main() { - co := client.NewClient(client.WithToken("<>")) - - resp, err := co.Connectors.List( - context.TODO(), - &cohere.ConnectorsListRequest{}) - - if err != nil { - log.Fatal(err) - } - - log.Printf("%+v", resp) - } - - language: python - name: Sync - install: python -m pip install cohere --upgrade - code: | - import cohere - - co = cohere.Client("<>") - response = co.connectors.list() - print(response) - - language: python - name: Async - install: python -m pip install cohere --upgrade - code: | - import cohere - import asyncio - - co = cohere.AsyncClient("<>") - - - async def main(): - response = await co.connectors.list() - print(response) - - asyncio.run(main()) - - language: java - name: Cohere java SDK - install: implementation 'com.cohere:cohere-java:1.0.4' - code: > - import com.cohere.api.Cohere; - - import com.cohere.api.types.ListConnectorsResponse; - - - - public class ConnectorsList { - public static void main(String[] args) { - Cohere cohere = Cohere.builder().token("<>").clientName("snippet").build(); - - ListConnectorsResponse list = cohere.connectors().list(); - - System.out.println(list); - } - } - - language: node - name: Cohere TypeScript SDK - install: npm i cohere-ai - code: | - const { CohereClient } = require('cohere-ai'); - - const cohere = new CohereClient({ - token: '<>', - }); - - (async () => { - const connectors = await cohere.connectors.list(); - - console.log(connectors); - })(); - - language: curl - name: cURL - code: |- - curl --request GET \ - --url https://api.cohere.com/v1/connectors \ - --header 'accept: application/json' \ - --header "Authorization: bearer $CO_API_KEY" - post: - x-fern-audiences: - - public - summary: Create a Connector - tags: - - /connectors - operationId: create-connector - x-fern-sdk-method-name: create - x-fern-sdk-group-name: connectors - description: Creates a new connector. The connector is tested during - registration and will cancel registration when the test is unsuccessful. - See ['Creating and Deploying a - Connector'](https://docs.cohere.com/docs/creating-and-deploying-a-connector) - for more information. - parameters: - - $ref: "#/components/parameters/RequestSource" - requestBody: - content: - application/json: - schema: - $ref: "#/components/schemas/CreateConnectorRequest" - required: true - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: "#/components/schemas/CreateConnectorResponse" - "400": - $ref: "#/components/responses/BadRequest" - "401": - $ref: "#/components/responses/Unauthorized" - "403": - $ref: "#/components/responses/Forbidden" - "404": - $ref: "#/components/responses/NotFound" - "422": - $ref: "#/components/responses/UnprocessableEntity" - "429": - $ref: "#/components/responses/RateLimit" - "498": - $ref: "#/components/responses/InvalidToken" - "499": - $ref: "#/components/responses/RequestCancelled" - "500": - $ref: "#/components/responses/InternalServerError" - "501": - $ref: "#/components/responses/NotImplemented" - "503": - $ref: "#/components/responses/ServiceUnavailable" - "504": - $ref: "#/components/responses/GatewayTimeout" - x-readme: - samples-languages: - - python - - java - - python - - java - - node - - curl - - go - code-samples: - - language: go - name: Cohere Go SDK - install: go get github.com/cohere-ai/cohere-go/v2 - code: | - package main - - import ( - "context" - "log" - - cohere "github.com/cohere-ai/cohere-go/v2" - client "github.com/cohere-ai/cohere-go/v2/client" - ) - - func main() { - co := client.NewClient(client.WithToken("<>")) - - resp, err := co.Connectors.Create( - context.TODO(), - &cohere.CreateConnectorRequest{ - Name: "Example connector", - Url: "https://you-connector-url", - ServiceAuth: &cohere.CreateConnectorServiceAuth{ - Token: "dummy-connector-token", - Type: "bearer", - }, - }, - ) - - if err != nil { - log.Fatal(err) - } - - log.Printf("%+v", resp) - } - - language: python - name: Sync - install: python -m pip install cohere --upgrade - code: | - import cohere - - co = cohere.Client("<>") - response = co.connectors.create( - name="Example connector", - url="https://connector-example.com/search", - ) - print(response) - - language: python - name: Async - install: python -m pip install cohere --upgrade - code: | - import cohere - import asyncio - - co = cohere.AsyncClient("<>") - - - async def main(): - response = await co.connectors.create( - name="Example connector", - url="https://connector-example.com/search", - ) - print(response) - - asyncio.run(main()) - - language: java - name: Cohere java SDK - install: implementation 'com.cohere:cohere-java:1.0.4' - code: > - import com.cohere.api.Cohere; - - import - com.cohere.api.resources.connectors.requests.CreateConnectorRequest; - - import com.cohere.api.types.CreateConnectorResponse; - - - - public class ConnectorCreate { - public static void main(String[] args) { - Cohere cohere = Cohere.builder().token("<>").clientName("snippet").build(); - - CreateConnectorResponse response = cohere.connectors().create(CreateConnectorRequest.builder() - .name("Example connector") - .url("https://connector-example.com/search").build()); - - System.out.println(response); - } - } - - language: node - name: Cohere TypeScript SDK - install: npm i cohere-ai - code: | - const { CohereClient } = require('cohere-ai'); - - const cohere = new CohereClient({ - token: '<>', - }); - - (async () => { - const connector = await cohere.connectors.create({ - name: 'test-connector', - url: 'https://example.com/search', - description: 'A test connector', - }); - - console.log(connector); - })(); - - language: curl - name: Curl - code: |- - curl --request POST \ - --url https://api.cohere.com/v1/connectors \ - --header 'accept: application/json' \ - --header 'content-type: application/json' \ - --header "Authorization: bearer $CO_API_KEY" \ - --data '{ - "name": "Example connector", - "url": "https://connector-example.com/search" - }' - "/connectors/{id}": - get: - x-fern-audiences: - - public - summary: Get a Connector - tags: - - /connectors - description: Retrieve a connector by ID. See - ['Connectors'](https://docs.cohere.com/docs/connectors) for more - information. - operationId: get-connector - x-fern-sdk-method-name: get - x-fern-sdk-group-name: connectors - parameters: - - name: id - in: path - required: true - description: The ID of the connector to retrieve. - schema: - type: string - x-fern-audiences: - - public - - $ref: "#/components/parameters/RequestSource" - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: "#/components/schemas/GetConnectorResponse" - "400": - $ref: "#/components/responses/BadRequest" - "401": - $ref: "#/components/responses/Unauthorized" - "403": - $ref: "#/components/responses/Forbidden" - "404": - $ref: "#/components/responses/NotFound" - "422": - $ref: "#/components/responses/UnprocessableEntity" - "429": - $ref: "#/components/responses/RateLimit" - "498": - $ref: "#/components/responses/InvalidToken" - "499": - $ref: "#/components/responses/RequestCancelled" - "500": - $ref: "#/components/responses/InternalServerError" - "501": - $ref: "#/components/responses/NotImplemented" - "503": - $ref: "#/components/responses/ServiceUnavailable" - "504": - $ref: "#/components/responses/GatewayTimeout" - x-readme: - samples-languages: - - python - - java - - node - - curl - - go - code-samples: - - language: go - name: Cohere Go SDK - install: go get github.com/cohere-ai/cohere-go/v2 - code: | - package main - - import ( - "context" - "log" - - client "github.com/cohere-ai/cohere-go/v2/client" - ) - - func main() { - co := client.NewClient(client.WithToken("<>")) - - resp, err := co.Connectors.Get(context.TODO(), "connector_id") - - if err != nil { - log.Fatal(err) - } - - log.Printf("%+v", resp) - } - - language: python - name: Sync - install: python -m pip install cohere --upgrade - code: | - import cohere - - co = cohere.Client("<>") - response = co.connectors.get("test-id") - print(response) - - language: python - name: Async - install: python -m pip install cohere --upgrade - code: | - import cohere - import asyncio - - co = cohere.AsyncClient("<>") - - - async def main(): - response = await co.connectors.get("test-id") - print(response) - - asyncio.run(main()) - - language: java - name: Cohere java SDK - install: implementation 'com.cohere:cohere-java:1.0.4' - code: > - import com.cohere.api.Cohere; - - import com.cohere.api.types.GetConnectorResponse; - - - - public class ConnectorGet { - public static void main(String[] args) { - Cohere cohere = Cohere.builder().token("<>").clientName("snippet").build(); - - GetConnectorResponse response = cohere.connectors().get("test-id"); - - System.out.println(response); - } - } - - language: node - name: Cohere TypeScript SDK - install: npm i cohere-ai - code: | - const { CohereClient } = require('cohere-ai'); - - const cohere = new CohereClient({ - token: '<>', - }); - - (async () => { - const connector = await cohere.connectors.get('connector-id'); - - console.log(connector); - })(); - - language: curl - name: cURL - code: |- - curl --request GET \ - --url https://api.cohere.com/v1/connectors/id \ - --header 'accept: application/json' \ - --header "Authorization: bearer $CO_API_KEY" - patch: - x-fern-audiences: - - public - summary: Update a Connector - tags: - - /connectors - operationId: update-connector - x-fern-sdk-method-name: update - x-fern-sdk-group-name: connectors - description: - Update a connector by ID. Omitted fields will not be updated. See - ['Managing your - Connector'](https://docs.cohere.com/docs/managing-your-connector) for - more information. - parameters: - - name: id - in: path - required: true - description: The ID of the connector to update. - schema: - type: string - x-fern-audiences: - - public - - $ref: "#/components/parameters/RequestSource" - requestBody: - content: - application/json: - schema: - $ref: "#/components/schemas/UpdateConnectorRequest" - required: true - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: "#/components/schemas/UpdateConnectorResponse" - "400": - $ref: "#/components/responses/BadRequest" - "401": - $ref: "#/components/responses/Unauthorized" - "403": - $ref: "#/components/responses/Forbidden" - "404": - $ref: "#/components/responses/NotFound" - "422": - $ref: "#/components/responses/UnprocessableEntity" - "429": - $ref: "#/components/responses/RateLimit" - "498": - $ref: "#/components/responses/InvalidToken" - "499": - $ref: "#/components/responses/RequestCancelled" - "500": - $ref: "#/components/responses/InternalServerError" - "501": - $ref: "#/components/responses/NotImplemented" - "503": - $ref: "#/components/responses/ServiceUnavailable" - "504": - $ref: "#/components/responses/GatewayTimeout" - x-readme: - samples-languages: - - python - - java - - node - - curl - - go - code-samples: - - language: go - name: Cohere Go SDK - install: go get github.com/cohere-ai/cohere-go/v2 - code: | - package main - - import ( - "context" - "log" - - cohere "github.com/cohere-ai/cohere-go/v2" - client "github.com/cohere-ai/cohere-go/v2/client" - ) - - func main() { - co := client.NewClient(client.WithToken("<>")) - - resp, err := co.Connectors.Update( - context.TODO(), - "connector_id", - &cohere.UpdateConnectorRequest{ - Name: cohere.String("Example connector renamed"), - }, - ) - - if err != nil { - log.Fatal(err) - } - - log.Printf("%+v", resp) - } - - language: python - name: Sync - install: python -m pip install cohere --upgrade - code: > - import cohere - - - co = cohere.Client("<>") - - response = co.connectors.update( - connector_id="test-id", name="new name", url="https://example.com/search" - ) - - print(response) - - language: python - name: Async - install: python -m pip install cohere --upgrade - code: > - import cohere - - import asyncio - - - co = cohere.AsyncClient("<>") - - - - async def main(): - response = await co.connectors.update( - connector_id="test-id", name="new name", url="https://example.com/search" - ) - print(response) - - asyncio.run(main()) - - language: java - name: Cohere java SDK - install: implementation 'com.cohere:cohere-java:1.0.4' - code: > - import com.cohere.api.Cohere; - - import - com.cohere.api.resources.connectors.requests.UpdateConnectorRequest; - - - - public class ConnectorPatch { - public static void main(String[] args) { - Cohere cohere = Cohere.builder().token("<>").clientName("snippet").build(); - - cohere.connectors().update("test-id", UpdateConnectorRequest.builder() - .name("new name") - .url("https://connector-example.com/search").build()); - } - } - - language: node - name: Cohere TypeScript SDK - install: npm i cohere-ai - code: | - const { CohereClient } = require('cohere-ai'); - - const cohere = new CohereClient({ - token: '<>', - }); - - (async () => { - const connector = await cohere.connectors.update(connector.id, { - name: 'test-connector-renamed', - description: 'A test connector renamed', - }); - - console.log(connector); - })(); - - language: curl - name: Curl - code: |- - curl --request PATCH \ - --url https://api.cohere.com/v1/connectors/id \ - --header 'accept: application/json' \ - --header 'content-type: application/json' \ - --header "Authorization: bearer $CO_API_KEY" \ - --data '{ - "name": "new name", - "url": "https://example.com/search" - }' - delete: - x-fern-audiences: - - public - summary: Delete a Connector - tags: - - /connectors - description: Delete a connector by ID. See - ['Connectors'](https://docs.cohere.com/docs/connectors) for more - information. - operationId: delete-connector - x-fern-sdk-method-name: delete - x-fern-sdk-group-name: connectors - parameters: - - name: id - description: The ID of the connector to delete. - in: path - required: true - schema: - type: string - x-fern-audiences: - - public - - $ref: "#/components/parameters/RequestSource" - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: "#/components/schemas/DeleteConnectorResponse" - "400": - $ref: "#/components/responses/BadRequest" - "401": - $ref: "#/components/responses/Unauthorized" - "403": - $ref: "#/components/responses/Forbidden" - "404": - $ref: "#/components/responses/NotFound" - "422": - $ref: "#/components/responses/UnprocessableEntity" - "429": - $ref: "#/components/responses/RateLimit" - "498": - $ref: "#/components/responses/InvalidToken" - "499": - $ref: "#/components/responses/RequestCancelled" - "500": - $ref: "#/components/responses/InternalServerError" - "501": - $ref: "#/components/responses/NotImplemented" - "503": - $ref: "#/components/responses/ServiceUnavailable" - "504": - $ref: "#/components/responses/GatewayTimeout" - x-readme: - samples-languages: - - python - - java - - node - - curl - - go - code-samples: - - language: go - name: Cohere Go SDK - install: go get github.com/cohere-ai/cohere-go/v2 - code: | - package main - - import ( - "context" - "log" - - client "github.com/cohere-ai/cohere-go/v2/client" - ) - - func main() { - co := client.NewClient(client.WithToken("<>")) - - resp, err := co.Connectors.Delete(context.TODO(), "connector_id") - - if err != nil { - log.Fatal(err) - } - - log.Printf("%+v", resp) - } - - language: node - name: Cohere TypeScript SDK - install: npm i cohere-ai - code: | - const { CohereClient } = require('cohere-ai'); - - const cohere = new CohereClient({ - token: '<>', - }); - - (async () => { - await cohere.connectors.delete('connector-id'); - })(); - - language: python - name: Sync - install: python -m pip install cohere --upgrade - code: | - import cohere - - co = cohere.Client("<>") - co.connectors.delete("test-id") - - language: python - name: Async - install: python -m pip install cohere --upgrade - code: | - import cohere - import asyncio - - co = cohere.AsyncClient("<>") - - - async def main(): - await co.connectors.delete("test-id") - - asyncio.run(main()) - - language: java - name: Cohere java SDK - install: implementation 'com.cohere:cohere-java:1.0.4' - code: >+ - import com.cohere.api.Cohere; - - - - public class ConnectorDelete { - public static void main(String[] args) { - Cohere cohere = Cohere.builder().token("<>").clientName("snippet").build(); - - cohere.connectors().delete("test-id"); - } - } - - - language: curl - name: cURL - code: |- - curl --request DELETE \ - --url https://api.cohere.com/v1/connectors/id \ - --header 'accept: application/json' \ - --header "Authorization: bearer $CO_API_KEY" - "/connectors/{id}/oauth/authorize": - post: - x-fern-audiences: - - public - summary: Authorize with oAuth - tags: - - /connectors - description: - Authorize the connector with the given ID for the connector oauth - app. See ['Connector - Authentication'](https://docs.cohere.com/docs/connector-authentication) - for more information. - operationId: oAuthAuthorize-connector - x-fern-sdk-method-name: oAuthAuthorize - x-fern-sdk-group-name: connectors - parameters: - - name: id - in: path - required: true - description: The ID of the connector to authorize. - schema: - type: string - x-fern-audiences: - - public - - name: after_token_redirect - in: query - description: The URL to redirect to after the connector has been authorized. - schema: - type: string - x-fern-audiences: - - public - - $ref: "#/components/parameters/RequestSource" - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: "#/components/schemas/OAuthAuthorizeResponse" - "400": - $ref: "#/components/responses/BadRequest" - "401": - $ref: "#/components/responses/Unauthorized" - "403": - $ref: "#/components/responses/Forbidden" - "404": - $ref: "#/components/responses/NotFound" - "422": - $ref: "#/components/responses/UnprocessableEntity" - "429": - $ref: "#/components/responses/RateLimit" - "498": - $ref: "#/components/responses/InvalidToken" - "499": - $ref: "#/components/responses/RequestCancelled" - "500": - $ref: "#/components/responses/InternalServerError" - "501": - $ref: "#/components/responses/NotImplemented" - "503": - $ref: "#/components/responses/ServiceUnavailable" - "504": - $ref: "#/components/responses/GatewayTimeout" - x-readme: - samples-languages: - - python - - java - - python - - java - - node - - curl - - go - code-samples: - - language: go - name: Cohere Go SDK - install: go get github.com/cohere-ai/cohere-go/v2 - code: | - package main - - import ( - "context" - "log" - - cohere "github.com/cohere-ai/cohere-go/v2" - client "github.com/cohere-ai/cohere-go/v2/client" - ) - - func main() { - co := client.NewClient(client.WithToken("<>")) - - resp, err := co.Connectors.OAuthAuthorize( - context.TODO(), - "connector_id", - &cohere.ConnectorsOAuthAuthorizeRequest{ - AfterTokenRedirect: cohere.String("https://test.com"), - }, - ) - - if err != nil { - log.Fatal(err) - } - - log.Printf("%+v", resp) - } - - language: python - name: Sync - install: python -m pip install cohere --upgrade - code: > - import cohere - - - co = cohere.Client("<>") - - response = co.connectors.o_auth_authorize( - connector_id="test-id", after_token_redirect="https://test.com" - ) - - print(response) - - language: python - name: Async - install: python -m pip install cohere --upgrade - code: > - import cohere - - import asyncio - - - co = cohere.AsyncClient("<>") - - - - async def main(): - response = await co.connectors.o_auth_authorize( - connector_id="test-id", after_token_redirect="https://test.com" - ) - print(response) - - asyncio.run(main()) - - language: java - name: Cohere java SDK - install: implementation 'com.cohere:cohere-java:1.0.4' - code: > - import com.cohere.api.Cohere; - - import - com.cohere.api.resources.connectors.requests.ConnectorsOAuthAuthorizeRequest; - - import com.cohere.api.types.OAuthAuthorizeResponse; - - - - public class ConnectorsIdOauthAuthorizePost { - public static void main(String[] args) { - Cohere cohere = Cohere.builder().token("<>").clientName("snippet").build(); - - OAuthAuthorizeResponse response = cohere.connectors().oAuthAuthorize("test-id", ConnectorsOAuthAuthorizeRequest.builder().afterTokenRedirect("https://connector-example.com/search").build()); - - System.out.println(response); - } - } - - language: node - name: Cohere TypeScript SDK - install: npm i cohere-ai - code: > - const { CohereClient } = require('cohere-ai'); - - - const cohere = new CohereClient({ - token: '<>', - }); - - - (async () => { - const connector = await cohere.connectors.oAuthAuthorize('connector-id', { - redirect_uri: 'https://example.com/oauth/callback', - }); - - console.log(connector); - })(); - - language: curl - name: cURL - code: |- - curl --request POST \ - --url https://api.cohere.com/v1/connectors/id/oauth/authorize \ - --header 'accept: application/json' \ - --header "Authorization: bearer $CO_API_KEY" - /connector_logs: - x-internal: true - get: - summary: Get Connector Logs - tags: - - /connectors - operationId: get-logs - x-fern-sdk-method-name: get-logs - x-fern-sdk-group-name: connectors - parameters: - - name: limit - in: query - description: Maximum number of connectors to return [0, 100]. - schema: - default: 30 - type: number - - name: offset - in: query - description: Number of connectors to skip before returning results [0, inf]. - schema: - default: 0 - type: number - - name: organizationId - in: query - description: Organization ID to filter by. - schema: - type: string - - name: connectorIds - in: query - description: Connector IDs to filter by. - schema: - type: array - items: - type: string - - name: startTimestamp - in: query - description: Start timestamp to filter by. - schema: - type: string - format: date-time - - name: endTimestamp - in: query - description: End timestamp to filter by. - schema: - type: string - format: date-time - - name: statusCodeFilter.lowerLimit - in: query - description: Lower limit of status code to filter by. - schema: - type: number - - name: statusCodeFilter.upperLimit - in: query - description: Upper limit of status code to filter by. - schema: - type: number - - $ref: "#/components/parameters/RequestSource" - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: "#/components/schemas/GetConnectorsLogsResponse" - "400": - $ref: "#/components/responses/BadRequest" - "401": - $ref: "#/components/responses/Unauthorized" - "403": - $ref: "#/components/responses/Forbidden" - "404": - $ref: "#/components/responses/NotFound" - "422": - $ref: "#/components/responses/UnprocessableEntity" - "429": - $ref: "#/components/responses/RateLimit" - "498": - $ref: "#/components/responses/InvalidToken" - "499": - $ref: "#/components/responses/RequestCancelled" - "500": - $ref: "#/components/responses/InternalServerError" - "501": - $ref: "#/components/responses/NotImplemented" - "503": - $ref: "#/components/responses/ServiceUnavailable" - "504": - $ref: "#/components/responses/GatewayTimeout" - /loglikelihood: - x-internal: true - post: - x-internal: true - summary: LogLikelihood - operationId: loglikelihood - parameters: - - $ref: "#/components/parameters/RequestSource" - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: "#/components/schemas/LogLikelihoodResponse" - headers: - X-API-Warning: - schema: - type: string - x-fern-audiences: - - public - description: Warning description for incorrect usage of the API - "400": - $ref: "#/components/responses/BadRequest" - "401": - $ref: "#/components/responses/Unauthorized" - "403": - $ref: "#/components/responses/Forbidden" - "404": - $ref: "#/components/responses/NotFound" - "422": - $ref: "#/components/responses/UnprocessableEntity" - "429": - $ref: "#/components/responses/RateLimit" - "498": - $ref: "#/components/responses/InvalidToken" - "499": - $ref: "#/components/responses/RequestCancelled" - "500": - $ref: "#/components/responses/InternalServerError" - "501": - $ref: "#/components/responses/NotImplemented" - "503": - $ref: "#/components/responses/ServiceUnavailable" - "504": - $ref: "#/components/responses/GatewayTimeout" - description: - Log likelihood tokenizes the input and annotates the tokens with - the models assessment of their probability. - requestBody: - content: - application/json: - schema: - type: object - x-fern-audiences: - - public - x-examples: - Prompt and completion: - value: - prompt: Please explain to me how LLMs work - completion: They work by using a large language model to generate text. - Raw prompt: - value: - raw_prompt: What's the colour of the sky? blue - properties: - model: - type: string - x-fern-audiences: - - public - description: - The identifier of the model to generate with. Currently available - models are `command` (default), `command-nightly` - (experimental), `command-light`, and `command-light-nightly` - (experimental). Smaller, "light" models are faster, while - larger models will perform better. [Custom - models](/docs/training-custom-models) can also be supplied - with their full ID. - prompt: - type: string - x-fern-audiences: - - public - description: | - To be used in conjunction with `completion`. This will be interpolated into the user message in the prompt template. - writeOnly: true - completion: - type: string - x-fern-audiences: - - public - description: | - To be used in conjunction with `prompt`. This will be interpolated into the chatbot reponse in the prompt template. - raw_prompt: - type: string - x-fern-audiences: - - public - description: | - To be used on its own, this allows you to pass a custom prompt to the model that will not be interpolated into a prompt template. - writeOnly: true - /cluster-jobs: - x-internal: true - post: - parameters: - - $ref: "#/components/parameters/RequestSource" - summary: Create a Cluster Job - operationId: create-cluster-job - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: "#/components/schemas/CreateClusterJobResponse" - headers: - X-API-Warning: - schema: - type: string - x-fern-audiences: - - public - description: Warning description for incorrect usage of the API - "400": - $ref: "#/components/responses/BadRequest" - "401": - $ref: "#/components/responses/Unauthorized" - "403": - $ref: "#/components/responses/Forbidden" - "404": - $ref: "#/components/responses/NotFound" - "422": - $ref: "#/components/responses/UnprocessableEntity" - "429": - $ref: "#/components/responses/RateLimit" - "498": - $ref: "#/components/responses/InvalidToken" - "499": - $ref: "#/components/responses/RequestCancelled" - "500": - $ref: "#/components/responses/InternalServerError" - "501": - $ref: "#/components/responses/NotImplemented" - "503": - $ref: "#/components/responses/ServiceUnavailable" - "504": - $ref: "#/components/responses/GatewayTimeout" - description: This endpoint creates a new cluster job. - requestBody: - content: - application/json: - schema: - $ref: "#/components/schemas/CreateClusterJobRequest" - get: - parameters: - - $ref: "#/components/parameters/RequestSource" - summary: List Cluster Jobs - operationId: list-cluster-jobs - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: "#/components/schemas/ListClusterJobsResponse" - headers: - X-API-Warning: - schema: - type: string - x-fern-audiences: - - public - description: Warning description for incorrect usage of the API - "400": - $ref: "#/components/responses/BadRequest" - "401": - $ref: "#/components/responses/Unauthorized" - "403": - $ref: "#/components/responses/Forbidden" - "404": - $ref: "#/components/responses/NotFound" - "422": - $ref: "#/components/responses/UnprocessableEntity" - "429": - $ref: "#/components/responses/RateLimit" - "498": - $ref: "#/components/responses/InvalidToken" - "499": - $ref: "#/components/responses/RequestCancelled" - "500": - $ref: "#/components/responses/InternalServerError" - "501": - $ref: "#/components/responses/NotImplemented" - "503": - $ref: "#/components/responses/ServiceUnavailable" - "504": - $ref: "#/components/responses/GatewayTimeout" - description: This endpoint returns a list of cluster jobs. - "/cluster-jobs/{job-id}": - x-internal: true - patch: - summary: Update a Cluster job - operationId: update-cluster-job - parameters: - - name: job-id - in: path - required: true - schema: - type: string - x-fern-audiences: - - public - - $ref: "#/components/parameters/RequestSource" - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: "#/components/schemas/UpdateClusterJobResponse" - headers: - X-API-Warning: - schema: - type: string - x-fern-audiences: - - public - description: Warning description for incorrect usage of the API - "400": - $ref: "#/components/responses/BadRequest" - "401": - $ref: "#/components/responses/Unauthorized" - "403": - $ref: "#/components/responses/Forbidden" - "404": - $ref: "#/components/responses/NotFound" - "422": - $ref: "#/components/responses/UnprocessableEntity" - "429": - $ref: "#/components/responses/RateLimit" - "498": - $ref: "#/components/responses/InvalidToken" - "499": - $ref: "#/components/responses/RequestCancelled" - "500": - $ref: "#/components/responses/InternalServerError" - "501": - $ref: "#/components/responses/NotImplemented" - "503": - $ref: "#/components/responses/ServiceUnavailable" - "504": - $ref: "#/components/responses/GatewayTimeout" - description: This endpoint updates a cluster job. - requestBody: - content: - application/json: - schema: - $ref: "#/components/schemas/UpdateClusterJobRequest" - get: - summary: Get a Cluster job - operationId: get-cluster-job - parameters: - - name: job-id - in: path - required: true - schema: - type: string - x-fern-audiences: - - public - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: "#/components/schemas/GetClusterJobResponse" - headers: - X-API-Warning: - schema: - type: string - x-fern-audiences: - - public - description: Warning description for incorrect usage of the API - "400": - $ref: "#/components/responses/BadRequest" - "401": - $ref: "#/components/responses/Unauthorized" - "403": - $ref: "#/components/responses/Forbidden" - "404": - $ref: "#/components/responses/NotFound" - "422": - $ref: "#/components/responses/UnprocessableEntity" - "429": - $ref: "#/components/responses/RateLimit" - "498": - $ref: "#/components/responses/InvalidToken" - "499": - $ref: "#/components/responses/RequestCancelled" - "500": - $ref: "#/components/responses/InternalServerError" - "501": - $ref: "#/components/responses/NotImplemented" - "503": - $ref: "#/components/responses/ServiceUnavailable" - "504": - $ref: "#/components/responses/GatewayTimeout" - description: This endpoint returns a cluster job. - "/models/{model}": - get: - summary: Get a Model - tags: - - /models - operationId: get-model - x-fern-sdk-method-name: get - x-fern-sdk-group-name: models - x-fern-audiences: - - public - description: Returns the details of a model, provided its name. - parameters: - - name: model - in: path - required: true - schema: - type: string - x-fern-audiences: - - public - example: command-r - - $ref: "#/components/parameters/RequestSource" - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: "#/components/schemas/GetModelResponse" - headers: - X-API-Warning: - schema: - type: string - x-fern-audiences: - - public - description: Warning description for incorrect usage of the API - "400": - $ref: "#/components/responses/BadRequest" - "401": - $ref: "#/components/responses/Unauthorized" - "403": - $ref: "#/components/responses/Forbidden" - "404": - $ref: "#/components/responses/NotFound" - "422": - $ref: "#/components/responses/UnprocessableEntity" - "429": - $ref: "#/components/responses/RateLimit" - "498": - $ref: "#/components/responses/InvalidToken" - "499": - $ref: "#/components/responses/RequestCancelled" - "500": - $ref: "#/components/responses/InternalServerError" - "501": - $ref: "#/components/responses/NotImplemented" - "503": - $ref: "#/components/responses/ServiceUnavailable" - "504": - $ref: "#/components/responses/GatewayTimeout" - /models: - get: - x-fern-audiences: - - public - summary: List Models - tags: - - /models - operationId: list-models - x-fern-sdk-method-name: list - x-fern-sdk-group-name: models - description: Returns a list of models available for use. The list contains - models from Cohere as well as your fine-tuned models. - parameters: - - name: page_size - in: query - description: |- - Maximum number of models to include in a page - Defaults to `20`, min value of `1`, max value of `1000`. - schema: - type: number - x-fern-audiences: - - public - - name: page_token - description: - Page token provided in the `next_page_token` field of a previous - response. - in: query - schema: - type: string - x-fern-audiences: - - public - - name: endpoint - in: query - description: - When provided, filters the list of models to only those that are - compatible with the specified endpoint. - schema: - $ref: "#/components/schemas/CompatibleEndpoint" - x-fern-audiences: - - public - - name: default_only - in: query - description: - When provided, filters the list of models to only the default model - to the endpoint. This parameter is only valid when `endpoint` is - provided. - schema: - type: boolean - x-fern-audiences: - - public - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: "#/components/schemas/ListModelsResponse" - "400": - $ref: "#/components/responses/BadRequest" - "401": - $ref: "#/components/responses/Unauthorized" - "403": - $ref: "#/components/responses/Forbidden" - "404": - $ref: "#/components/responses/NotFound" - "422": - $ref: "#/components/responses/UnprocessableEntity" - "429": - $ref: "#/components/responses/RateLimit" - "498": - $ref: "#/components/responses/InvalidToken" - "499": - $ref: "#/components/responses/RequestCancelled" - "500": - $ref: "#/components/responses/InternalServerError" - "501": - $ref: "#/components/responses/NotImplemented" - "503": - $ref: "#/components/responses/ServiceUnavailable" - "504": - $ref: "#/components/responses/GatewayTimeout" - x-readme: - samples-languages: - - node - - curl - - python - - java - - go - code-samples: - - language: python - name: Sync - install: python -m pip install cohere --upgrade - code: | - import cohere - - co = cohere.Client("<>") - response = co.models.list() - print(response) - - language: python - name: Async - install: python -m pip install cohere --upgrade - code: | - import cohere - import asyncio - - co = cohere.AsyncClient("<>") - - - async def main(): - response = await co.models.list() - print(response) - - asyncio.run(main()) - - language: java - name: Cohere java SDK - install: implementation 'com.cohere:cohere-java:1.0.4' - code: > - import com.cohere.api.Cohere; - - import com.cohere.api.types.ListModelsResponse; - - - - public class ModelsListGet { - public static void main(String[] args) { - Cohere cohere = Cohere.builder().token("<>").clientName("snippet").build(); - - ListModelsResponse response = cohere.models().list(); - - System.out.println(response); - } - } - - language: curl - name: cURL - code: |- - curl --request GET \ - --url https://api.cohere.com/v1/models \ - --header 'accept: application/json' \ - --header "Authorization: bearer $CO_API_KEY" - - language: node - name: Cohere TypeScript SDK - install: npm i cohere-ai - code: | - const { CohereClient } = require('cohere-ai'); - - const cohere = new CohereClient({ - token: '<>', - }); - - (async () => { - const models = await cohere.models.list(); - - console.log(models); - })(); - - language: go - name: Cohere Go SDK - install: go get github.com/cohere-ai/cohere-go/v2 - code: > - package main - - - import ( - "context" - "log" - - cohere "github.com/cohere-ai/cohere-go/v2" - client "github.com/cohere-ai/cohere-go/v2/client" - ) - - - func main() { - co := client.NewClient(client.WithToken("<>")) - - resp, err := co.Models.List(context.TODO(), &cohere.ModelsListRequest{}) - - if err != nil { - log.Fatal(err) - } - - log.Printf("%+v", resp) - } - /check-api-key: - post: - parameters: - - $ref: "#/components/parameters/RequestSource" - x-fern-audiences: - - public - summary: Check API key - operationId: checkAPIKey - description: | - Checks that the api key in the Authorization header is valid and active - responses: - "200": - description: OK - content: - application/json: - schema: - type: object - required: - - valid - properties: - valid: - type: boolean - organization_id: - type: string - owner_id: - type: string - "400": - $ref: "#/components/responses/BadRequest" - "401": - $ref: "#/components/responses/Unauthorized" - "403": - $ref: "#/components/responses/Forbidden" - "404": - $ref: "#/components/responses/NotFound" - "422": - $ref: "#/components/responses/UnprocessableEntity" - "429": - $ref: "#/components/responses/RateLimit" - "498": - $ref: "#/components/responses/InvalidToken" - "499": - $ref: "#/components/responses/RequestCancelled" - "500": - $ref: "#/components/responses/InternalServerError" - "501": - $ref: "#/components/responses/NotImplemented" - "503": - $ref: "#/components/responses/ServiceUnavailable" - "504": - $ref: "#/components/responses/GatewayTimeout" - /finetuning/finetuned-models: - get: - summary: Lists fine-tuned models. - operationId: ListFinetunedModels - responses: - "200": - description: A successful response. - content: - application/json: - schema: - $ref: "#/components/schemas/ListFinetunedModelsResponse" - example: - finetuned_models: - - id: fee37446-7fc7-42f9-a026-c6ba2fcc422d - name: prompt-completion-ft - creator_id: 7a317d97-4d05-427d-9396-f31b9fb92c55 - organization_id: 6bdca3d5-3eae-4de0-ac34-786d8063b7ee - settings: - base_model: - name: medium - version: 14.2.0 - base_type: BASE_TYPE_GENERATIVE - strategy: STRATEGY_TFEW - dataset_id: my-dataset-d701tr - hyperparameters: - early_stopping_patience: 6 - early_stopping_threshold: 0.01 - train_batch_size: 16 - train_epochs: 1 - learning_rate: 0.01 - status: STATUS_READY - created_at: 2024-01-17T20:11:42.907112Z - updated_at: 2024-01-17T20:31:06.464015Z - completed_at: 2024-01-17T20:31:05.047066Z - - id: 9d927c5e-7598-4772-98b7-cdf2014e8874 - name: rerank-ft - creator_id: 7a317d97-4d05-427d-9396-f31b9fb92c55 - organization_id: 6bdca3d5-3eae-4de0-ac34-786d8063b7ee - settings: - base_model: - name: english - version: 2.0.0 - base_type: BASE_TYPE_RERANK - strategy: STRATEGY_VANILLA - dataset_id: rerank-dataset-d820xf - status: STATUS_READY - created_at: 2024-01-17T20:17:16.997608Z - updated_at: 2024-01-17T20:50:11.148769Z - completed_at: 2024-01-17T20:42:55.821051Z - "400": - description: Bad Request - content: - application/json: - schema: - $ref: "#/components/schemas/Error" - "401": - description: Unauthorized - content: - application/json: - schema: - $ref: "#/components/schemas/Error" - "403": - description: Forbidden - content: - application/json: - schema: - $ref: "#/components/schemas/Error" - "404": - description: Not Found - content: - application/json: - schema: - $ref: "#/components/schemas/Error" - "500": - description: Internal Server Error - content: - application/json: - schema: - $ref: "#/components/schemas/Error" - "503": - description: Status Service Unavailable - content: - application/json: - schema: - $ref: "#/components/schemas/Error" - parameters: - - name: page_size - description: |- - Maximum number of results to be returned by the server. If 0, defaults to - 50. - in: query - required: false - schema: - type: integer - format: int32 - - name: page_token - description: Request a specific page of the list results. - in: query - required: false - schema: - type: string - - name: order_by - description: |- - Comma separated list of fields. For example: "created_at,name". The default - sorting order is ascending. To specify descending order for a field, append - " desc" to the field name. For example: "created_at desc,name". - - Supported sorting fields: - - created_at (default) - in: query - required: false - schema: - type: string - - $ref: "#/components/parameters/RequestSource" - tags: - - /finetuning - x-readme: - samples-languages: - - python - - java - - go - - node - - curl - code-samples: - - language: java - name: Cohere java SDK - install: implementation 'com.cohere:cohere-java' - code: > - package finetuning; - - - import com.cohere.api.Cohere; - - import - com.cohere.api.resources.finetuning.finetuning.types.ListFinetunedModelsResponse; - - - - public class ListFinetunedModels { - public static void main(String[] args) { - Cohere cohere = Cohere.builder().token("<>").clientName("snippet").build(); - - ListFinetunedModelsResponse response = cohere.finetuning().listFinetunedModels(); - - System.out.println(response); - } - } - - language: go - name: Cohere Go SDK - install: go get github.com/cohere-ai/cohere-go/v2 - code: > - package main - - - import ( - "context" - "log" - - "github.com/cohere-ai/cohere-go/v2/client" - ) - - - func main() { - co := client.NewClient(client.WithToken("<>")) - - resp, err := co.Finetuning.ListFinetunedModels(context.TODO(), nil) - if err != nil { - log.Fatal(err) - } - - log.Printf("%+v", resp.FinetunedModels) - } - - language: node - name: Cohere TypeScript SDK - install: npm i cohere-ai - code: > - const { CohereClient } = require('cohere-ai'); - - - const cohere = new CohereClient({ - token: '<>', - }); - - - (async () => { - const finetunedModels = await cohere.finetuning.listFinetunedModels(); - - console.log(finetunedModels); - })(); - - language: python - name: Sync - install: python -m pip install cohere --upgrade - code: | - import cohere - - co = cohere.Client("<>") - response = co.finetuning.list_finetuned_models() - print(response) - - language: python - name: Async - install: python -m pip install cohere --upgrade - code: | - import cohere - import asyncio - - co = cohere.AsyncClient("<>") - - - async def main(): - response = await co.finetuning.list_finetuned_models() - print(response) - - asyncio.run(main()) - - language: curl - name: cURL - code: | - curl --request GET \ - --url https://api.cohere.com/v1/finetuning/finetuned-models \ - --header 'accept: application/json' \ - --header "Authorization: bearer $CO_API_KEY" - x-fern-sdk-group-name: finetuning - x-fern-audiences: - - public - x-fern-request-name: FinetuningListFinetunedModelsRequest - post: - summary: Trains and deploys a fine-tuned model. - operationId: CreateFinetunedModel - responses: - "200": - description: A successful response. - content: - application/json: - schema: - $ref: "#/components/schemas/CreateFinetunedModelResponse" - "400": - description: Bad Request - content: - application/json: - schema: - $ref: "#/components/schemas/Error" - "401": - description: Unauthorized - content: - application/json: - schema: - $ref: "#/components/schemas/Error" - "403": - description: Forbidden - content: - application/json: - schema: - $ref: "#/components/schemas/Error" - "404": - description: Not Found - content: - application/json: - schema: - $ref: "#/components/schemas/Error" - "500": - description: Internal Server Error - content: - application/json: - schema: - $ref: "#/components/schemas/Error" - "503": - description: Status Service Unavailable - content: - application/json: - schema: - $ref: "#/components/schemas/Error" - tags: - - /finetuning - requestBody: - description: Information about the fine-tuned model. Must contain name and settings. - content: - application/json: - schema: - $ref: "#/components/schemas/FinetunedModel" - required: - - finetuned_model - example: - name: api-test - settings: - base_model: - base_type: BASE_TYPE_GENERATIVE - dataset_id: my-dataset-id - required: true - parameters: - - $ref: "#/components/parameters/RequestSource" - x-readme: - samples-languages: - - python - - java - - go - - node - - curl - code-samples: - - language: java - name: Cohere java SDK - install: implementation 'com.cohere:cohere-java' - code: >+ - package finetuning; - - - import com.cohere.api.Cohere; - - import com.cohere.api.resources.finetuning.finetuning.types.*; - - - public class CreateFinetunedModel { - public static void main(String[] args) { - Cohere cohere = Cohere.builder().token("<>").clientName("snippet").build(); - - CreateFinetunedModelResponse response = cohere.finetuning().createFinetunedModel(FinetunedModel.builder().name("test-finetuned-model").settings(Settings.builder().baseModel(BaseModel.builder().baseType(BaseType.BASE_TYPE_GENERATIVE).build()).datasetId("my-dataset-id").build()).build()); - - System.out.println(response); - } - } - - - - language: go - name: Cohere Go SDK - install: go get github.com/cohere-ai/cohere-go/v2 - code: | - package main - - import ( - "context" - "log" - - "github.com/cohere-ai/cohere-go/v2/client" - "github.com/cohere-ai/cohere-go/v2/finetuning" - ) - - func main() { - co := client.NewClient(client.WithToken("<>")) - - resp, err := co.Finetuning.CreateFinetunedModel( - context.TODO(), - &finetuning.FinetunedModel{ - Name: "test-finetuned-model", - Settings: &finetuning.Settings{ - DatasetId: "my-dataset-id", - BaseModel: &finetuning.BaseModel{ - BaseType: finetuning.BaseTypeBaseTypeGenerative, - }, - }, - }, - ) - if err != nil { - log.Fatal(err) - } - - log.Printf("%+v", resp.FinetunedModel) - } - - language: node - name: Cohere TypeScript SDK - install: npm i cohere-ai - code: > - const { Cohere, CohereClient } = require('cohere-ai'); - - - const cohere = new CohereClient({ - token: '<>', - }); - - - (async () => { - const finetunedModel = await cohere.finetuning.createFinetunedModel({ - name: 'test-finetuned-model', - settings: { - base_model: { - base_type: Cohere.Finetuning.BaseType.BaseTypeGenerative, - }, - dataset_id: 'test-dataset-id', - }, - }); - - console.log(finetunedModel); - })(); - - language: python - name: Sync - install: python -m pip install cohere --upgrade - code: | - from cohere.finetuning import ( - BaseModel, - FinetunedModel, - Hyperparameters, - Settings, - ) - import cohere - - co = cohere.Client("<>") - hp = Hyperparameters( - early_stopping_patience=10, - early_stopping_threshold=0.001, - train_batch_size=16, - train_epoch=1, - learning_rate=0.01, - ) - finetuned_model = co.finetuning.create_finetuned_model( - request=FinetunedModel( - name="test-finetuned-model", - settings=Settings( - base_model=BaseModel( - base_type="BASE_TYPE_CHAT", - ), - dataset_id="my-dataset-id", - hyperparameters=hp, - ), - ) - ) - print(response) - - language: python - name: Async - install: python -m pip install cohere --upgrade - code: | - from cohere.finetuning import ( - BaseModel, - BaseType, - FinetunedModel, - Settings, - ) - import cohere - import asyncio - - co = cohere.AsyncClient("<>") - - - async def main(): - response = await co.finetuning.create_finetuned_model( - request=FinetunedModel( - name="test-finetuned-model", - settings=Settings( - base_model=BaseModel( - base_type=BaseType.BASE_TYPE_GENERATIVE, - ), - dataset_id="my-dataset-id", - ), - ) - ) - print(response) - - asyncio.run(main()) - - language: curl - name: cURL - code: | - curl --request POST \ - --url https://api.cohere.com/v1/finetuning/finetuned-models \ - --header 'accept: application/json' \ - --header 'content-type: application/json' \ - --header "Authorization: bearer $CO_API_KEY" \ - --data '{ - "name": "test-finetuned-model", - "settings": { - "base_model": { - "base_type": "BASE_TYPE_GENERATIVE", - }, - "dataset_id": "test-dataset-id" - } - }' - x-fern-sdk-group-name: finetuning - x-fern-audiences: - - public - "/finetuning/finetuned-models/{id}": - patch: - summary: Updates a fine-tuned model. - operationId: UpdateFinetunedModel - responses: - "200": - description: A successful response. - content: - application/json: - schema: - $ref: "#/components/schemas/UpdateFinetunedModelResponse" - "400": - description: Bad Request - content: - application/json: - schema: - $ref: "#/components/schemas/Error" - "401": - description: Unauthorized - content: - application/json: - schema: - $ref: "#/components/schemas/Error" - "403": - description: Forbidden - content: - application/json: - schema: - $ref: "#/components/schemas/Error" - "404": - description: Not Found - content: - application/json: - schema: - $ref: "#/components/schemas/Error" - "500": - description: Internal Server Error - content: - application/json: - schema: - $ref: "#/components/schemas/Error" - "503": - description: Status Service Unavailable - content: - application/json: - schema: - $ref: "#/components/schemas/Error" - parameters: - - name: id - description: FinetunedModel ID. - in: path - required: true - schema: - type: string - - $ref: "#/components/parameters/RequestSource" - tags: - - /finetuning - requestBody: - description: Information about the fine-tuned model. Must contain name and settings. - content: - application/json: - schema: - type: object - properties: - name: - type: string - description: FinetunedModel name (e.g. `foobar`). - creator_id: - type: string - description: User ID of the creator. - readOnly: true - organization_id: - type: string - description: Organization ID. - readOnly: true - settings: - $ref: "#/components/schemas/Settings" - description: FinetunedModel settings such as dataset, hyperparameters... - status: - $ref: "#/components/schemas/Status" - description: Current stage in the life-cycle of the fine-tuned model. - readOnly: true - created_at: - type: string - format: date-time - description: Creation timestamp. - readOnly: true - updated_at: - type: string - format: date-time - description: Latest update timestamp. - readOnly: true - completed_at: - type: string - format: date-time - description: Timestamp for the completed fine-tuning. - readOnly: true - last_used: - type: string - format: date-time - description: Timestamp for the latest request to this fine-tuned model. - readOnly: true - title: Information about the fine-tuned model. Must contain name and settings. - required: - - name - - settings - required: true - x-readme: - samples-languages: - - python - - java - - go - - node - - curl - code-samples: - - language: java - name: Cohere java SDK - install: implementation 'com.cohere:cohere-java' - code: > - package finetuning; - - - import com.cohere.api.Cohere; - - import - com.cohere.api.resources.finetuning.finetuning.types.BaseModel; - - import - com.cohere.api.resources.finetuning.finetuning.types.BaseType; - - import - com.cohere.api.resources.finetuning.finetuning.types.Settings; - - import - com.cohere.api.resources.finetuning.finetuning.types.UpdateFinetunedModelResponse; - - import - com.cohere.api.resources.finetuning.requests.FinetuningUpdateFinetunedModelRequest; - - - - public class UpdateFinetunedModel { - public static void main(String[] args) { - Cohere cohere = Cohere.builder().token("<>").clientName("snippet").build(); - - UpdateFinetunedModelResponse response = cohere.finetuning().updateFinetunedModel("test-id", FinetuningUpdateFinetunedModelRequest.builder().name("new name").settings(Settings.builder().baseModel(BaseModel.builder().baseType(BaseType.BASE_TYPE_GENERATIVE).build()).datasetId("my-dataset-id").build()).build()); - - System.out.println(response); - } - } - - language: go - name: Cohere Go SDK - install: go get github.com/cohere-ai/cohere-go/v2 - code: | - package main - - import ( - "context" - "log" - - cohere "github.com/cohere-ai/cohere-go/v2" - "github.com/cohere-ai/cohere-go/v2/client" - ) - - func main() { - co := client.NewClient(client.WithToken("<>")) - - resp, err := co.Finetuning.UpdateFinetunedModel( - context.TODO(), - "test-id", - &cohere.FinetuningUpdateFinetunedModelRequest{ - Name: "new-name", - }, - ) - if err != nil { - log.Fatal(err) - } - - log.Printf("%+v", resp.FinetunedModel) - } - - language: node - name: Cohere TypeScript SDK - install: npm i cohere-ai - code: > - const { CohereClient } = require('cohere-ai'); - - - const cohere = new CohereClient({ - token: '<>', - }); - - - (async () => { - const finetunedModel = await cohere.finetuning.updateFinetunedModel('test-id', { - name: 'new name', - }); - - console.log(finetunedModel); - })(); - - language: python - name: Sync - install: python -m pip install cohere --upgrade - code: | - import cohere - - co = cohere.Client("<>") - finetuned_model = co.finetuning.update_finetuned_model( - id="test-id", - name="new name", - settings=Settings( - base_model=BaseModel( - base_type="BASE_TYPE_CHAT", - ), - dataset_id="my-dataset-id",) - ) - - print(finetuned_model) - - language: python - name: Async - install: python -m pip install cohere --upgrade - code: > - import cohere - - import asyncio - - - co = cohere.AsyncClient("<>") - - - - async def main(): - response = await co.finetuning.update_finetuned_model(id="test-id", name="new name") - print(response) - - asyncio.run(main()) - - language: curl - name: cURL - code: > - curl --request PATCH \ - --url https://api.cohere.com/v1/finetuning/finetuned-models/test-id \ - --header 'accept: application/json' \ - --header 'content-type: application/json' \ - --header "Authorization: bearer $CO_API_KEY" \ - --data '{ "name": "new name" }' - x-fern-sdk-group-name: finetuning - x-fern-audiences: - - public - x-fern-request-name: FinetuningUpdateFinetunedModelRequest - get: - summary: Returns a fine-tuned model by ID. - operationId: GetFinetunedModel - responses: - "200": - description: A successful response. - content: - application/json: - schema: - $ref: "#/components/schemas/GetFinetunedModelResponse" - example: - finetuned_model: - id: fee37446-7fc7-42f9-a026-c6ba2fcc422d - name: prompt-completion-ft - creator_id: 7a317d97-4d05-427d-9396-f31b9fb92c55 - organization_id: 6bdca3d5-3eae-4de0-ac34-786d8063b7ee - settings: - base_model: - name: medium - version: 14.2.0 - base_type: BASE_TYPE_GENERATIVE - strategy: STRATEGY_TFEW - dataset_id: my-dataset-d701tr - hyperparameters: - early_stopping_patience: 6 - early_stopping_threshold: 0.01 - train_batch_size: 16 - train_epochs: 1 - learning_rate: 0.01 - status: STATUS_READY - created_at: 2024-01-17T20:11:42.907112Z - updated_at: 2024-01-17T20:31:06.464015Z - completed_at: 2024-01-17T20:31:05.047066Z - "400": - description: Bad Request - content: - application/json: - schema: - $ref: "#/components/schemas/Error" - "401": - description: Unauthorized - content: - application/json: - schema: - $ref: "#/components/schemas/Error" - "403": - description: Forbidden - content: - application/json: - schema: - $ref: "#/components/schemas/Error" - "404": - description: Not Found - content: - application/json: - schema: - $ref: "#/components/schemas/Error" - "500": - description: Internal Server Error - content: - application/json: - schema: - $ref: "#/components/schemas/Error" - "503": - description: Status Service Unavailable - content: - application/json: - schema: - $ref: "#/components/schemas/Error" - parameters: - - name: id - description: The fine-tuned model ID. - in: path - required: true - schema: - type: string - - $ref: "#/components/parameters/RequestSource" - tags: - - /finetuning - x-readme: - samples-languages: - - python - - java - - go - - node - - curl - code-samples: - - language: java - name: Cohere java SDK - install: implementation 'com.cohere:cohere-java' - code: >+ - package finetuning; - - - import com.cohere.api.Cohere; - - import - com.cohere.api.resources.finetuning.finetuning.types.GetFinetunedModelResponse; - - - public class GetFinetunedModel { - public static void main(String[] args) { - Cohere cohere = Cohere.builder().token("<>").clientName("snippet").build(); - - GetFinetunedModelResponse response = cohere.finetuning().getFinetunedModel("test-id"); - - System.out.println(response); - } - } - - - language: go - name: Cohere Go SDK - install: go get github.com/cohere-ai/cohere-go/v2 - code: > - package main - - - import ( - "context" - "log" - - "github.com/cohere-ai/cohere-go/v2/client" - ) - - - func main() { - co := client.NewClient(client.WithToken("<>")) - - resp, err := co.Finetuning.GetFinetunedModel(context.TODO(), "test-id") - if err != nil { - log.Fatal(err) - } - - log.Printf("%+v", resp.FinetunedModel) - } - - language: node - name: Cohere TypeScript SDK - install: npm i cohere-ai - code: > - const { CohereClient } = require('cohere-ai'); - - - const cohere = new CohereClient({ - token: '<>', - }); - - - (async () => { - const finetunedModel = await cohere.finetuning.getFinetunedModel('test-id'); - - console.log(finetunedModel); - })(); - - language: python - name: Sync - install: python -m pip install cohere --upgrade - code: | - import cohere - - co = cohere.Client("<>") - response = co.finetuning.get_finetuned_model("test-id") - print(response) - - language: python - name: Async - install: python -m pip install cohere --upgrade - code: | - import cohere - import asyncio - - co = cohere.AsyncClient("<>") - - - async def main(): - response = await co.finetuning.get_finetuned_model("test-id") - print(response) - - asyncio.run(main()) - - language: curl - name: cURL - code: > - curl --request GET \ - --url https://api.cohere.com/v1/finetuning/finetuned-models/test-id \ - --header 'accept: application/json' \ - --header "Authorization: bearer $CO_API_KEY" - x-fern-sdk-group-name: finetuning - x-fern-audiences: - - public - x-fern-request-name: FinetuningGetFinetunedModelRequest - delete: - summary: Deletes a fine-tuned model. - operationId: DeleteFinetunedModel - responses: - "200": - description: A successful response. - content: - application/json: - schema: - $ref: "#/components/schemas/DeleteFinetunedModelResponse" - "400": - description: Bad Request - content: - application/json: - schema: - $ref: "#/components/schemas/Error" - "401": - description: Unauthorized - content: - application/json: - schema: - $ref: "#/components/schemas/Error" - "403": - description: Forbidden - content: - application/json: - schema: - $ref: "#/components/schemas/Error" - "404": - description: Not Found - content: - application/json: - schema: - $ref: "#/components/schemas/Error" - "500": - description: Internal Server Error - content: - application/json: - schema: - $ref: "#/components/schemas/Error" - "503": - description: Status Service Unavailable - content: - application/json: - schema: - $ref: "#/components/schemas/Error" - parameters: - - name: id - description: The fine-tuned model ID. - in: path - required: true - schema: - type: string - - $ref: "#/components/parameters/RequestSource" - tags: - - /finetuning - x-readme: - samples-languages: - - python - - java - - go - - node - - curl - code-samples: - - language: java - name: Cohere java SDK - install: implementation 'com.cohere:cohere-java' - code: > - package finetuning; - - - import com.cohere.api.Cohere; - - - - public class DeleteFinetunedModel { - public static void main(String[] args) { - Cohere cohere = Cohere.builder().token("<>").clientName("snippet").build(); - - cohere.finetuning().deleteFinetunedModel("test-id"); - } - } - - language: go - name: Cohere Go SDK - install: go get github.com/cohere-ai/cohere-go/v2 - code: > - package main - - - import ( - "context" - "log" - - "github.com/cohere-ai/cohere-go/v2/client" - ) - - - func main() { - co := client.NewClient(client.WithToken("<>")) - - _, err := co.Finetuning.DeleteFinetunedModel(context.TODO(), "test-id") - if err != nil { - log.Fatal(err) - } - } - - language: node - name: Cohere TypeScript SDK - install: npm i cohere-ai - code: | - const { CohereClient } = require('cohere-ai'); - - const cohere = new CohereClient({ - token: '<>', - }); - - (async () => { - await cohere.finetuning.deleteFinetunedModel('test-id'); - })(); - - language: python - name: Sync - install: python -m pip install cohere --upgrade - code: | - import cohere - - co = cohere.Client("<>") - co.finetuning.delete_finetuned_model("test-id") - - language: python - name: Async - install: python -m pip install cohere --upgrade - code: | - import cohere - import asyncio - - co = cohere.AsyncClient("<>") - - - async def main(): - await co.finetuning.delete_finetuned_model("test-id") - - asyncio.run(main()) - - language: curl - name: cURL - code: > - curl --request DELETE \ - --url https://api.cohere.com/v1/finetuning/finetuned-models/test-id \ - --header 'accept: application/json' \ - --header "Authorization: bearer $CO_API_KEY" - x-fern-sdk-group-name: finetuning - x-fern-audiences: - - public - "/finetuning/finetuned-models/{finetuned_model_id}/events": - get: - summary: - Retrieves the chronology of statuses the fine-tuned model has been - through. - operationId: ListEvents - responses: - "200": - description: A successful response. - content: - application/json: - schema: - $ref: "#/components/schemas/ListEventsResponse" - example: - events: - - user_id: 7a317d97-4d05-427d-9396-f31b9fb92c55 - status: STATUS_QUEUED - created_at: 2024-01-17T20:11:45.267960Z - - user_id: 7a317d97-4d05-427d-9396-f31b9fb92c55 - status: STATUS_FINETUNING - created_at: 2024-01-17T20:11:46.000862Z - - user_id: 7a317d97-4d05-427d-9396-f31b9fb92c55 - status: STATUS_DEPLOYING_API - created_at: 2024-01-17T20:31:05.047066Z - - status: STATUS_READY - created_at: 2024-01-17T20:31:06.988655Z - total_size: 5 - "400": - description: Bad Request - content: - application/json: - schema: - $ref: "#/components/schemas/Error" - "401": - description: Unauthorized - content: - application/json: - schema: - $ref: "#/components/schemas/Error" - "403": - description: Forbidden - content: - application/json: - schema: - $ref: "#/components/schemas/Error" - "404": - description: Not Found - content: - application/json: - schema: - $ref: "#/components/schemas/Error" - "500": - description: Internal Server Error - content: - application/json: - schema: - $ref: "#/components/schemas/Error" - "503": - description: Status Service Unavailable - content: - application/json: - schema: - $ref: "#/components/schemas/Error" - parameters: - - name: finetuned_model_id - description: The parent fine-tuned model ID. - in: path - required: true - schema: - type: string - - name: page_size - description: |- - Maximum number of results to be returned by the server. If 0, defaults to - 50. - in: query - required: false - schema: - type: integer - format: int32 - - name: page_token - description: Request a specific page of the list results. - in: query - required: false - schema: - type: string - - name: order_by - description: |- - Comma separated list of fields. For example: "created_at,name". The default - sorting order is ascending. To specify descending order for a field, append - " desc" to the field name. For example: "created_at desc,name". - - Supported sorting fields: - - created_at (default) - in: query - required: false - schema: - type: string - - $ref: "#/components/parameters/RequestSource" - tags: - - /finetuning - x-readme: - samples-languages: - - python - - java - - go - - node - - curl - code-samples: - - language: java - name: Cohere java SDK - install: implementation 'com.cohere:cohere-java' - code: > - package finetuning; - - - import com.cohere.api.Cohere; - - import - com.cohere.api.resources.finetuning.finetuning.types.ListEventsResponse; - - - public class ListEvents { - public static void main(String[] args) { - Cohere cohere = Cohere.builder().token("<>").clientName("snippet").build(); - - ListEventsResponse response = cohere.finetuning().listEvents("test-id"); - - System.out.println(response); - } - } - - language: go - name: Cohere Go SDK - install: go get github.com/cohere-ai/cohere-go/v2 - code: | - package main - - import ( - "context" - "log" - - "github.com/cohere-ai/cohere-go/v2/client" - ) - - func main() { - co := client.NewClient(client.WithToken("<>")) - - resp, err := co.Finetuning.ListEvents( - context.TODO(), - "test-finetuned-model-id", - nil, - ) - if err != nil { - log.Fatal(err) - } - - log.Printf("%+v", resp.Events) - } - - language: node - name: Cohere TypeScript SDK - install: npm i cohere-ai - code: > - const { CohereClient } = require('cohere-ai'); - - - const cohere = new CohereClient({ - token: '<>', - }); - - - (async () => { - const events = await cohere.finetuning.listEvents('test-finetuned-model-id'); - - console.log(events); - })(); - - language: python - name: Sync - install: python -m pip install cohere --upgrade - code: | - import cohere - - co = cohere.Client("<>") - response = co.finetuning.list_events(finetuned_model_id="test-id") - print(response) - - language: python - name: Async - install: python -m pip install cohere --upgrade - code: > - import cohere - - import asyncio - - - co = cohere.AsyncClient("<>") - - - - async def main(): - response = await co.finetuning.list_events(finetuned_model_id="test-id") - print(response) - - asyncio.run(main()) - - language: curl - name: cURL - code: > - curl --request GET \ - --url https://api.cohere.com/v1/finetuning/finetuned-models/test-id/events \ - --header 'accept: application/json' \ - --header "Authorization: bearer $CO_API_KEY" - x-fern-sdk-group-name: finetuning - x-fern-audiences: - - public - x-fern-request-name: FinetuningListEventsRequest - "/finetuning/finetuned-models/{finetuned_model_id}/training-step-metrics": - get: - summary: Retrieves metrics measured during the training of a fine-tuned model. - operationId: ListTrainingStepMetrics - responses: - "200": - description: A successful response. - content: - application/json: - schema: - $ref: "#/components/schemas/ListTrainingStepMetricsResponse" - example: - step_metrics: - - created_at: 2024-01-17T20:24:26.952802658Z - metrics: - accuracy: 0.4557601809501648 - cross_entropy: 4.264331340789795 - generation_accuracy: 0.4557601809501648 - generation_cross_entropy: 4.264331340789795 - step: 0 - - created_at: 2024-01-17T20:25:19.331940174Z - step_number: 9 - metrics: - accuracy: 0.7393720149993896 - cross_entropy: 0.7702581286430359 - generation_accuracy: 0.7393720149993896 - generation_cross_entropy: 0.7702581286430359 - step: 9 - "400": - description: Bad Request - content: - application/json: - schema: - $ref: "#/components/schemas/Error" - "401": - description: Unauthorized - content: - application/json: - schema: - $ref: "#/components/schemas/Error" - "403": - description: Forbidden - content: - application/json: - schema: - $ref: "#/components/schemas/Error" - "404": - description: Not Found - content: - application/json: - schema: - $ref: "#/components/schemas/Error" - "500": - description: Internal Server Error - content: - application/json: - schema: - $ref: "#/components/schemas/Error" - "503": - description: Status Service Unavailable - content: - application/json: - schema: - $ref: "#/components/schemas/Error" - parameters: - - name: finetuned_model_id - description: The parent fine-tuned model ID. - in: path - required: true - schema: - type: string - - name: page_size - description: |- - Maximum number of results to be returned by the server. If 0, defaults to - 50. - in: query - required: false - schema: - type: integer - format: int32 - - name: page_token - description: Request a specific page of the list results. - in: query - required: false - schema: - type: string - - $ref: "#/components/parameters/RequestSource" - tags: - - /finetuning - x-readme: - samples-languages: - - python - - java - - go - - node - - curl - code-samples: - - language: java - name: Cohere java SDK - install: implementation 'com.cohere:cohere-java' - code: > - package finetuning; - - - import com.cohere.api.Cohere; - - import - com.cohere.api.resources.finetuning.finetuning.types.ListTrainingStepMetricsResponse; - - - - public class ListTrainingStepMetrics { - public static void main(String[] args) { - Cohere cohere = Cohere.builder().token("<>").clientName("snippet").build(); - - ListTrainingStepMetricsResponse response = cohere.finetuning().listTrainingStepMetrics("test-id"); - - System.out.println(response); - } - } - - language: go - name: Cohere Go SDK - install: go get github.com/cohere-ai/cohere-go/v2 - code: | - package main - - import ( - "context" - "log" - - "github.com/cohere-ai/cohere-go/v2/client" - ) - - func main() { - co := client.NewClient(client.WithToken("<>")) - - resp, err := co.Finetuning.ListTrainingStepMetrics( - context.TODO(), - "test-finetuned-model-id", - nil, - ) - if err != nil { - log.Fatal(err) - } - - log.Printf("%+v", resp.StepMetrics) - } - - language: node - name: Cohere TypeScript SDK - install: npm i cohere-ai - code: > - const { CohereClient } = require('cohere-ai'); - - - const cohere = new CohereClient({ - token: '<>', - }); - - - (async () => { - const trainingStepMetrics = await cohere.finetuning.listTrainingStepMetrics( - 'test-finetuned-model-id' - ); - - console.log(trainingStepMetrics); - })(); - - language: python - name: Sync - install: python -m pip install cohere --upgrade - code: | - import cohere - - co = cohere.Client("<>") - train_step_metrics = co.finetuning.list_training_step_metrics( - finetuned_model_id="test-id") - print(train_step_metrics) - - language: python - name: Async - install: python -m pip install cohere --upgrade - code: > - import cohere - - import asyncio - - - co = cohere.AsyncClient("<>") - - - - async def main(): - response = await co.finetuning.list_train_step_metrics(finetuned_model_id="test-id") - print(response) - - asyncio.run(main()) - - language: curl - name: cURL - code: > - curl --request GET \ - --url https://api.cohere.com/v1/finetuning/finetuned-models/test-id/training-step-metrics \ - --header 'accept: application/json' \ - --header "Authorization: bearer $CO_API_KEY" - x-fern-sdk-group-name: finetuning - x-fern-audiences: - - public - x-fern-request-name: FinetuningListTrainingStepMetricsRequest -components: - securitySchemes: - bearerAuth: - type: http - x-fern-audiences: - - public - scheme: bearer - x-fern-bearer: - env: CO_API_KEY - parameters: - RequestSource: - name: X-Client-Name - description: | - The name of the project that is making the request. - x-fern-audiences: - - public - schema: - type: string - in: header - required: false - example: my-cool-project - schemas: - ChatRole: - type: string - description: | - One of `CHATBOT`, `SYSTEM`, `TOOL` or `USER` to identify who the message is coming from. - enum: - - CHATBOT - - SYSTEM - - USER - - TOOL - ToolCall: - description: | - Contains the tool calls generated by the model. Use it to invoke your tools. - type: object - required: - - name - - parameters - properties: - name: - x-fern-audiences: - - public - description: Name of the tool to call. - type: string - parameters: - x-fern-audiences: - - public - description: The name and value of the parameters to use when invoking a tool. - type: object - additionalProperties: true - ChatMessage: - description: | - Represents a single message in the chat history, excluding the current user turn. It has two properties: `role` and `message`. The `role` identifies the sender (`CHATBOT`, `SYSTEM`, or `USER`), while the `message` contains the text content. - - The chat_history parameter should not be used for `SYSTEM` messages in most cases. Instead, to add a `SYSTEM` role message at the beginning of a conversation, the `preamble` parameter should be used. - required: - - role - - message - properties: - role: - $ref: "#/components/schemas/ChatRole" - x-fern-audiences: - - public - message: - type: string - description: | - Contents of the chat message. - minLength: 1 - x-fern-audiences: - - public - tool_calls: - x-fern-audiences: - - public - type: array - items: - $ref: "#/components/schemas/ToolCall" - ToolResult: - type: object - required: - - call - - outputs - properties: - call: - $ref: "#/components/schemas/ToolCall" - outputs: - type: array - minItems: 0 - items: - type: object - additionalProperties: true - ToolMessage: - description: | - Represents tool result in the chat history. - required: - - role - properties: - role: - $ref: "#/components/schemas/ChatRole" - tool_results: - type: array - items: - $ref: "#/components/schemas/ToolResult" - Message: - oneOf: - - $ref: "#/components/schemas/ChatMessage" - - $ref: "#/components/schemas/ToolMessage" - discriminator: - propertyName: role - mapping: - CHATBOT: "#/components/schemas/ChatMessage" - SYSTEM: "#/components/schemas/ChatMessage" - USER: "#/components/schemas/ChatMessage" - TOOL: "#/components/schemas/ToolMessage" - ChatConnector: - description: | - The connector used for fetching documents. - type: object - required: - - id - properties: - id: - description: | - The identifier of the connector. - type: string - x-fern-audiences: - - public - minLength: 1 - user_access_token: - description: | - When specified, this user access token will be passed to the connector in the Authorization header instead of the Cohere generated one. - type: string - x-fern-audiences: - - public - continue_on_failure: - description: | - Defaults to `false`. - - When `true`, the request will continue if this connector returned an error. - type: boolean - x-fern-audiences: - - public - options: - description: | - Provides the connector with different settings at request time. The key/value pairs of this object are specific to each connector. - - For example, the connector `web-search` supports the `site` option, which limits search results to the specified domain. - type: object - x-fern-audiences: - - public - ChatDocument: - description: | - Relevant information that could be used by the model to generate a more accurate reply. - The contents of each document are generally short (under 300 words), and are passed in the form of a - dictionary of strings. Some suggested keys are "text", "author", "date". Both the key name and the value will be - passed to the model. - type: object - properties: - id: - description: Unique identifier for this document. - type: string - x-fern-audiences: - - public - additionalProperties: - type: string - x-fern-audiences: - - public - x-fern-type: map - Tool: - type: object - required: - - name - - description - properties: - name: - type: string - description: | - The name of the tool to be called. Valid names contain only the characters `a-z`, `A-Z`, `0-9`, `_` and must not begin with a digit. - description: - description: | - The description of what the tool does, the model uses the description to choose when and how to call the function. - type: string - parameter_definitions: - description: | - The input parameters of the tool. Accepts a dictionary where the key is the name of the parameter and the value is the parameter spec. Valid parameter names contain only the characters `a-z`, `A-Z`, `0-9`, `_` and must not begin with a digit. - ``` - { - "my_param": { - "description": , - "type": , // any python data type, such as 'str', 'bool' - "required": - } - } - ``` - type: object - additionalProperties: - type: object - required: - - type - properties: - description: - description: | - The description of the parameter. - type: string - type: - description: | - The type of the parameter. Must be a valid Python type. - type: string - required: - description: | - Denotes whether the parameter is always present (required) or not. Defaults to not required. - type: boolean - default: false - ResponseFormatType: - x-fern-audiences: - - public - description: | - When set to `"json_object"`, the model's output will be a valid JSON Object. - type: string - default: text - enum: - - text - - json_object - TextResponseFormat: - x-fern-audiences: - - public - type: object - properties: - type: - $ref: "#/components/schemas/ResponseFormatType" - required: - - type - JSONResponseFormat: - x-fern-audiences: - - public - type: object - properties: - type: - $ref: "#/components/schemas/ResponseFormatType" - schema: - description: | - [BETA] A JSON schema object that the output will adhere to. There are some restrictions we have on the schema, refer to [our guide](/docs/structured-outputs-json#schema-constraints) for more information. - Example (required name and age object): - ```json JSON - { - "type": "object", - "properties": { - "name": {"type": "string"}, - "age": {"type": "integer"} - }, - "required": ["name", "age"] - } - ``` - - **Note**: This field must not be specified when the `type` is set to `"text"`. - type: object - required: - - type - ResponseFormat: - description: | - Configuration for forcing the model output to adhere to the specified format. Supported on [Command R](https://docs.cohere.com/docs/command-r), [Command R+](https://docs.cohere.com/docs/command-r-plus) and newer models. - - The model can be forced into outputting JSON objects (with up to 5 levels of nesting) by setting `{ "type": "json_object" }`. - - A [JSON Schema](https://json-schema.org/) can optionally be provided, to ensure a specific structure. - - **Note**: When using `{ "type": "json_object" }` your `message` should always explicitly instruct the model to generate a JSON (eg: _"Generate a JSON ..."_) . Otherwise the model may end up getting stuck generating an infinite stream of characters and eventually run out of context length. - **Limitation**: The parameter is not supported in RAG mode (when any of `connectors`, `documents`, `tools`, `tool_results` are provided). - oneOf: - - $ref: "#/components/schemas/TextResponseFormat" - - $ref: "#/components/schemas/JSONResponseFormat" - discriminator: - propertyName: type - mapping: - text: "#/components/schemas/TextResponseFormat" - json_object: "#/components/schemas/JSONResponseFormat" - ChatCitation: - description: | - A section of the generated reply which cites external knowledge. - required: - - start - - end - - text - - document_ids - properties: - start: - description: | - The index of text that the citation starts at, counting from zero. For example, a generation of `Hello, world!` with a citation on `world` would have a start value of `7`. This is because the citation starts at `w`, which is the seventh character. - type: integer - x-fern-audiences: - - public - end: - description: | - The index of text that the citation ends after, counting from zero. For example, a generation of `Hello, world!` with a citation on `world` would have an end value of `11`. This is because the citation ends after `d`, which is the eleventh character. - type: integer - x-fern-audiences: - - public - text: - description: | - The text of the citation. For example, a generation of `Hello, world!` with a citation of `world` would have a text value of `world`. - type: string - x-fern-audiences: - - public - minLength: 1 - document_ids: - description: | - Identifiers of documents cited by this section of the generated reply. - type: array - x-fern-audiences: - - public - items: - type: string - x-fern-audiences: - - public - minItems: 1 - ChatSearchQuery: - description: | - The generated search query. Contains the text of the query and a unique identifier for the query. - type: object - required: - - text - - generation_id - properties: - text: - description: | - The text of the search query. - type: string - x-fern-audiences: - - public - generation_id: - description: | - Unique identifier for the generated search query. Useful for submitting feedback. - type: string - x-fern-audiences: - - public - format: uuid - ChatSearchResultConnector: - description: | - The connector used for fetching documents. - type: object - required: - - id - properties: - id: - description: | - The identifier of the connector. - type: string - x-fern-audiences: - - public - minLength: 1 - ChatSearchResult: - type: object - required: - - connector - - document_ids - properties: - search_query: - $ref: "#/components/schemas/ChatSearchQuery" - x-fern-audiences: - - public - connector: - description: | - The connector from which this result comes from. - $ref: "#/components/schemas/ChatSearchResultConnector" - x-fern-audiences: - - public - document_ids: - description: | - Identifiers of documents found by this search query. - type: array - x-fern-audiences: - - public - minLength: 0 - items: - type: string - x-fern-audiences: - - public - minLength: 1 - error_message: - description: | - An error message if the search failed. - type: string - x-fern-audiences: - - public - continue_on_failure: - description: | - Whether a chat request should continue or not if the request to this connector fails. - type: boolean - x-fern-audiences: - - public - FinishReason: - type: string - enum: - - COMPLETE - - STOP_SEQUENCE - - ERROR - - ERROR_TOXIC - - ERROR_LIMIT - - USER_CANCEL - - MAX_TOKENS - ApiMeta: - type: object - properties: - api_version: - type: object - x-fern-audiences: - - public - properties: - version: - type: string - x-fern-audiences: - - public - is_deprecated: - type: boolean - x-fern-audiences: - - public - is_experimental: - type: boolean - x-fern-audiences: - - public - required: - - version - billed_units: - type: object - x-fern-audiences: - - public - properties: - input_tokens: - type: number - x-fern-audiences: - - public - description: | - The number of billed input tokens. - output_tokens: - type: number - x-fern-audiences: - - public - description: | - The number of billed output tokens. - search_units: - type: number - x-fern-audiences: - - public - description: | - The number of billed search units. - classifications: - type: number - x-fern-audiences: - - public - description: | - The number of billed classifications units. - tokens: - type: object - x-fern-audiences: - - public - properties: - input_tokens: - type: number - x-fern-audiences: - - public - description: | - The number of tokens used as input to the model. - output_tokens: - type: number - x-fern-audiences: - - public - description: | - The number of tokens produced by the model. - warnings: - type: array - x-fern-audiences: - - public - items: - type: string - x-fern-audiences: - - public - NonStreamedChatResponse: - required: - - text - x-fern-type-name: NonStreamedChatResponse - properties: - text: - type: string - x-fern-audiences: - - public - minLength: 1 - description: Contents of the reply generated by the model. - generation_id: - type: string - x-fern-audiences: - - public - format: uuid - description: - Unique identifier for the generated reply. Useful for submitting - feedback. - citations: - type: array - x-fern-audiences: - - public - minItems: 0 - description: Inline citations for the generated reply. - items: - $ref: "#/components/schemas/ChatCitation" - documents: - type: array - x-fern-audiences: - - public - minItems: 0 - description: Documents seen by the model when generating the reply. - items: - $ref: "#/components/schemas/ChatDocument" - is_search_required: - type: boolean - x-fern-audiences: - - public - description: Denotes that a search for documents is required during the RAG flow. - search_queries: - type: array - x-fern-audiences: - - public - description: Generated search queries, meant to be used as part of the RAG flow. - items: - $ref: "#/components/schemas/ChatSearchQuery" - search_results: - type: array - x-fern-audiences: - - public - minItems: 0 - description: Documents retrieved from each of the conducted searches. - items: - $ref: "#/components/schemas/ChatSearchResult" - finish_reason: - x-fern-audiences: - - public - $ref: "#/components/schemas/FinishReason" - tool_calls: - x-fern-audiences: - - public - type: array - items: - $ref: "#/components/schemas/ToolCall" - chat_history: - type: array - x-fern-audiences: - - public - minItems: 0 - items: - $ref: "#/components/schemas/Message" - description: | - A list of previous messages between the user and the model, meant to give the model conversational context for responding to the user's `message`. - prompt: - x-hide-from-docs: true - x-fern-audiences: - - public - type: string - description: - The prompt that was used. Only present when `return_prompt` in the - request is set to true. - meta: - $ref: "#/components/schemas/ApiMeta" - x-fern-audiences: - - public - ChatStreamEvent: - required: - - event_type - properties: - event_type: - type: string - x-fern-audiences: - - public - enum: - - stream-start - - search-queries-generation - - search-results - - text-generation - - citation-generation - - stream-end - ChatStreamStartEvent: - allOf: - - $ref: "#/components/schemas/ChatStreamEvent" - - type: object - required: - - generation_id - properties: - generation_id: - description: | - Unique identifier for the generated reply. Useful for submitting feedback. - type: string - x-fern-audiences: - - public - format: uuid - minLength: 1 - ChatSearchQueriesGenerationEvent: - allOf: - - $ref: "#/components/schemas/ChatStreamEvent" - - type: object - required: - - search_queries - properties: - search_queries: - type: array - x-fern-audiences: - - public - description: Generated search queries, meant to be used as part of the RAG flow. - items: - $ref: "#/components/schemas/ChatSearchQuery" - ChatSearchResultsEvent: - allOf: - - $ref: "#/components/schemas/ChatStreamEvent" - - type: object - properties: - search_results: - description: | - Conducted searches and the ids of documents retrieved from each of them. - type: array - x-fern-audiences: - - public - minItems: 0 - items: - $ref: "#/components/schemas/ChatSearchResult" - documents: - description: | - Documents fetched from searches or provided by the user. - type: array - x-fern-audiences: - - public - minItems: 0 - items: - $ref: "#/components/schemas/ChatDocument" - ChatTextGenerationEvent: - allOf: - - $ref: "#/components/schemas/ChatStreamEvent" - - type: object - required: - - text - properties: - text: - description: | - The next batch of text generated by the model. - type: string - x-fern-audiences: - - public - minLength: 1 - ChatCitationGenerationEvent: - allOf: - - $ref: "#/components/schemas/ChatStreamEvent" - - type: object - required: - - citations - properties: - citations: - description: | - Citations for the generated reply. - type: array - x-fern-audiences: - - public - items: - $ref: "#/components/schemas/ChatCitation" - ChatToolCallsGenerationEvent: - allOf: - - $ref: "#/components/schemas/ChatStreamEvent" - - type: object - required: - - tool_calls - properties: - text: - description: | - The text generated related to the tool calls generated - type: string - x-fern-audiences: - - public - tool_calls: - x-fern-audiences: - - public - type: array - items: - $ref: "#/components/schemas/ToolCall" - ChatStreamEndEvent: - allOf: - - $ref: "#/components/schemas/ChatStreamEvent" - - type: object - required: - - finish_reason - - response - properties: - finish_reason: - description: | - - `COMPLETE` - the model sent back a finished reply - - `ERROR_LIMIT` - the reply was cut off because the model reached the maximum number of tokens for its context length - - `MAX_TOKENS` - the reply was cut off because the model reached the maximum number of tokens specified by the max_tokens parameter - - `ERROR` - something went wrong when generating the reply - - `ERROR_TOXIC` - the model generated a reply that was deemed toxic - type: string - x-fern-audiences: - - public - enum: - - COMPLETE - - ERROR_LIMIT - - MAX_TOKENS - - ERROR - - ERROR_TOXIC - response: - x-fern-audiences: - - public - description: | - The consolidated response from the model. Contains the generated reply and all the other information streamed back in the previous events. - $ref: "#/components/schemas/NonStreamedChatResponse" - ToolCallDelta: - description: | - Contains the chunk of the tool call generation in the stream. - type: object - properties: - name: - description: | - Name of the tool call - type: string - x-fern-audiences: - - public - index: - description: | - Index of the tool call generated - type: number - x-fern-audiences: - - public - parameters: - description: | - Chunk of the tool parameters - type: string - x-fern-audiences: - - public - text: - description: | - Chunk of the tool plan text - type: string - x-fern-audiences: - - public - ChatToolCallsChunkEvent: - allOf: - - $ref: "#/components/schemas/ChatStreamEvent" - - type: object - required: - - tool_call_delta - properties: - tool_call_delta: - $ref: "#/components/schemas/ToolCallDelta" - x-fern-audiences: - - public - StreamedChatResponse: - description: - StreamedChatResponse is returned in streaming mode (specified with - `stream=True` in the request). - x-fern-type-name: StreamedChatResponse - oneOf: - - $ref: "#/components/schemas/ChatStreamStartEvent" - - $ref: "#/components/schemas/ChatSearchQueriesGenerationEvent" - - $ref: "#/components/schemas/ChatSearchResultsEvent" - - $ref: "#/components/schemas/ChatTextGenerationEvent" - - $ref: "#/components/schemas/ChatCitationGenerationEvent" - - $ref: "#/components/schemas/ChatToolCallsGenerationEvent" - - $ref: "#/components/schemas/ChatStreamEndEvent" - - $ref: "#/components/schemas/ChatToolCallsChunkEvent" - discriminator: - propertyName: event_type - mapping: - stream-start: "#/components/schemas/ChatStreamStartEvent" - search-queries-generation: "#/components/schemas/ChatSearchQueriesGenerationEvent" - search-results: "#/components/schemas/ChatSearchResultsEvent" - text-generation: "#/components/schemas/ChatTextGenerationEvent" - citation-generation: "#/components/schemas/ChatCitationGenerationEvent" - tool-calls-generation: "#/components/schemas/ChatToolCallsGenerationEvent" - stream-end: "#/components/schemas/ChatStreamEndEvent" - tool-calls-chunk: "#/components/schemas/ChatToolCallsChunkEvent" - SingleGeneration: - type: object - properties: - id: - type: string - x-fern-audiences: - - public - text: - type: string - x-fern-audiences: - - public - index: - type: integer - x-fern-audiences: - - public - description: - Refers to the nth generation. Only present when `num_generations` - is greater than zero. - likelihood: - type: number - x-fern-audiences: - - public - token_likelihoods: - type: array - x-fern-audiences: - - public - description: - Only returned if `return_likelihoods` is set to `GENERATION` or - `ALL`. The likelihood refers to the average log-likelihood of the - entire specified string, which is useful for [evaluating the - performance of your model](likelihood-eval), especially if you've - created a [custom model](/docs/training-custom-models). Individual - token likelihoods provide the log-likelihood of each token. The - first token will not have a likelihood. - items: - type: object - x-fern-audiences: - - public - properties: - token: - type: string - x-fern-audiences: - - public - likelihood: - type: number - x-fern-audiences: - - public - required: - - id - - token - - likelihood - required: - - text - - id - Generation: - type: object - x-fern-type-name: Generation - required: - - id - - generations - properties: - id: - type: string - x-fern-audiences: - - public - prompt: - type: string - x-fern-audiences: - - public - description: Prompt used for generations. - generations: - type: array - x-fern-audiences: - - public - description: List of generated results - items: - type: object - x-fern-audiences: - - public - $ref: "#/components/schemas/SingleGeneration" - meta: - $ref: "#/components/schemas/ApiMeta" - x-fern-audiences: - - public - GenerateStreamEvent: - required: - - event_type - properties: - event_type: - type: string - enum: - - text-generation - - stream-end - - stream-error - GenerateStreamText: - allOf: - - $ref: "#/components/schemas/GenerateStreamEvent" - - type: object - required: - - is_finished - - text - properties: - text: - type: string - description: A segment of text of the generation. - index: - type: integer - description: - Refers to the nth generation. Only present when `num_generations` - is greater than zero, and only when text responses are being - streamed. - is_finished: - type: boolean - SingleGenerationInStream: - type: object - properties: - id: - type: string - x-fern-audiences: - - public - text: - type: string - x-fern-audiences: - - public - description: Full text of the generation. - index: - type: integer - x-fern-audiences: - - public - description: - Refers to the nth generation. Only present when `num_generations` - is greater than zero. - finish_reason: - x-fern-audiences: - - public - $ref: "#/components/schemas/FinishReason" - required: - - text - - id - - finish_reason - GenerateStreamEnd: - allOf: - - $ref: "#/components/schemas/GenerateStreamEvent" - - type: object - required: - - is_finished - - finish_response - - response - properties: - is_finished: - x-fern-audiences: - - public - type: boolean - finish_reason: - x-fern-audiences: - - public - $ref: "#/components/schemas/FinishReason" - response: - type: object - x-fern-audiences: - - public - required: - - id - properties: - id: - x-fern-audiences: - - public - type: string - prompt: - x-fern-audiences: - - public - type: string - generations: - x-fern-audiences: - - public - type: array - items: - $ref: "#/components/schemas/SingleGenerationInStream" - GenerateStreamError: - allOf: - - $ref: "#/components/schemas/GenerateStreamEvent" - - type: object - required: - - is_finished - - finish_reason - - err - properties: - index: - x-fern-audiences: - - public - type: integer - description: - Refers to the nth generation. Only present when `num_generations` - is greater than zero. - is_finished: - x-fern-audiences: - - public - type: boolean - finish_reason: - x-fern-audiences: - - public - $ref: "#/components/schemas/FinishReason" - err: - x-fern-audiences: - - public - type: string - description: Error message - GenerateStreamedResponse: - description: - Response in content type stream when `stream` is `true` in the - request parameters. Generation tokens are streamed with the - GenerationStream response. The final response is of type - GenerationFinalResponse. - x-fern-type-name: GenerateStreamedResponse - oneOf: - - $ref: "#/components/schemas/GenerateStreamText" - - $ref: "#/components/schemas/GenerateStreamEnd" - - $ref: "#/components/schemas/GenerateStreamError" - discriminator: - propertyName: event_type - mapping: - text-generation: "#/components/schemas/GenerateStreamText" - stream-end: "#/components/schemas/GenerateStreamEnd" - stream-error: "#/components/schemas/GenerateStreamError" - EmbedInputType: - type: string - enum: - - search_document - - search_query - - classification - - clustering - description: | - Specifies the type of input passed to the model. Required for embedding models v3 and higher. - - - `"search_document"`: Used for embeddings stored in a vector database for search use-cases. - - `"search_query"`: Used for embeddings of search queries run against a vector DB to find relevant documents. - - `"classification"`: Used for embeddings passed through a text classifier. - - `"clustering"`: Used for the embeddings run through a clustering algorithm. - EmbeddingType: - x-fern-audiences: - - public - type: string - writeOnly: true - enum: - - float - - int8 - - uint8 - - binary - - ubinary - EmbedFloatsResponse: - type: object - required: - - id - - embeddings - - texts - - api_version - properties: - response_type: - type: string - x-fern-audiences: - - public - enum: - - embeddings_floats - - embeddings_by_type - id: - type: string - x-fern-audiences: - - public - embeddings: - type: array - x-fern-audiences: - - public - description: - An array of embeddings, where each embedding is an array of floats. - The length of the `embeddings` array will be the same as the length - of the original `texts` array. - items: - type: array - x-fern-audiences: - - public - items: - type: number - x-fern-audiences: - - public - readOnly: true - readOnly: true - texts: - type: array - x-fern-audiences: - - public - description: The text entries for which embeddings were returned. - items: - type: string - x-fern-audiences: - - public - meta: - $ref: "#/components/schemas/ApiMeta" - x-fern-audiences: - - public - x-examples: - Example: - value: - id: bc57846a-3e56-4327-8acc-588ca1a37b8a - texts: - - hello world - embeddings: - - - -0.039520264 - - -0.04574585 - - -0.08807373 - - -0.084106445 - - -0.009742737 - - -0.0090408325 - - -0.048187256 - - 0.07128906 - - 0.010688782 - - 0.016067505 - - -0.02822876 - - 0.036224365 - - 0.037994385 - - -0.041992188 - - 0.052124023 - - -0.027297974 - - 0.048309326 - - 0.017410278 - - 0.004283905 - - -0.0058555603 - - -0.012992859 - - 0.023040771 - - 0.00121212 - - 0.02078247 - - 0.04827881 - - -0.021530151 - - 0.017807007 - - 0.0075531006 - - -0.047912598 - - -0.042633057 - - 0.0016927719 - - 0.04547119 - - 0.0143585205 - - 0.022354126 - - 0.0017910004 - - 0.048614502 - - -0.02609253 - - 0.007850647 - - 0.00907135 - - 0.0035381317 - - 0.015289307 - - -0.008132935 - - 0.016296387 - - -0.02859497 - - -0.023712158 - - 0.008857727 - - -0.04309082 - - -0.025115967 - - 0.032928467 - - -0.029663086 - - 0.00434494 - - -0.022338867 - - -0.004371643 - - -0.0075035095 - - -0.009529114 - - 0.0038223267 - - -0.06048584 - - -0.018127441 - - 0.010131836 - - 0.08380127 - - 0.03652954 - - 0.0030384064 - - 0.006034851 - - -0.006286621 - - 0.016784668 - - -0.00308609 - - 0.01612854 - - 0.011413574 - - 0.022491455 - - 0.02482605 - - 0.0047683716 - - 0.012245178 - - -0.017593384 - - -0.023254395 - - -0.012641907 - - 0.030181885 - - -0.015365601 - - 0.031021118 - - 0.015144348 - - 0.016708374 - - 0.02180481 - - 0.010765076 - - -0.015586853 - - -0.05819702 - - 0.02128601 - - -0.021713257 - - -0.013320923 - - -0.0064849854 - - -0.001657486 - - -0.030715942 - - -0.008666992 - - 0.060668945 - - -0.0011959076 - - -0.032104492 - - -0.057006836 - - -0.015655518 - - -0.014015198 - - 0.036987305 - - 0.011016846 - - 0.037475586 - - -0.015319824 - - -0.016479492 - - 0.0030403137 - - -0.028167725 - - -0.0067825317 - - -0.00894928 - - -0.026107788 - - 0.010231018 - - 0.031707764 - - 0.050354004 - - -0.016220093 - - 0.04345703 - - -0.008888245 - - -0.0037784576 - - -0.034576416 - - 0.002565384 - - -0.0018634796 - - 0.013954163 - - 0.012062073 - - 0.046813965 - - 0.033081055 - - 0.028778076 - - 0.0051231384 - - 0.022094727 - - -0.021881104 - - -0.009788513 - - -0.04647827 - - -0.025482178 - - 0.066833496 - - -0.040863037 - - -0.019714355 - - 0.06866455 - - -0.07519531 - - -0.045532227 - - -0.020507812 - - 0.021331787 - - 0.036376953 - - -0.034210205 - - 0.017669678 - - 0.0155181885 - - 0.047698975 - - -0.010368347 - - 0.010879517 - - 0.016555786 - - -0.028076172 - - 0.03225708 - - -0.0056152344 - - -0.020690918 - - 0.00011438131 - - -0.021011353 - - -0.04425049 - - -0.029922485 - - -0.0014362335 - - 0.013618469 - - 0.011260986 - - 0.017532349 - - -0.043426514 - - 0.012557983 - - 0.026748657 - - 0.039154053 - - -0.030944824 - - 0.024169922 - - 0.06573486 - - -0.03817749 - - -0.025314331 - - -0.039794922 - - -0.050445557 - - -0.0020828247 - - -0.0010194778 - - 0.01725769 - - 0.0017976761 - - 0.029067993 - - 0.0115356445 - - 0.005214691 - - 0.0066604614 - - -0.014801025 - - -0.033172607 - - 0.023956299 - - 0.008865356 - - 0.09539795 - - 0.062286377 - - -0.0076408386 - - -0.035125732 - - 0.09082031 - - -0.015350342 - - -0.015625 - - -0.0090789795 - - -0.01876831 - - 0.05239868 - - -0.010406494 - - 0.05078125 - - -0.013694763 - - -0.07244873 - - 0.018539429 - - -0.016983032 - - -0.03353882 - - 0.01739502 - - 0.004055023 - - -0.010147095 - - -0.0027599335 - - -0.002714157 - - -0.0107040405 - - 0.021438599 - - -0.029525757 - - 0.01902771 - - -0.025909424 - - 0.0008072853 - - 0.026672363 - - 0.0019044876 - - 0.016937256 - - -0.018814087 - - -0.03668213 - - 0.03338623 - - -0.09240723 - - -0.024765015 - - -0.019378662 - - -0.051757812 - - 0.050109863 - - 0.018859863 - - 0.01687622 - - 0.020111084 - - -0.041534424 - - 0.009559631 - - -0.018859863 - - 0.00005853176 - - 0.032684326 - - -0.04058838 - - 0.015823364 - - -0.038635254 - - 0.0055656433 - - -0.021560669 - - 0.012481689 - - -0.050872803 - - -0.036071777 - - -0.046844482 - - -0.041900635 - - -0.06561279 - - 0.014785767 - - 0.010124207 - - 0.030426025 - - 0.024261475 - - 0.0057411194 - - -0.026275635 - - -0.006919861 - - 0.022750854 - - -0.015167236 - - 0.022964478 - - -0.0033664703 - - 0.02734375 - - 0.03201294 - - 0.025939941 - - 0.019104004 - - 0.028030396 - - -0.014328003 - - -0.01574707 - - 0.06982422 - - -0.008026123 - - 0.006816864 - - -0.0019035339 - - 0.026245117 - - -0.028945923 - - 0.014968872 - - 0.0054244995 - - -0.00028896332 - - -0.02243042 - - -0.0030822754 - - -0.02558899 - - -0.022918701 - - -0.017089844 - - -0.0035190582 - - 0.029953003 - - -0.037078857 - - -0.02507019 - - -0.017303467 - - 0.064331055 - - -0.028533936 - - -0.07287598 - - 0.028839111 - - -0.0029792786 - - -0.02104187 - - -0.01663208 - - -0.016571045 - - -0.015106201 - - 0.0027313232 - - 0.031051636 - - -0.025680542 - - 0.004722595 - - 0.032348633 - - 0.020019531 - - 0.056365967 - - 0.07208252 - - 0.01235199 - - 0.00084495544 - - 0.035369873 - - -0.018569946 - - -0.0063552856 - - 0.03161621 - - 0.064575195 - - -0.02557373 - - -0.007232666 - - -0.017700195 - - -0.003835678 - - 0.007381439 - - -0.0385437 - - -0.0019102097 - - -0.023223877 - - -0.0124435425 - - 0.013343811 - - 0.020996094 - - -0.014022827 - - -0.01939392 - - 0.044128418 - - 0.0052757263 - - -0.00068950653 - - -0.04876709 - - -0.05609131 - - -0.020874023 - - -0.00806427 - - -0.13391113 - - -0.06323242 - - -0.021865845 - - -0.021072388 - - 0.005832672 - - -0.015701294 - - -0.006286621 - - -0.012954712 - - -0.017288208 - - 0.0036773682 - - -0.0084991455 - - -0.03213501 - - 0.021987915 - - -0.010322571 - - -0.029144287 - - 0.003824234 - - 0.02708435 - - 0.0026187897 - - 0.05496216 - - -0.04916382 - - 0.005466461 - - -0.0070648193 - - 0.0793457 - - -0.040863037 - - 0.012641907 - - 0.016448975 - - 0.02041626 - - -0.029006958 - - -0.008491516 - - 0.0023422241 - - 0.043640137 - - 0.0121536255 - - -0.0043525696 - - -0.030899048 - - 0.0062332153 - - -0.013038635 - - 0.007904053 - - -0.03390503 - - -0.034729004 - - -0.0647583 - - -0.0052375793 - - -0.08154297 - - 0.015960693 - - 0.016235352 - - -0.012130737 - - -0.021469116 - - -0.03253174 - - -0.014465332 - - 0.016448975 - - 0.004589081 - - -0.05291748 - - 0.018005371 - - -0.002981186 - - -0.01247406 - - 0.023147583 - - -0.055419922 - - -0.08526611 - - 0.016723633 - - 0.012939453 - - -0.039031982 - - 0.016677856 - - 0.016937256 - - 0.023147583 - - 0.034576416 - - -0.010635376 - - 0.03466797 - - 0.037750244 - - 0.020141602 - - -0.0046539307 - - 0.0059432983 - - 0.05609131 - - 0.027709961 - - 0.01838684 - - 0.015022278 - - -0.039215088 - - -0.0048828125 - - 0.047546387 - - 0.0138549805 - - -0.046203613 - - 0.036193848 - - -0.109680176 - - 0.0019550323 - - -0.03125 - - 0.0084991455 - - -0.0020256042 - - -0.001739502 - - -0.06756592 - - 0.03491211 - - -0.05633545 - - -0.008491516 - - 0.0048446655 - - 0.042663574 - - 0.025054932 - - -0.022247314 - - -0.0044555664 - - 0.0022335052 - - -0.0071907043 - - -0.003982544 - - -0.073913574 - - -0.011253357 - - 0.029220581 - - -0.0047073364 - - -0.04626465 - - 0.05670166 - - -0.041503906 - - 0.014579773 - - -0.016174316 - - 0.021560669 - - -0.019332886 - - 0.01550293 - - 0.02709961 - - 0.010528564 - - 0.012786865 - - -0.023849487 - - -0.016937256 - - -0.04626465 - - -0.04397583 - - 0.026245117 - - -0.017868042 - - 0.021072388 - - -0.02128601 - - -0.012161255 - - -0.004776001 - - -0.0088272095 - - 0.009246826 - - -0.012313843 - - 0.0096206665 - - -0.0047950745 - - -0.0079956055 - - 0.052520752 - - -0.06616211 - - 0.0014686584 - - -0.046081543 - - 0.03289795 - - -0.03656006 - - 0.055389404 - - 0.009773254 - - 0.0013818741 - - 0.043823242 - - 0.034942627 - - 0.055236816 - - -0.011833191 - - -0.024353027 - - 0.011398315 - - -0.051574707 - - -0.019882202 - - 0.0018358231 - - -0.005859375 - - 0.06677246 - - -0.0009851456 - - -0.026809692 - - 0.0075798035 - - -0.021347046 - - -0.01146698 - - 0.03262329 - - 0.031585693 - - -0.006729126 - - 0.008659363 - - -0.025665283 - - 0.02947998 - - -0.03744507 - - 0.02027893 - - -0.026062012 - - 0.018585205 - - -0.004463196 - - -0.036865234 - - -0.043670654 - - 0.021392822 - - -0.062561035 - - -0.080078125 - - 0.011451721 - - 0.06762695 - - 0.039001465 - - -0.016799927 - - 0.049072266 - - 0.041412354 - - -0.03062439 - - 0.011795044 - - -0.016555786 - - 0.046569824 - - 0.010688782 - - -0.01902771 - - -0.031097412 - - -0.023391724 - - -0.01651001 - - 0.009399414 - - 0.049041748 - - -0.025817871 - - -0.018356323 - - 0.02154541 - - -0.0029411316 - - 0.074157715 - - 0.017059326 - - -0.0017595291 - - 0.00390625 - - 0.02645874 - - -0.0010709763 - - 0.040222168 - - -0.034423828 - - 0.0231781 - - -0.016693115 - - -0.022094727 - - 0.004383087 - - 0.007331848 - - 0.018676758 - - 0.023773193 - - -0.0069770813 - - 0.0029773712 - - -0.023712158 - - -0.0051956177 - - -0.011810303 - - -0.0519104 - - 0.07244873 - - 0.032409668 - - 0.016662598 - - 0.015716553 - - -0.03640747 - - 0.03918457 - - -0.046722412 - - -0.0046081543 - - 0.006061554 - - -0.011940002 - - -0.0004878044 - - 0.01260376 - - 0.0073280334 - - 0.0015096664 - - 0.005844116 - - 0.029129028 - - 0.047668457 - - 0.05960083 - - -0.0647583 - - 0.064697266 - - -0.017440796 - - -0.01889038 - - 0.037628174 - - 0.0048065186 - - -0.023101807 - - -0.048675537 - - -0.02508545 - - -0.007965088 - - 0.0015897751 - - 0.06866455 - - -0.0099487305 - - -0.0022964478 - - -0.030014038 - - -0.007713318 - - -0.034362793 - - 0.013931274 - - 0.0026836395 - - -0.0014476776 - - 0.02532959 - - -0.020584106 - - -0.039001465 - - -0.062347412 - - -0.04736328 - - -0.024368286 - - -0.045776367 - - 0.03149414 - - -0.012825012 - - 0.028076172 - - 0.0058784485 - - 0.08062744 - - 0.0104599 - - 0.014579773 - - -0.041137695 - - 0.04244995 - - -0.021011353 - - 0.06390381 - - 0.0010871887 - - 0.04147339 - - -0.0053138733 - - 0.02268982 - - -0.028182983 - - -0.022628784 - - -0.021408081 - - -0.006088257 - - 0.028030396 - - 0.025146484 - - 0.00881958 - - -0.04244995 - - 0.027938843 - - 0.013916016 - - -0.04647827 - - 0.0072288513 - - 0.017745972 - - -0.02381897 - - -0.010147095 - - 0.0096588135 - - -0.04586792 - - -0.014480591 - - -0.0027217865 - - -0.03111267 - - 0.04522705 - - -0.02772522 - - -0.0013189316 - - 0.017807007 - - -0.0135269165 - - -0.014175415 - - -0.00019681454 - - 0.03161621 - - 0.0041007996 - - -0.024871826 - - 0.0039367676 - - -0.026916504 - - 0.03237915 - - 0.007068634 - - 0.029647827 - - -0.0102005005 - - 0.0076675415 - - 0.0051078796 - - -0.008041382 - - -0.0062942505 - - 0.0010309219 - - 0.010543823 - - -0.010101318 - - -0.013496399 - - 0.00920105 - - 0.0546875 - - -0.02784729 - - -0.0056762695 - - -0.08679199 - - -0.050048828 - - 0.03378296 - - 0.010124207 - - 0.019058228 - - -0.037872314 - - -0.0063323975 - - 0.0014324188 - - -0.010002136 - - -0.015731812 - - -0.036071777 - - -0.0028915405 - - -0.0082092285 - - 0.0037841797 - - -0.020629883 - - 0.01725769 - - -0.026000977 - - 0.00012862682 - - 0.021621704 - - 0.07086182 - - -0.008049011 - - -0.012634277 - - -0.064941406 - - -0.0073013306 - - -0.02760315 - - -0.040649414 - - 0.02809143 - - 0.009849548 - - 0.0011720657 - - 0.059936523 - - -0.032806396 - - 0.06311035 - - 0.009536743 - - 0.014801025 - - 0.03390503 - - -0.002620697 - - -0.04650879 - - -0.015365601 - - 0.03741455 - - -0.0067443848 - - -0.008888245 - - -0.0013017654 - - -0.010154724 - - 0.0027217865 - - 0.016052246 - - 0.025100708 - - -0.030532837 - - 0.032318115 - - 0.014564514 - - -0.009109497 - - 0.009628296 - - -0.021438599 - - -0.049926758 - - -0.00088214874 - - -0.019638062 - - -0.020126343 - - 0.055847168 - - -0.006729126 - - -0.044921875 - - -0.01890564 - - -0.0026683807 - - 0.0038547516 - - 0.004600525 - - -0.013977051 - - 0.018341064 - - -0.05178833 - - 0.011054993 - - 0.019927979 - - 0.011436462 - - 0.010391235 - - -0.012680054 - - -0.017669678 - - 0.01928711 - - 0.025115967 - - -0.07757568 - - -0.030960083 - - 0.013137817 - - -0.066467285 - - -0.054473877 - - -0.04244995 - - -0.027526855 - - 0.02973938 - - -0.024017334 - - -0.03918457 - - 0.0154800415 - - -0.036315918 - - 0.015510559 - - -0.020385742 - - -0.0390625 - - -0.00137043 - - 0.0016002655 - - -0.010238647 - - 0.014656067 - - 0.029373169 - - -0.027023315 - - 0.0076141357 - - -0.001917839 - - 0.03451538 - - 0.004814148 - - 0.024887085 - - 0.036315918 - - -0.006500244 - - -0.070495605 - - -0.0071754456 - - 0.025863647 - - 0.022994995 - - 0.007217407 - - 0.032165527 - - 0.016830444 - - 0.02859497 - - -0.011123657 - - 0.020126343 - - -0.0014410019 - - 0.0021781921 - - 0.053619385 - - 0.015625 - - 0.017150879 - - -0.03326416 - - -0.04626465 - - 0.034332275 - - 0.07165527 - - -0.040740967 - - -0.06628418 - - -0.024291992 - - -0.0066871643 - - 0.065979004 - - 0.034851074 - - 0.07678223 - - 0.053009033 - - 0.0317688 - - -0.04019165 - - 0.030288696 - - 0.062347412 - - -0.011734009 - - 0.0024604797 - - 0.006095886 - - -0.0152282715 - - 0.056762695 - - 0.021270752 - - -0.011154175 - - -0.0143966675 - - 0.0057754517 - - -0.0003619194 - - 0.0053367615 - - -0.030639648 - - 0.0024776459 - - -0.031799316 - - -0.012710571 - - 0.048828125 - - 0.029632568 - - 0.013244629 - - 0.087890625 - - -0.01134491 - - 0.028656006 - - -0.014778137 - - 0.06695557 - - 0.026275635 - - -0.016113281 - - 0.018859863 - - -0.008239746 - - 0.024383545 - - -0.039154053 - - -0.006252289 - - 0.049224854 - - -0.04638672 - - 0.0031967163 - - -0.04849243 - - -0.04058838 - - 0.038757324 - - 0.00730896 - - -0.04345703 - - 0.04296875 - - -0.0024299622 - - -0.05670166 - - 0.019119263 - - -0.011802673 - - 0.038970947 - - -0.03366089 - - 0.03591919 - - -0.0009088516 - - 0.013259888 - - -0.07342529 - - 0.004299164 - - 0.0395813 - - 0.013420105 - - -0.004459381 - - -0.0084991455 - - 0.031982422 - - 0.018249512 - - -0.0038604736 - - -0.022323608 - - -0.013031006 - - 0.0513916 - - -0.007068634 - - -0.003545761 - - 0.010292053 - - -0.010322571 - - -0.0037841797 - - 0.043701172 - - -0.012672424 - - 0.013725281 - - 0.021575928 - - -0.03942871 - - -0.0105896 - - -0.01878357 - - -0.017623901 - - -0.03414917 - - 0.02142334 - - 0.026550293 - - -0.022903442 - - 0.008598328 - - 0.03100586 - - 0.049957275 - - 0.021438599 - - 0.016204834 - - -0.014129639 - - 0.0079193115 - - -0.004535675 - - 0.0010051727 - - -0.038208008 - - -0.014923096 - - -0.01436615 - - -0.009666443 - - 0.0006933212 - - 0.0132369995 - - 0.01486969 - - 0.028762817 - - 0.011329651 - - -0.042663574 - - 0.014961243 - - -0.018127441 - - -0.007232666 - - 0.008369446 - - 0.027557373 - - 0.006706238 - - -0.05038452 - - -0.023666382 - - -0.0072898865 - - -0.007865906 - - -0.008926392 - - -0.013137817 - - 0.08886719 - - 0.030929565 - - 0.021255493 - - -0.0020389557 - - -0.08337402 - - -0.020385742 - - 0.03866577 - - -0.020523071 - - 0.021881104 - - 0.005756378 - - 0.022003174 - - 0.021209717 - - -0.06161499 - - -0.020309448 - - -0.0057258606 - - -0.033813477 - - 0.0017337799 - - -0.052612305 - - 0.01461792 - - -0.017944336 - - 0.042816162 - - -0.053710938 - - -0.041259766 - - -0.014549255 - - 0.020843506 - - -0.019760132 - - 0.004890442 - - -0.0007162094 - - -0.009429932 - - -0.01966858 - - -0.014320374 - - 0.041259766 - - 0.00075244904 - - -0.0064430237 - - 0.028961182 - - -0.01876831 - - 0.0027942657 - - -0.051116943 - - 0.00093746185 - - 0.0037384033 - - -0.06982422 - - -0.0107040405 - - 0.030090332 - - -0.019104004 - - -0.016647339 - - -0.037475586 - - 0.0140686035 - - -0.051086426 - - -0.032409668 - - -0.011131287 - - -0.023620605 - - -0.04159546 - - -0.034851074 - - -0.064941406 - - -0.03451538 - - 0.0047416687 - - -0.04510498 - - 0.020477295 - - -0.03024292 - - -0.034179688 - - 0.058410645 - - 0.008514404 - - 0.0049858093 - - 0.02331543 - - 0.03704834 - - -0.017333984 - - 0.014389038 - - 0.013786316 - - 0.008583069 - - -0.009643555 - - 0.020095825 - - 0.013496399 - - -0.01991272 - - -0.0446167 - - 0.0075149536 - - 0.0071029663 - - 0.0446167 - - -0.03933716 - - 0.009902954 - - 0.011077881 - - 0.008781433 - - -0.001701355 - - 0.016235352 - - 0.01802063 - - -0.010765076 - - -0.03427124 - - 0.0112838745 - - -0.023208618 - - -0.009979248 - - -0.010696411 - - -0.023208618 - - -0.026748657 - - -0.02923584 - - 0.013801575 - - -0.050323486 - - -0.0059661865 - - -0.004837036 - - 0.01940918 - - 0.00018620491 - - 0.0016450882 - - 0.019012451 - - -0.048034668 - - 0.034423828 - - -0.033599854 - - 0.020126343 - - -0.04949951 - - 0.071899414 - - -0.06060791 - - -0.043395996 - - 0.012138367 - - 0.022476196 - - 0.029006958 - - 0.04550171 - - -0.03564453 - - -0.015090942 - - 0.055541992 - - 0.014884949 - - 0.020767212 - - -0.01071167 - - 0.046905518 - - 0.033813477 - - -0.04260254 - - -0.00094127655 - - 0.016708374 - - -0.0011367798 - - -0.030426025 - - -0.03427124 - - 0.01763916 - - -0.012634277 - - 0.030517578 - - -0.055480957 - - -0.054992676 - - 0.056274414 - - -0.0007033348 - - -0.058624268 - - 0.0061531067 - - -0.008613586 - - 0.016067505 - - 0.003376007 - - -0.01586914 - - -0.025146484 - - 0.008491516 - - 0.053222656 - - -0.02923584 - - 0.021408081 - meta: - api_version: - version: "1" - api_version: v1 - EmbedByTypeResponse: - type: object - required: - - id - - embeddings - - texts - - api_version - properties: - response_type: - type: string - x-fern-audiences: - - public - enum: - - embeddings_floats - - embeddings_by_type - id: - type: string - x-fern-audiences: - - public - embeddings: - type: object - x-fern-audiences: - - public - description: - An object with different embedding types. The length of each - embedding type array will be the same as the length of the original - `texts` array. - properties: - float: - type: array - x-fern-audiences: - - public - description: An array of float embeddings. - items: - type: array - x-fern-audiences: - - public - items: - type: number - x-fern-audiences: - - public - readOnly: true - readOnly: true - int8: - type: array - x-fern-audiences: - - public - description: - An array of signed int8 embeddings. Each value is between -128 and - 127. - items: - type: array - x-fern-audiences: - - public - items: - type: integer - x-fern-audiences: - - public - readOnly: true - readOnly: true - uint8: - type: array - x-fern-audiences: - - public - description: - An array of unsigned int8 embeddings. Each value is between 0 and - 255. - items: - type: array - x-fern-audiences: - - public - items: - type: integer - x-fern-audiences: - - public - readOnly: true - readOnly: true - binary: - type: array - x-fern-audiences: - - public - description: - An array of packed signed binary embeddings. The length of each - binary embedding is 1/8 the length of the float embeddings of - the provided model. Each value is between -128 and 127. - items: - type: array - x-fern-audiences: - - public - items: - type: integer - x-fern-audiences: - - public - readOnly: true - readOnly: true - ubinary: - type: array - x-fern-audiences: - - public - description: - An array of packed unsigned binary embeddings. The length of each - binary embedding is 1/8 the length of the float embeddings of - the provided model. Each value is between 0 and 255. - items: - type: array - x-fern-audiences: - - public - items: - type: integer - x-fern-audiences: - - public - readOnly: true - items: - type: array - x-fern-audiences: - - public - items: - type: number - x-fern-audiences: - - public - readOnly: true - readOnly: true - texts: - type: array - x-fern-audiences: - - public - description: The text entries for which embeddings were returned. - items: - type: string - x-fern-audiences: - - public - meta: - $ref: "#/components/schemas/ApiMeta" - x-fern-audiences: - - public - x-examples: - Example: - value: - id: bc57846a-3e56-4327-8acc-588ca1a37b8a - texts: - - hello world - embeddings: - float: - - - -0.039520264 - - -0.04574585 - - -0.08807373 - - -0.084106445 - - -0.009742737 - - -0.0090408325 - - -0.048187256 - - 0.07128906 - - 0.010688782 - - 0.016067505 - - -0.02822876 - - 0.036224365 - - 0.037994385 - - -0.041992188 - - 0.052124023 - - -0.027297974 - - 0.048309326 - - 0.017410278 - - 0.004283905 - - -0.0058555603 - - -0.012992859 - - 0.023040771 - - 0.00121212 - - 0.02078247 - - 0.04827881 - - -0.021530151 - - 0.017807007 - - 0.0075531006 - - -0.047912598 - - -0.042633057 - - 0.0016927719 - - 0.04547119 - - 0.0143585205 - - 0.022354126 - - 0.0017910004 - - 0.048614502 - - -0.02609253 - - 0.007850647 - - 0.00907135 - - 0.0035381317 - - 0.015289307 - - -0.008132935 - - 0.016296387 - - -0.02859497 - - -0.023712158 - - 0.008857727 - - -0.04309082 - - -0.025115967 - - 0.032928467 - - -0.029663086 - - 0.00434494 - - -0.022338867 - - -0.004371643 - - -0.0075035095 - - -0.009529114 - - 0.0038223267 - - -0.06048584 - - -0.018127441 - - 0.010131836 - - 0.08380127 - - 0.03652954 - - 0.0030384064 - - 0.006034851 - - -0.006286621 - - 0.016784668 - - -0.00308609 - - 0.01612854 - - 0.011413574 - - 0.022491455 - - 0.02482605 - - 0.0047683716 - - 0.012245178 - - -0.017593384 - - -0.023254395 - - -0.012641907 - - 0.030181885 - - -0.015365601 - - 0.031021118 - - 0.015144348 - - 0.016708374 - - 0.02180481 - - 0.010765076 - - -0.015586853 - - -0.05819702 - - 0.02128601 - - -0.021713257 - - -0.013320923 - - -0.0064849854 - - -0.001657486 - - -0.030715942 - - -0.008666992 - - 0.060668945 - - -0.0011959076 - - -0.032104492 - - -0.057006836 - - -0.015655518 - - -0.014015198 - - 0.036987305 - - 0.011016846 - - 0.037475586 - - -0.015319824 - - -0.016479492 - - 0.0030403137 - - -0.028167725 - - -0.0067825317 - - -0.00894928 - - -0.026107788 - - 0.010231018 - - 0.031707764 - - 0.050354004 - - -0.016220093 - - 0.04345703 - - -0.008888245 - - -0.0037784576 - - -0.034576416 - - 0.002565384 - - -0.0018634796 - - 0.013954163 - - 0.012062073 - - 0.046813965 - - 0.033081055 - - 0.028778076 - - 0.0051231384 - - 0.022094727 - - -0.021881104 - - -0.009788513 - - -0.04647827 - - -0.025482178 - - 0.066833496 - - -0.040863037 - - -0.019714355 - - 0.06866455 - - -0.07519531 - - -0.045532227 - - -0.020507812 - - 0.021331787 - - 0.036376953 - - -0.034210205 - - 0.017669678 - - 0.0155181885 - - 0.047698975 - - -0.010368347 - - 0.010879517 - - 0.016555786 - - -0.028076172 - - 0.03225708 - - -0.0056152344 - - -0.020690918 - - 0.00011438131 - - -0.021011353 - - -0.04425049 - - -0.029922485 - - -0.0014362335 - - 0.013618469 - - 0.011260986 - - 0.017532349 - - -0.043426514 - - 0.012557983 - - 0.026748657 - - 0.039154053 - - -0.030944824 - - 0.024169922 - - 0.06573486 - - -0.03817749 - - -0.025314331 - - -0.039794922 - - -0.050445557 - - -0.0020828247 - - -0.0010194778 - - 0.01725769 - - 0.0017976761 - - 0.029067993 - - 0.0115356445 - - 0.005214691 - - 0.0066604614 - - -0.014801025 - - -0.033172607 - - 0.023956299 - - 0.008865356 - - 0.09539795 - - 0.062286377 - - -0.0076408386 - - -0.035125732 - - 0.09082031 - - -0.015350342 - - -0.015625 - - -0.0090789795 - - -0.01876831 - - 0.05239868 - - -0.010406494 - - 0.05078125 - - -0.013694763 - - -0.07244873 - - 0.018539429 - - -0.016983032 - - -0.03353882 - - 0.01739502 - - 0.004055023 - - -0.010147095 - - -0.0027599335 - - -0.002714157 - - -0.0107040405 - - 0.021438599 - - -0.029525757 - - 0.01902771 - - -0.025909424 - - 0.0008072853 - - 0.026672363 - - 0.0019044876 - - 0.016937256 - - -0.018814087 - - -0.03668213 - - 0.03338623 - - -0.09240723 - - -0.024765015 - - -0.019378662 - - -0.051757812 - - 0.050109863 - - 0.018859863 - - 0.01687622 - - 0.020111084 - - -0.041534424 - - 0.009559631 - - -0.018859863 - - 0.00005853176 - - 0.032684326 - - -0.04058838 - - 0.015823364 - - -0.038635254 - - 0.0055656433 - - -0.021560669 - - 0.012481689 - - -0.050872803 - - -0.036071777 - - -0.046844482 - - -0.041900635 - - -0.06561279 - - 0.014785767 - - 0.010124207 - - 0.030426025 - - 0.024261475 - - 0.0057411194 - - -0.026275635 - - -0.006919861 - - 0.022750854 - - -0.015167236 - - 0.022964478 - - -0.0033664703 - - 0.02734375 - - 0.03201294 - - 0.025939941 - - 0.019104004 - - 0.028030396 - - -0.014328003 - - -0.01574707 - - 0.06982422 - - -0.008026123 - - 0.006816864 - - -0.0019035339 - - 0.026245117 - - -0.028945923 - - 0.014968872 - - 0.0054244995 - - -0.00028896332 - - -0.02243042 - - -0.0030822754 - - -0.02558899 - - -0.022918701 - - -0.017089844 - - -0.0035190582 - - 0.029953003 - - -0.037078857 - - -0.02507019 - - -0.017303467 - - 0.064331055 - - -0.028533936 - - -0.07287598 - - 0.028839111 - - -0.0029792786 - - -0.02104187 - - -0.01663208 - - -0.016571045 - - -0.015106201 - - 0.0027313232 - - 0.031051636 - - -0.025680542 - - 0.004722595 - - 0.032348633 - - 0.020019531 - - 0.056365967 - - 0.07208252 - - 0.01235199 - - 0.00084495544 - - 0.035369873 - - -0.018569946 - - -0.0063552856 - - 0.03161621 - - 0.064575195 - - -0.02557373 - - -0.007232666 - - -0.017700195 - - -0.003835678 - - 0.007381439 - - -0.0385437 - - -0.0019102097 - - -0.023223877 - - -0.0124435425 - - 0.013343811 - - 0.020996094 - - -0.014022827 - - -0.01939392 - - 0.044128418 - - 0.0052757263 - - -0.00068950653 - - -0.04876709 - - -0.05609131 - - -0.020874023 - - -0.00806427 - - -0.13391113 - - -0.06323242 - - -0.021865845 - - -0.021072388 - - 0.005832672 - - -0.015701294 - - -0.006286621 - - -0.012954712 - - -0.017288208 - - 0.0036773682 - - -0.0084991455 - - -0.03213501 - - 0.021987915 - - -0.010322571 - - -0.029144287 - - 0.003824234 - - 0.02708435 - - 0.0026187897 - - 0.05496216 - - -0.04916382 - - 0.005466461 - - -0.0070648193 - - 0.0793457 - - -0.040863037 - - 0.012641907 - - 0.016448975 - - 0.02041626 - - -0.029006958 - - -0.008491516 - - 0.0023422241 - - 0.043640137 - - 0.0121536255 - - -0.0043525696 - - -0.030899048 - - 0.0062332153 - - -0.013038635 - - 0.007904053 - - -0.03390503 - - -0.034729004 - - -0.0647583 - - -0.0052375793 - - -0.08154297 - - 0.015960693 - - 0.016235352 - - -0.012130737 - - -0.021469116 - - -0.03253174 - - -0.014465332 - - 0.016448975 - - 0.004589081 - - -0.05291748 - - 0.018005371 - - -0.002981186 - - -0.01247406 - - 0.023147583 - - -0.055419922 - - -0.08526611 - - 0.016723633 - - 0.012939453 - - -0.039031982 - - 0.016677856 - - 0.016937256 - - 0.023147583 - - 0.034576416 - - -0.010635376 - - 0.03466797 - - 0.037750244 - - 0.020141602 - - -0.0046539307 - - 0.0059432983 - - 0.05609131 - - 0.027709961 - - 0.01838684 - - 0.015022278 - - -0.039215088 - - -0.0048828125 - - 0.047546387 - - 0.0138549805 - - -0.046203613 - - 0.036193848 - - -0.109680176 - - 0.0019550323 - - -0.03125 - - 0.0084991455 - - -0.0020256042 - - -0.001739502 - - -0.06756592 - - 0.03491211 - - -0.05633545 - - -0.008491516 - - 0.0048446655 - - 0.042663574 - - 0.025054932 - - -0.022247314 - - -0.0044555664 - - 0.0022335052 - - -0.0071907043 - - -0.003982544 - - -0.073913574 - - -0.011253357 - - 0.029220581 - - -0.0047073364 - - -0.04626465 - - 0.05670166 - - -0.041503906 - - 0.014579773 - - -0.016174316 - - 0.021560669 - - -0.019332886 - - 0.01550293 - - 0.02709961 - - 0.010528564 - - 0.012786865 - - -0.023849487 - - -0.016937256 - - -0.04626465 - - -0.04397583 - - 0.026245117 - - -0.017868042 - - 0.021072388 - - -0.02128601 - - -0.012161255 - - -0.004776001 - - -0.0088272095 - - 0.009246826 - - -0.012313843 - - 0.0096206665 - - -0.0047950745 - - -0.0079956055 - - 0.052520752 - - -0.06616211 - - 0.0014686584 - - -0.046081543 - - 0.03289795 - - -0.03656006 - - 0.055389404 - - 0.009773254 - - 0.0013818741 - - 0.043823242 - - 0.034942627 - - 0.055236816 - - -0.011833191 - - -0.024353027 - - 0.011398315 - - -0.051574707 - - -0.019882202 - - 0.0018358231 - - -0.005859375 - - 0.06677246 - - -0.0009851456 - - -0.026809692 - - 0.0075798035 - - -0.021347046 - - -0.01146698 - - 0.03262329 - - 0.031585693 - - -0.006729126 - - 0.008659363 - - -0.025665283 - - 0.02947998 - - -0.03744507 - - 0.02027893 - - -0.026062012 - - 0.018585205 - - -0.004463196 - - -0.036865234 - - -0.043670654 - - 0.021392822 - - -0.062561035 - - -0.080078125 - - 0.011451721 - - 0.06762695 - - 0.039001465 - - -0.016799927 - - 0.049072266 - - 0.041412354 - - -0.03062439 - - 0.011795044 - - -0.016555786 - - 0.046569824 - - 0.010688782 - - -0.01902771 - - -0.031097412 - - -0.023391724 - - -0.01651001 - - 0.009399414 - - 0.049041748 - - -0.025817871 - - -0.018356323 - - 0.02154541 - - -0.0029411316 - - 0.074157715 - - 0.017059326 - - -0.0017595291 - - 0.00390625 - - 0.02645874 - - -0.0010709763 - - 0.040222168 - - -0.034423828 - - 0.0231781 - - -0.016693115 - - -0.022094727 - - 0.004383087 - - 0.007331848 - - 0.018676758 - - 0.023773193 - - -0.0069770813 - - 0.0029773712 - - -0.023712158 - - -0.0051956177 - - -0.011810303 - - -0.0519104 - - 0.07244873 - - 0.032409668 - - 0.016662598 - - 0.015716553 - - -0.03640747 - - 0.03918457 - - -0.046722412 - - -0.0046081543 - - 0.006061554 - - -0.011940002 - - -0.0004878044 - - 0.01260376 - - 0.0073280334 - - 0.0015096664 - - 0.005844116 - - 0.029129028 - - 0.047668457 - - 0.05960083 - - -0.0647583 - - 0.064697266 - - -0.017440796 - - -0.01889038 - - 0.037628174 - - 0.0048065186 - - -0.023101807 - - -0.048675537 - - -0.02508545 - - -0.007965088 - - 0.0015897751 - - 0.06866455 - - -0.0099487305 - - -0.0022964478 - - -0.030014038 - - -0.007713318 - - -0.034362793 - - 0.013931274 - - 0.0026836395 - - -0.0014476776 - - 0.02532959 - - -0.020584106 - - -0.039001465 - - -0.062347412 - - -0.04736328 - - -0.024368286 - - -0.045776367 - - 0.03149414 - - -0.012825012 - - 0.028076172 - - 0.0058784485 - - 0.08062744 - - 0.0104599 - - 0.014579773 - - -0.041137695 - - 0.04244995 - - -0.021011353 - - 0.06390381 - - 0.0010871887 - - 0.04147339 - - -0.0053138733 - - 0.02268982 - - -0.028182983 - - -0.022628784 - - -0.021408081 - - -0.006088257 - - 0.028030396 - - 0.025146484 - - 0.00881958 - - -0.04244995 - - 0.027938843 - - 0.013916016 - - -0.04647827 - - 0.0072288513 - - 0.017745972 - - -0.02381897 - - -0.010147095 - - 0.0096588135 - - -0.04586792 - - -0.014480591 - - -0.0027217865 - - -0.03111267 - - 0.04522705 - - -0.02772522 - - -0.0013189316 - - 0.017807007 - - -0.0135269165 - - -0.014175415 - - -0.00019681454 - - 0.03161621 - - 0.0041007996 - - -0.024871826 - - 0.0039367676 - - -0.026916504 - - 0.03237915 - - 0.007068634 - - 0.029647827 - - -0.0102005005 - - 0.0076675415 - - 0.0051078796 - - -0.008041382 - - -0.0062942505 - - 0.0010309219 - - 0.010543823 - - -0.010101318 - - -0.013496399 - - 0.00920105 - - 0.0546875 - - -0.02784729 - - -0.0056762695 - - -0.08679199 - - -0.050048828 - - 0.03378296 - - 0.010124207 - - 0.019058228 - - -0.037872314 - - -0.0063323975 - - 0.0014324188 - - -0.010002136 - - -0.015731812 - - -0.036071777 - - -0.0028915405 - - -0.0082092285 - - 0.0037841797 - - -0.020629883 - - 0.01725769 - - -0.026000977 - - 0.00012862682 - - 0.021621704 - - 0.07086182 - - -0.008049011 - - -0.012634277 - - -0.064941406 - - -0.0073013306 - - -0.02760315 - - -0.040649414 - - 0.02809143 - - 0.009849548 - - 0.0011720657 - - 0.059936523 - - -0.032806396 - - 0.06311035 - - 0.009536743 - - 0.014801025 - - 0.03390503 - - -0.002620697 - - -0.04650879 - - -0.015365601 - - 0.03741455 - - -0.0067443848 - - -0.008888245 - - -0.0013017654 - - -0.010154724 - - 0.0027217865 - - 0.016052246 - - 0.025100708 - - -0.030532837 - - 0.032318115 - - 0.014564514 - - -0.009109497 - - 0.009628296 - - -0.021438599 - - -0.049926758 - - -0.00088214874 - - -0.019638062 - - -0.020126343 - - 0.055847168 - - -0.006729126 - - -0.044921875 - - -0.01890564 - - -0.0026683807 - - 0.0038547516 - - 0.004600525 - - -0.013977051 - - 0.018341064 - - -0.05178833 - - 0.011054993 - - 0.019927979 - - 0.011436462 - - 0.010391235 - - -0.012680054 - - -0.017669678 - - 0.01928711 - - 0.025115967 - - -0.07757568 - - -0.030960083 - - 0.013137817 - - -0.066467285 - - -0.054473877 - - -0.04244995 - - -0.027526855 - - 0.02973938 - - -0.024017334 - - -0.03918457 - - 0.0154800415 - - -0.036315918 - - 0.015510559 - - -0.020385742 - - -0.0390625 - - -0.00137043 - - 0.0016002655 - - -0.010238647 - - 0.014656067 - - 0.029373169 - - -0.027023315 - - 0.0076141357 - - -0.001917839 - - 0.03451538 - - 0.004814148 - - 0.024887085 - - 0.036315918 - - -0.006500244 - - -0.070495605 - - -0.0071754456 - - 0.025863647 - - 0.022994995 - - 0.007217407 - - 0.032165527 - - 0.016830444 - - 0.02859497 - - -0.011123657 - - 0.020126343 - - -0.0014410019 - - 0.0021781921 - - 0.053619385 - - 0.015625 - - 0.017150879 - - -0.03326416 - - -0.04626465 - - 0.034332275 - - 0.07165527 - - -0.040740967 - - -0.06628418 - - -0.024291992 - - -0.0066871643 - - 0.065979004 - - 0.034851074 - - 0.07678223 - - 0.053009033 - - 0.0317688 - - -0.04019165 - - 0.030288696 - - 0.062347412 - - -0.011734009 - - 0.0024604797 - - 0.006095886 - - -0.0152282715 - - 0.056762695 - - 0.021270752 - - -0.011154175 - - -0.0143966675 - - 0.0057754517 - - -0.0003619194 - - 0.0053367615 - - -0.030639648 - - 0.0024776459 - - -0.031799316 - - -0.012710571 - - 0.048828125 - - 0.029632568 - - 0.013244629 - - 0.087890625 - - -0.01134491 - - 0.028656006 - - -0.014778137 - - 0.06695557 - - 0.026275635 - - -0.016113281 - - 0.018859863 - - -0.008239746 - - 0.024383545 - - -0.039154053 - - -0.006252289 - - 0.049224854 - - -0.04638672 - - 0.0031967163 - - -0.04849243 - - -0.04058838 - - 0.038757324 - - 0.00730896 - - -0.04345703 - - 0.04296875 - - -0.0024299622 - - -0.05670166 - - 0.019119263 - - -0.011802673 - - 0.038970947 - - -0.03366089 - - 0.03591919 - - -0.0009088516 - - 0.013259888 - - -0.07342529 - - 0.004299164 - - 0.0395813 - - 0.013420105 - - -0.004459381 - - -0.0084991455 - - 0.031982422 - - 0.018249512 - - -0.0038604736 - - -0.022323608 - - -0.013031006 - - 0.0513916 - - -0.007068634 - - -0.003545761 - - 0.010292053 - - -0.010322571 - - -0.0037841797 - - 0.043701172 - - -0.012672424 - - 0.013725281 - - 0.021575928 - - -0.03942871 - - -0.0105896 - - -0.01878357 - - -0.017623901 - - -0.03414917 - - 0.02142334 - - 0.026550293 - - -0.022903442 - - 0.008598328 - - 0.03100586 - - 0.049957275 - - 0.021438599 - - 0.016204834 - - -0.014129639 - - 0.0079193115 - - -0.004535675 - - 0.0010051727 - - -0.038208008 - - -0.014923096 - - -0.01436615 - - -0.009666443 - - 0.0006933212 - - 0.0132369995 - - 0.01486969 - - 0.028762817 - - 0.011329651 - - -0.042663574 - - 0.014961243 - - -0.018127441 - - -0.007232666 - - 0.008369446 - - 0.027557373 - - 0.006706238 - - -0.05038452 - - -0.023666382 - - -0.0072898865 - - -0.007865906 - - -0.008926392 - - -0.013137817 - - 0.08886719 - - 0.030929565 - - 0.021255493 - - -0.0020389557 - - -0.08337402 - - -0.020385742 - - 0.03866577 - - -0.020523071 - - 0.021881104 - - 0.005756378 - - 0.022003174 - - 0.021209717 - - -0.06161499 - - -0.020309448 - - -0.0057258606 - - -0.033813477 - - 0.0017337799 - - -0.052612305 - - 0.01461792 - - -0.017944336 - - 0.042816162 - - -0.053710938 - - -0.041259766 - - -0.014549255 - - 0.020843506 - - -0.019760132 - - 0.004890442 - - -0.0007162094 - - -0.009429932 - - -0.01966858 - - -0.014320374 - - 0.041259766 - - 0.00075244904 - - -0.0064430237 - - 0.028961182 - - -0.01876831 - - 0.0027942657 - - -0.051116943 - - 0.00093746185 - - 0.0037384033 - - -0.06982422 - - -0.0107040405 - - 0.030090332 - - -0.019104004 - - -0.016647339 - - -0.037475586 - - 0.0140686035 - - -0.051086426 - - -0.032409668 - - -0.011131287 - - -0.023620605 - - -0.04159546 - - -0.034851074 - - -0.064941406 - - -0.03451538 - - 0.0047416687 - - -0.04510498 - - 0.020477295 - - -0.03024292 - - -0.034179688 - - 0.058410645 - - 0.008514404 - - 0.0049858093 - - 0.02331543 - - 0.03704834 - - -0.017333984 - - 0.014389038 - - 0.013786316 - - 0.008583069 - - -0.009643555 - - 0.020095825 - - 0.013496399 - - -0.01991272 - - -0.0446167 - - 0.0075149536 - - 0.0071029663 - - 0.0446167 - - -0.03933716 - - 0.009902954 - - 0.011077881 - - 0.008781433 - - -0.001701355 - - 0.016235352 - - 0.01802063 - - -0.010765076 - - -0.03427124 - - 0.0112838745 - - -0.023208618 - - -0.009979248 - - -0.010696411 - - -0.023208618 - - -0.026748657 - - -0.02923584 - - 0.013801575 - - -0.050323486 - - -0.0059661865 - - -0.004837036 - - 0.01940918 - - 0.00018620491 - - 0.0016450882 - - 0.019012451 - - -0.048034668 - - 0.034423828 - - -0.033599854 - - 0.020126343 - - -0.04949951 - - 0.071899414 - - -0.06060791 - - -0.043395996 - - 0.012138367 - - 0.022476196 - - 0.029006958 - - 0.04550171 - - -0.03564453 - - -0.015090942 - - 0.055541992 - - 0.014884949 - - 0.020767212 - - -0.01071167 - - 0.046905518 - - 0.033813477 - - -0.04260254 - - -0.00094127655 - - 0.016708374 - - -0.0011367798 - - -0.030426025 - - -0.03427124 - - 0.01763916 - - -0.012634277 - - 0.030517578 - - -0.055480957 - - -0.054992676 - - 0.056274414 - - -0.0007033348 - - -0.058624268 - - 0.0061531067 - - -0.008613586 - - 0.016067505 - - 0.003376007 - - -0.01586914 - - -0.025146484 - - 0.008491516 - - 0.053222656 - - -0.02923584 - - 0.021408081 - ubinary: - - - 1 - - 218 - - 231 - - 179 - - 247 - - 164 - - 161 - - 62 - - 191 - - 23 - - 200 - - 16 - - 114 - - 29 - - 23 - - 240 - - 145 - - 187 - - 72 - - 119 - - 96 - - 126 - - 121 - - 10 - - 76 - - 43 - - 200 - - 122 - - 213 - - 7 - - 202 - - 249 - - 86 - - 2 - - 36 - - 27 - - 252 - - 194 - - 25 - - 128 - - 33 - - 39 - - 171 - - 156 - - 160 - - 195 - - 73 - - 189 - - 223 - - 53 - - 68 - - 228 - - 37 - - 94 - - 20 - - 41 - - 87 - - 228 - - 164 - - 213 - - 68 - - 237 - - 97 - - 150 - - 212 - - 244 - - 61 - - 39 - - 244 - - 195 - - 6 - - 129 - - 125 - - 116 - - 59 - - 100 - - 36 - - 107 - - 179 - - 48 - - 228 - - 21 - - 192 - - 247 - - 136 - - 118 - - 130 - - 26 - - 243 - - 33 - - 40 - - 181 - - 227 - - 245 - - 230 - - 31 - - 109 - - 149 - - 61 - - 106 - - 83 - - 74 - - 174 - - 98 - - 75 - - 6 - - 250 - - 135 - - 211 - - 129 - - 197 - - 225 - - 81 - - 67 - - 86 - - 68 - - 2 - - 159 - - 118 - - 119 - - 100 - - 8 - - 245 - - 79 - - 59 - - 34 - - 146 - - 205 - meta: - api_version: - version: "1" - api_version: v2 - EmbedJob: - type: object - required: - - job_id - - status - - created_at - - input_dataset_id - - model - - truncate - properties: - job_id: - type: string - x-fern-audiences: - - public - description: ID of the embed job - name: - type: string - x-fern-audiences: - - public - description: The name of the embed job - status: - type: string - x-fern-audiences: - - public - description: The status of the embed job - enum: - - processing - - complete - - cancelling - - cancelled - - failed - created_at: - type: string - x-fern-audiences: - - public - description: The creation date of the embed job - format: date-time - input_dataset_id: - type: string - x-fern-audiences: - - public - description: ID of the input dataset - output_dataset_id: - type: string - x-fern-audiences: - - public - description: ID of the resulting output dataset - model: - type: string - x-fern-audiences: - - public - description: ID of the model used to embed - truncate: - type: string - x-fern-audiences: - - public - description: The truncation option used - enum: - - START - - END - meta: - $ref: "#/components/schemas/ApiMeta" - x-fern-audiences: - - public - ListEmbedJobResponse: - type: object - properties: - embed_jobs: - type: array - items: - $ref: "#/components/schemas/EmbedJob" - x-fern-audiences: - - public - CreateEmbedJobRequest: - type: object - required: - - model - - dataset_id - - input_type - properties: - model: - type: string - x-fern-audiences: - - public - format: string - description: | - ID of the embedding model. - - Available models and corresponding embedding dimensions: - - - `embed-english-v3.0` : 1024 - - `embed-multilingual-v3.0` : 1024 - - `embed-english-light-v3.0` : 384 - - `embed-multilingual-light-v3.0` : 384 - dataset_id: - type: string - x-fern-audiences: - - public - description: - ID of a [Dataset](https://docs.cohere.com/docs/datasets). The - Dataset must be of type `embed-input` and must have a validation - status `Validated` - input_type: - x-fern-audiences: - - public - $ref: "#/components/schemas/EmbedInputType" - name: - type: string - x-fern-audiences: - - public - description: The name of the embed job. - embedding_types: - type: array - x-fern-audiences: - - public - items: - $ref: "#/components/schemas/EmbeddingType" - description: |- - Specifies the types of embeddings you want to get back. Not required and default is None, which returns the Embed Floats response type. Can be one or more of the following types. - - * `"float"`: Use this when you want to get back the default float embeddings. Valid for all models. - * `"int8"`: Use this when you want to get back signed int8 embeddings. Valid for only v3 models. - * `"uint8"`: Use this when you want to get back unsigned int8 embeddings. Valid for only v3 models. - * `"binary"`: Use this when you want to get back signed binary embeddings. Valid for only v3 models. - * `"ubinary"`: Use this when you want to get back unsigned binary embeddings. Valid for only v3 models. - truncate: - type: string - x-fern-audiences: - - public - description: | - One of `START|END` to specify how the API will handle inputs longer than the maximum token length. - - Passing `START` will discard the start of the input. `END` will discard the end of the input. In both cases, input is discarded until the remaining input is exactly the maximum input token length for the model. - default: END - enum: - - START - - END - CreateEmbedJobResponse: - type: object - required: - - job_id - description: Response from creating an embed job. - properties: - job_id: - type: string - x-fern-audiences: - - public - meta: - $ref: "#/components/schemas/ApiMeta" - x-fern-audiences: - - public - RerankDocument: - type: object - x-fern-type: map - properties: - text: - type: string - x-fern-audiences: - - public - description: The text of the document to rerank. - required: - - text - ClassifyExample: - type: object - properties: - text: - type: string - x-fern-audiences: - - public - writeOnly: true - label: - type: string - x-fern-audiences: - - public - writeOnly: true - writeOnly: true - DatasetValidationStatus: - x-fern-audiences: - - public - description: The validation status of the dataset - type: string - enum: - - unknown - - queued - - processing - - failed - - validated - - skipped - DatasetType: - x-fern-audiences: - - public - description: The type of the dataset - type: string - enum: - - embed-input - - embed-result - - cluster-result - - cluster-outliers - - reranker-finetune-input - - single-label-classification-finetune-input - - chat-finetune-input - - multi-label-classification-finetune-input - DatasetPart: - type: object - required: - - id - - name - properties: - id: - type: string - x-fern-audiences: - - public - description: The dataset part ID - name: - type: string - x-fern-audiences: - - public - description: The name of the dataset part - url: - type: string - x-fern-audiences: - - public - description: The download url of the file - index: - type: integer - x-fern-audiences: - - public - format: int32 - description: The index of the file - size_bytes: - type: integer - x-fern-audiences: - - public - format: int32 - description: The size of the file in bytes - num_rows: - type: integer - x-fern-audiences: - - public - format: int32 - description: The number of rows in the file - original_url: - type: string - x-fern-audiences: - - public - description: The download url of the original file - samples: - type: array - x-fern-audiences: - - public - items: - type: string - x-fern-audiences: - - public - description: The first few rows of the parsed file - ParseInfo: - type: object - properties: - separator: - type: string - x-fern-audiences: - - public - writeOnly: true - delimiter: - type: string - x-fern-audiences: - - public - writeOnly: true - writeOnly: true - RerankerDataMetrics: - type: object - properties: - num_train_queries: - type: number - # format: int64 - format: long - description: The number of training queries. - x-fern-audiences: - - public - num_train_relevant_passages: - type: number - # format: int64 - format: long - description: The sum of all relevant passages of valid training examples. - x-fern-audiences: - - public - num_train_hard_negatives: - type: number - # format: int64 - format: long - description: The sum of all hard negatives of valid training examples. - x-fern-audiences: - - public - num_eval_queries: - type: number - # format: int64 - format: long - description: The number of evaluation queries. - x-fern-audiences: - - public - num_eval_relevant_passages: - type: number - # format: int64 - format: long - description: The sum of all relevant passages of valid eval examples. - x-fern-audiences: - - public - num_eval_hard_negatives: - type: number - # format: int64 - format: long - description: The sum of all hard negatives of valid eval examples. - x-fern-audiences: - - public - ChatDataMetrics: - type: object - properties: - num_train_turns: - type: number - # format: int64 - format: long - description: The sum of all turns of valid train examples. - x-fern-audiences: - - public - num_eval_turns: - type: number - # format: int64 - format: long - description: The sum of all turns of valid eval examples. - x-fern-audiences: - - public - preamble: - type: string - description: The preamble of this dataset. - x-fern-audiences: - - public - LabelMetric: - type: object - properties: - total_examples: - type: number - # format: int64 - format: long - description: Total number of examples for this label - x-fern-audiences: - - public - label: - type: string - description: value of the label - x-fern-audiences: - - public - samples: - type: array - items: - type: string - description: samples for this label - x-fern-audiences: - - public - ClassifyDataMetrics: - type: object - properties: - label_metrics: - type: array - items: - $ref: "#/components/schemas/LabelMetric" - FinetuneDatasetMetrics: - type: object - properties: - trainable_token_count: - type: number - # format: int64 - format: long - description: The number of tokens of valid examples that can be used for training. - x-fern-audiences: - - public - total_examples: - type: number - # format: int64 - format: long - description: The overall number of examples. - x-fern-audiences: - - public - train_examples: - type: number - # format: int64 - format: long - description: The number of training examples. - x-fern-audiences: - - public - train_size_bytes: - type: number - # format: int64 - format: long - description: The size in bytes of all training examples. - x-fern-audiences: - - public - eval_examples: - type: number - # format: int64 - format: long - description: Number of evaluation examples. - x-fern-audiences: - - public - eval_size_bytes: - type: number - # format: int64 - format: long - description: The size in bytes of all eval examples. - x-fern-audiences: - - public - reranker_data_metrics: - $ref: "#/components/schemas/RerankerDataMetrics" - chat_data_metrics: - $ref: "#/components/schemas/ChatDataMetrics" - classify_data_metrics: - $ref: "#/components/schemas/ClassifyDataMetrics" - Metrics: - type: object - properties: - finetune_dataset_metrics: - $ref: "#/components/schemas/FinetuneDatasetMetrics" - embed_data: - x-internal: true - type: object - properties: - fields: - description: the fields in the dataset - x-internal: true - type: array - items: - x-internal: true - type: object - properties: - name: - description: the name of the field - x-internal: true - type: string - count: - description: the number of times the field appears in the dataset - x-internal: true - type: number - Dataset: - type: object - required: - - id - - name - - created_at - - updated_at - - dataset_type - - validation_status - properties: - id: - type: string - x-fern-audiences: - - public - description: The dataset ID - name: - type: string - x-fern-audiences: - - public - description: The name of the dataset - created_at: - type: string - x-fern-audiences: - - public - format: date-time - description: The creation date - updated_at: - type: string - x-fern-audiences: - - public - format: date-time - description: The last update date - dataset_type: - x-fern-audiences: - - public - $ref: "#/components/schemas/DatasetType" - validation_status: - x-fern-audiences: - - public - $ref: "#/components/schemas/DatasetValidationStatus" - validation_error: - type: string - x-fern-audiences: - - public - description: Errors found during validation - schema: - type: string - x-fern-audiences: - - public - description: the avro schema of the dataset - required_fields: - type: array - x-fern-audiences: - - public - items: - type: string - x-fern-audiences: - - public - preserve_fields: - type: array - x-fern-audiences: - - public - items: - type: string - x-fern-audiences: - - public - dataset_parts: - type: array - x-fern-audiences: - - public - items: - $ref: "#/components/schemas/DatasetPart" - description: the underlying files that make up the dataset - validation_warnings: - type: array - x-fern-audiences: - - public - items: - type: string - x-fern-audiences: - - public - description: warnings found during validation - parse_info: - $ref: "#/components/schemas/ParseInfo" - metrics: - $ref: "#/components/schemas/Metrics" - ConnectorOAuth: - type: object - required: - - authorize_url - - token_url - properties: - client_id: - type: string - x-fern-audiences: - - public - description: The OAuth 2.0 client ID. This field is encrypted at rest. - client_secret: - type: string - x-fern-audiences: - - public - description: - The OAuth 2.0 client Secret. This field is encrypted at rest and - never returned in a response. - authorize_url: - type: string - x-fern-audiences: - - public - description: - The OAuth 2.0 /authorize endpoint to use when users authorize the - connector. - token_url: - type: string - x-fern-audiences: - - public - description: - The OAuth 2.0 /token endpoint to use when users authorize the - connector. - scope: - type: string - x-fern-audiences: - - public - description: The OAuth scopes to request when users authorize the connector. - Connector: - description: |- - A connector allows you to integrate data sources with the '/chat' endpoint to create grounded generations with citations to the data source. - documents to help answer users. - type: object - required: - - id - - name - - created_at - - updated_at - properties: - id: - type: string - x-fern-audiences: - - public - description: |- - The unique identifier of the connector (used in both `/connectors` & `/chat` endpoints). - This is automatically created from the name of the connector upon registration. - organization_id: - type: string - x-fern-audiences: - - public - description: |- - The organization to which this connector belongs. This is automatically set to - the organization of the user who created the connector. - name: - type: string - x-fern-audiences: - - public - description: A human-readable name for the connector. - description: - type: string - x-fern-audiences: - - public - description: A description of the connector. - url: - type: string - x-fern-audiences: - - public - description: The URL of the connector that will be used to search for documents. - created_at: - type: string - x-fern-audiences: - - public - format: date-time - description: The UTC time at which the connector was created. - updated_at: - type: string - x-fern-audiences: - - public - format: date-time - description: The UTC time at which the connector was last updated. - excludes: - description: - A list of fields to exclude from the prompt (fields remain in the - document). - type: array - x-fern-audiences: - - public - items: - type: string - x-fern-audiences: - - public - auth_type: - description: - "The type of authentication/authorization used by the connector." - type: string - x-fern-audiences: - - public - enum: - - oauth - - service_auth - oauth: - $ref: "#/components/schemas/ConnectorOAuth" - x-fern-audiences: - - public - description: The OAuth 2.0 configuration for the connector. - auth_status: - type: string - x-fern-audiences: - - public - enum: - - valid - - expired - description: | - The OAuth status for the user making the request. One of ["valid", - "expired", ""]. Empty string (field is omitted) means the user has - not authorized the connector yet. - active: - type: boolean - x-fern-audiences: - - public - description: Whether the connector is active or not. - continue_on_failure: - type: boolean - x-fern-audiences: - - public - description: - Whether a chat request should continue or not if the request to - this connector fails. - ListConnectorsResponse: - type: object - required: - - connectors - properties: - connectors: - type: array - x-fern-audiences: - - public - items: - $ref: "#/components/schemas/Connector" - total_count: - type: number - x-fern-audiences: - - public - description: Total number of connectors. - readOnly: true - CreateConnectorOAuth: - required: - - clientId - - clientSecret - - authorizeUrl - - tokenUrl - type: object - properties: - client_id: - type: string - x-fern-audiences: - - public - description: The OAuth 2.0 client ID. This fields is encrypted at rest. - client_secret: - type: string - x-fern-audiences: - - public - description: - The OAuth 2.0 client Secret. This field is encrypted at rest and - never returned in a response. - authorize_url: - type: string - x-fern-audiences: - - public - description: - The OAuth 2.0 /authorize endpoint to use when users authorize the - connector. - token_url: - type: string - x-fern-audiences: - - public - description: - The OAuth 2.0 /token endpoint to use when users authorize the - connector. - scope: - type: string - x-fern-audiences: - - public - description: The OAuth scopes to request when users authorize the connector. - AuthTokenType: - type: string - description: The token_type specifies the way the token is passed in the - Authorization header. Valid values are "bearer", "basic", and - "noscheme". - enum: - - bearer - - basic - - noscheme - default: noscheme - CreateConnectorServiceAuth: - required: - - type - - token - type: object - properties: - type: - x-fern-audiences: - - public - $ref: "#/components/schemas/AuthTokenType" - token: - type: string - x-fern-audiences: - - public - description: - The token that will be used in the HTTP Authorization header when - making requests to the connector. This field is encrypted at rest - and never returned in a response. - CreateConnectorRequest: - type: object - required: - - name - - url - properties: - name: - type: string - x-fern-audiences: - - public - description: A human-readable name for the connector. - description: - type: string - x-fern-audiences: - - public - description: A description of the connector. - url: - type: string - x-fern-audiences: - - public - description: The URL of the connector that will be used to search for documents. - excludes: - description: - A list of fields to exclude from the prompt (fields remain in the - document). - type: array - x-fern-audiences: - - public - items: - type: string - x-fern-audiences: - - public - oauth: - $ref: "#/components/schemas/CreateConnectorOAuth" - x-fern-audiences: - - public - description: - The OAuth 2.0 configuration for the connector. Cannot be specified - if service_auth is specified. - active: - type: boolean - x-fern-audiences: - - public - default: true - description: Whether the connector is active or not. - continue_on_failure: - type: boolean - x-fern-audiences: - - public - default: false - description: - Whether a chat request should continue or not if the request to - this connector fails. - service_auth: - x-fern-audiences: - - public - $ref: "#/components/schemas/CreateConnectorServiceAuth" - description: - The service to service authentication configuration for the - connector. Cannot be specified if oauth is specified. - CreateConnectorResponse: - type: object - required: - - connector - properties: - connector: - $ref: "#/components/schemas/Connector" - GetConnectorResponse: - type: object - required: - - connector - properties: - connector: - $ref: "#/components/schemas/Connector" - DeleteConnectorResponse: - type: object - UpdateConnectorRequest: - type: object - properties: - name: - type: string - x-fern-audiences: - - public - description: A human-readable name for the connector. - url: - type: string - x-fern-audiences: - - public - description: The URL of the connector that will be used to search for documents. - excludes: - description: - A list of fields to exclude from the prompt (fields remain in the - document). - type: array - x-fern-audiences: - - public - items: - type: string - x-fern-audiences: - - public - oauth: - $ref: "#/components/schemas/CreateConnectorOAuth" - x-fern-audiences: - - public - description: - The OAuth 2.0 configuration for the connector. Cannot be specified - if service_auth is specified. - active: - type: boolean - x-fern-audiences: - - public - default: true - continue_on_failure: - type: boolean - x-fern-audiences: - - public - default: false - service_auth: - x-fern-audiences: - - public - $ref: "#/components/schemas/CreateConnectorServiceAuth" - description: - The service to service authentication configuration for the - connector. Cannot be specified if oauth is specified. - UpdateConnectorResponse: - type: object - required: - - connector - properties: - connector: - $ref: "#/components/schemas/Connector" - OAuthAuthorizeResponse: - type: object - properties: - redirect_url: - type: string - x-fern-audiences: - - public - description: - The OAuth 2.0 redirect url. Redirect the user to this url to - authorize the connector. - ConnectorLog: - type: object - required: - - id - - connector_id - - request_id - - user_id - - organization_id - - created_at - - status_code - - duration_millis - properties: - id: - type: string - description: Unique identifier for the connector log - connector_id: - type: string - description: Unique identifier for the connector - request_id: - type: string - description: Unique identifier for the request - user_id: - type: string - description: Unique identifier for the user - organization_id: - type: string - description: Unique identifier for the organization - created_at: - type: string - description: Time of connector log creation in RFC3339 format - format: date-time - example: 2023-04-28T21:00:56.646257Z - status_code: - type: integer - description: HTTP status code of the request - duration_millis: - type: integer - description: Duration of the request in milliseconds - error_message: - type: string - description: Error message of the request - GetConnectorsLogsResponse: - type: object - required: - - connector_logs - - total - properties: - connector_logs: - type: array - items: - $ref: "#/components/schemas/ConnectorLog" - total: - type: number - description: Total number of connector logs - readOnly: true - TokenLikelihood: - type: object - properties: - encoded: - description: Tokenized text - type: integer - x-fern-audiences: - - public - decoded: - description: Detokenized text - type: string - x-fern-audiences: - - public - log_likelihood: - description: Non normalized probability of the token - type: number - x-fern-audiences: - - public - LogLikelihoodResponse: - type: object - required: - - id - - prompt_tokens - - completion_tokens - - raw_prompt_tokens - properties: - id: - type: string - x-fern-audiences: - - public - prompt_tokens: - description: Probabilities for tokens in the request prompt - type: array - x-fern-audiences: - - public - items: - $ref: "#/components/schemas/TokenLikelihood" - completion_tokens: - description: Probabilities for tokens in the request completion - type: array - x-fern-audiences: - - public - items: - $ref: "#/components/schemas/TokenLikelihood" - raw_prompt_tokens: - description: Probabilities for tokens in the request raw_prompt - type: array - x-fern-audiences: - - public - items: - $ref: "#/components/schemas/TokenLikelihood" - meta: - $ref: "#/components/schemas/ApiMeta" - x-fern-audiences: - - public - Cluster: - type: object - properties: - id: - type: string - x-fern-audiences: - - public - keywords: - type: array - x-fern-audiences: - - public - items: - type: string - x-fern-audiences: - - public - description: - type: string - x-fern-audiences: - - public - size: - type: integer - x-fern-audiences: - - public - sample_elements: - type: array - x-fern-audiences: - - public - items: - type: string - x-fern-audiences: - - public - GetClusterJobResponse: - type: object - required: - - job_id - properties: - job_id: - type: string - x-fern-audiences: - - public - created_at: - type: string - x-fern-audiences: - - public - description: Time of job creation in RFC3339 format - format: date-time - example: 2023-04-28T21:00:56.646257Z - readOnly: true - embeddings_url: - type: string - x-fern-audiences: - - public - description: The input file URL used for the job - readOnly: true - input_dataset_id: - type: string - x-fern-audiences: - - public - description: The input dataset ID used for the job - readOnly: true - min_cluster_size: - type: integer - x-fern-audiences: - - public - description: - The parameter used in the job creation. Please refer to the job - creation endpoint for more details - readOnly: true - n_neighbors: - type: integer - x-fern-audiences: - - public - description: - The parameter used in the job creation. Please refer to the job - creation endpoint for more details - readOnly: true - is_deterministic: - type: boolean - x-fern-audiences: - - public - description: - The parameter used in the job creation. Please refer to the job - creation endpoint for more details - readOnly: true - status: - type: string - x-fern-audiences: - - public - enum: - - unknown - - processing - - failed - - complete - - queued - is_final_state: - type: boolean - x-fern-audiences: - - public - description: - A boolean indicating whether the job is in a final state, whether - completed or failed - readOnly: true - output_clusters_url: - type: string - x-fern-audiences: - - public - description: The output file URL for the clusters (signed url that expires) - readOnly: true - output_outliers_url: - type: string - x-fern-audiences: - - public - description: The output file URL for the outliers (signed url that expires) - readOnly: true - clusters: - type: array - x-fern-audiences: - - public - description: The list of cluster summaries for the job - readOnly: true - items: - $ref: "#/components/schemas/Cluster" - error: - type: string - x-fern-audiences: - - public - meta: - $ref: "#/components/schemas/ApiMeta" - x-fern-audiences: - - public - description: Response for getting a cluster job. - ListClusterJobsResponse: - type: object - required: - - jobs - properties: - jobs: - type: array - x-fern-audiences: - - public - items: - $ref: "#/components/schemas/GetClusterJobResponse" - total_count: - type: integer - x-fern-audiences: - - public - meta: - $ref: "#/components/schemas/ApiMeta" - x-fern-audiences: - - public - CreateClusterJobRequest: - type: object - required: - - embeddings_url - properties: - embeddings_url: - type: string - x-fern-audiences: - - public - input_dataset_id: - type: string - x-fern-audiences: - - public - min_cluster_size: - type: integer - x-fern-audiences: - - public - description: - Defaults to `10`. Parameter for HDBSCAN. Only clusters with this - number of elements will be returned with a positive cluster number. - default: 10 - minimum: 1 - n_neighbors: - type: integer - x-fern-audiences: - - public - description: - Parameter for UMAP. A scalar governing how to balance global vs - local structure in the data. - minimum: 2 - maximum: 100 - default: 15 - is_deterministic: - type: boolean - x-fern-audiences: - - public - description: - Parameter for UMAP. A boolean governing whether the embeddings from - UMAP (that will be clustered with HDBSCAN) are deterministic. - default: true - generate_descriptions: - type: boolean - x-fern-audiences: - - public - CreateClusterJobResponse: - type: object - required: - - job_id - properties: - job_id: - type: string - x-fern-audiences: - - public - description: Response for creating a cluster job. - UpdateClusterJobRequest: - type: object - properties: - status: - type: string - x-fern-audiences: - - public - enum: - - unknown - - processing - - failed - - complete - - queued - clusters: - type: array - x-fern-audiences: - - public - items: - $ref: "#/components/schemas/Cluster" - output_clusters_gs_path: - type: string - x-fern-audiences: - - public - output_outliers_gs_path: - type: string - x-fern-audiences: - - public - error: - type: string - x-fern-audiences: - - public - input_tracking_metrics: - type: object - x-fern-audiences: - - public - output_tracking_metrics: - type: object - x-fern-audiences: - - public - UpdateClusterJobResponse: - type: object - required: - - job_id - properties: - job_id: - type: string - x-fern-audiences: - - public - description: Response for updating a cluster job. - CompatibleEndpoint: - type: string - description: One of the Cohere API endpoints that the model can be used with. - enum: - - chat - - embed - - classify - - summarize - - rerank - - rate - - generate - GetModelResponse: - description: - Contains information about the model and which API endpoints it can - be used with. - type: object - properties: - name: - type: string - x-fern-audiences: - - public - description: - Specify this name in the `model` parameter of API requests to use - your chosen model. - endpoints: - type: array - x-fern-audiences: - - public - items: - $ref: "#/components/schemas/CompatibleEndpoint" - description: The API endpoints that the model is compatible with. - finetuned: - type: boolean - x-fern-audiences: - - public - description: Whether the model has been fine-tuned or not. - context_length: - type: number - x-fern-audiences: - - public - description: - The maximum number of tokens that the model can process in a single - request. Note that not all of these tokens are always available due - to special tokens and preambles that Cohere has added by default. - tokenizer_url: - type: string - x-fern-audiences: - - public - description: Public URL to the tokenizer's configuration file. - default_endpoints: - type: array - x-fern-audiences: - - public - items: - $ref: "#/components/schemas/CompatibleEndpoint" - description: The API endpoints that the model is default to. - ListModelsResponse: - type: object - required: - - models - properties: - models: - type: array - x-fern-audiences: - - public - items: - $ref: "#/components/schemas/GetModelResponse" - next_page_token: - type: string - x-fern-audiences: - - public - description: - A token to retrieve the next page of results. Provide in the - page_token parameter of the next request. - BaseType: - type: string - enum: - - BASE_TYPE_UNSPECIFIED - - BASE_TYPE_GENERATIVE - - BASE_TYPE_CLASSIFICATION - - BASE_TYPE_RERANK - - BASE_TYPE_CHAT - default: BASE_TYPE_UNSPECIFIED - description: |- - The possible types of fine-tuned models. - - - BASE_TYPE_UNSPECIFIED: Unspecified model. - - BASE_TYPE_GENERATIVE: Generative model. - - BASE_TYPE_CLASSIFICATION: Classification model. - - BASE_TYPE_RERANK: Rerank model. - - BASE_TYPE_CHAT: Chat model. - x-fern-sdk-group-name: - - finetuning - - finetuning - Strategy: - type: string - enum: - - STRATEGY_UNSPECIFIED - - STRATEGY_VANILLA - - STRATEGY_TFEW - default: STRATEGY_UNSPECIFIED - description: |- - The possible strategy used to serve a fine-tuned models. - - - STRATEGY_UNSPECIFIED: Unspecified strategy. - - STRATEGY_VANILLA: Serve the fine-tuned model on a dedicated GPU. - - STRATEGY_TFEW: Serve the fine-tuned model on a shared GPU. - x-fern-sdk-group-name: - - finetuning - - finetuning - BaseModel: - type: object - properties: - name: - type: string - description: The name of the base model. - version: - type: string - description: read-only. The version of the base model. - readOnly: true - base_type: - $ref: "#/components/schemas/BaseType" - description: The type of the base model. - strategy: - $ref: "#/components/schemas/Strategy" - description: The fine-tuning strategy. - description: The base model used for fine-tuning. - required: - - base_type - x-fern-sdk-group-name: - - finetuning - - finetuning - Hyperparameters: - type: object - properties: - early_stopping_patience: - type: integer - format: int32 - description: |- - Stops training if the loss metric does not improve beyond the value of - `early_stopping_threshold` after this many times of evaluation. - early_stopping_threshold: - type: number - format: double - description: How much the loss must improve to prevent early stopping. - train_batch_size: - type: integer - format: int32 - description: |- - The batch size is the number of training examples included in a single - training pass. - train_epochs: - type: integer - format: int32 - description: The number of epochs to train for. - learning_rate: - type: number - format: double - description: The learning rate to be used during training. - description: The fine-tuning hyperparameters. - x-fern-sdk-group-name: - - finetuning - - finetuning - Settings: - type: object - properties: - base_model: - $ref: "#/components/schemas/BaseModel" - description: The base model to fine-tune. - dataset_id: - type: string - description: The data used for training and evaluating the fine-tuned model. - hyperparameters: - $ref: "#/components/schemas/Hyperparameters" - description: Fine-tuning hyper-parameters. - multi_label: - type: boolean - description: - read-only. Whether the model is single-label or multi-label (only - for classification). - readOnly: true - description: The configuration used for fine-tuning. - required: - - base_model - - dataset_id - x-fern-sdk-group-name: - - finetuning - - finetuning - Status: - type: string - enum: - - STATUS_UNSPECIFIED - - STATUS_FINETUNING - - STATUS_DEPLOYING_API - - STATUS_READY - - STATUS_FAILED - - STATUS_DELETED - - STATUS_TEMPORARILY_OFFLINE - - STATUS_PAUSED - - STATUS_QUEUED - default: STATUS_UNSPECIFIED - description: |- - The possible stages of a fine-tuned model life-cycle. - - - STATUS_UNSPECIFIED: Unspecified status. - - STATUS_FINETUNING: The fine-tuned model is being fine-tuned. - - STATUS_DEPLOYING_API: The fine-tuned model is being deployed. - - STATUS_READY: The fine-tuned model is ready to receive requests. - - STATUS_FAILED: The fine-tuned model failed. - - STATUS_DELETED: The fine-tuned model was deleted. - - STATUS_TEMPORARILY_OFFLINE: The fine-tuned model is temporarily unavailable. - - STATUS_PAUSED: The fine-tuned model is paused (Vanilla only). - - STATUS_QUEUED: The fine-tuned model is queued for training. - x-fern-sdk-group-name: - - finetuning - - finetuning - FinetunedModel: - type: object - properties: - id: - type: string - description: read-only. FinetunedModel ID. - readOnly: true - name: - type: string - description: FinetunedModel name (e.g. `foobar`). - creator_id: - type: string - description: read-only. User ID of the creator. - readOnly: true - organization_id: - type: string - description: read-only. Organization ID. - readOnly: true - settings: - $ref: "#/components/schemas/Settings" - description: FinetunedModel settings such as dataset, hyperparameters... - status: - $ref: "#/components/schemas/Status" - description: read-only. Current stage in the life-cycle of the fine-tuned model. - readOnly: true - created_at: - type: string - format: date-time - description: read-only. Creation timestamp. - readOnly: true - updated_at: - type: string - format: date-time - description: read-only. Latest update timestamp. - readOnly: true - completed_at: - type: string - format: date-time - description: read-only. Timestamp for the completed fine-tuning. - readOnly: true - last_used: - type: string - format: date-time - description: read-only. Timestamp for the latest request to this fine-tuned model. - readOnly: true - description: This resource represents a fine-tuned model. - required: - - name - - settings - x-fern-sdk-group-name: - - finetuning - - finetuning - ListFinetunedModelsResponse: - type: object - properties: - finetuned_models: - type: array - items: - type: object - $ref: "#/components/schemas/FinetunedModel" - description: List of fine-tuned models matching the request. - next_page_token: - type: string - description: |- - Pagination token to retrieve the next page of results. If the value is "", - it means no further results for the request. - total_size: - type: integer - format: int32 - description: Total count of results. - description: Response to a request to list fine-tuned models. - x-fern-sdk-group-name: - - finetuning - - finetuning - Error: - type: object - properties: - message: - type: string - description: A developer-facing error message. - description: Error is the response for any unsuccessful event. - x-fern-sdk-group-name: - - finetuning - - finetuning - CreateFinetunedModelResponse: - type: object - properties: - finetuned_model: - $ref: "#/components/schemas/FinetunedModel" - description: Information about the fine-tuned model. - description: Response to request to create a fine-tuned model. - x-fern-sdk-group-name: - - finetuning - - finetuning - GetFinetunedModelResponse: - type: object - properties: - finetuned_model: - $ref: "#/components/schemas/FinetunedModel" - description: Information about the fine-tuned model. - description: Response to a request to get a fine-tuned model. - x-fern-sdk-group-name: - - finetuning - - finetuning - DeleteFinetunedModelResponse: - type: object - description: Response to request to delete a fine-tuned model. - x-fern-sdk-group-name: - - finetuning - - finetuning - UpdateFinetunedModelResponse: - type: object - properties: - finetuned_model: - $ref: "#/components/schemas/FinetunedModel" - description: Information about the fine-tuned model. - description: Response to a request to update a fine-tuned model. - x-fern-sdk-group-name: - - finetuning - - finetuning - Event: - type: object - properties: - user_id: - type: string - description: - ID of the user who initiated the event. Empty if initiated by the - system. - status: - $ref: "#/components/schemas/Status" - description: Status of the fine-tuned model. - created_at: - type: string - format: date-time - description: Timestamp when the event happened. - description: A change in status of a fine-tuned model. - x-fern-sdk-group-name: - - finetuning - - finetuning - ListEventsResponse: - type: object - properties: - events: - type: array - items: - type: object - $ref: "#/components/schemas/Event" - description: List of events for the fine-tuned model. - next_page_token: - type: string - description: |- - Pagination token to retrieve the next page of results. If the value is "", - it means no further results for the request. - total_size: - type: integer - format: int32 - description: Total count of results. - description: Response to a request to list events of a fine-tuned model. - x-fern-sdk-group-name: - - finetuning - - finetuning - TrainingStepMetrics: - type: object - properties: - created_at: - type: string - format: date-time - description: Creation timestamp. - step_number: - type: integer - format: int32 - description: Step number. - metrics: - type: object - additionalProperties: - type: number - format: double - description: Map of names and values for each evaluation metrics. - description: The evaluation metrics at a given step of the training of a - fine-tuned model. - x-fern-sdk-group-name: - - finetuning - - finetuning - ListTrainingStepMetricsResponse: - type: object - properties: - step_metrics: - type: array - items: - type: object - $ref: "#/components/schemas/TrainingStepMetrics" - description: The metrics for each step the evaluation was run on. - next_page_token: - type: string - description: |- - Pagination token to retrieve the next page of results. If the value is "", - it means no further results for the request. - description: - Response to a request to list training-step metrics of a fine-tuned - model. - x-fern-sdk-group-name: - - finetuning - - finetuning - responses: - BadRequest: - description: | - This error is returned when the request is not well formed. This could be because: - - JSON is invalid - - The request is missing required fields - - The request contains an invalid combination of fields - content: - application/json: - schema: - type: object - properties: - data: - type: string - Unauthorized: - description: | - This error indicates that the operation attempted to be performed is not allowed. This could be because: - - The api token is invalid - - The user does not have the necessary permissions - content: - application/json: - schema: - type: object - properties: - data: - type: string - Forbidden: - description: | - This error indicates that the operation attempted to be performed is not allowed. This could be because: - - The api token is invalid - - The user does not have the necessary permissions - content: - application/json: - schema: - type: object - properties: - data: - type: string - NotFound: - description: | - This error is returned when a resource is not found. This could be because: - - The endpoint does not exist - - The resource does not exist eg model id, dataset id - content: - application/json: - schema: - type: object - properties: - data: - type: string - UnprocessableEntity: - description: | - This error is returned when the request is not well formed. This could be because: - - JSON is invalid - - The request is missing required fields - - The request contains an invalid combination of fields - content: - application/json: - schema: - type: object - properties: - data: - type: string - RateLimit: - description: Too many requests - content: - application/json: - schema: - type: object - properties: - data: - type: string - InvalidToken: - description: | - This error is returned when a request or response contains a deny-listed token. - content: - application/json: - schema: - type: object - properties: - data: - type: string - RequestCancelled: - description: | - This error is returned when a request is cancelled by the user. - content: - application/json: - schema: - type: object - properties: - data: - type: string - InternalServerError: - description: | - This error is returned when an uncategorised internal server error occurs. - content: - application/json: - schema: - type: object - properties: - data: - type: string - NotImplemented: - description: | - This error is returned when the requested feature is not implemented. - content: - application/json: - schema: - type: object - properties: - data: - type: string - ServiceUnavailable: - description: | - This error is returned when the service is unavailable. This could be due to: - - Too many users trying to access the service at the same time - content: - application/json: - schema: - type: object - properties: - data: - type: string - GatewayTimeout: - description: | - This error is returned when a request to the server times out. This could be due to: - - An internal services taking too long to respond - content: - application/json: - schema: - type: object - properties: - data: - type: string -x-readme: - disable-tag-sorting: true From 5edbff5062bf44441db5ddb6bda855208cfc6750 Mon Sep 17 00:00:00 2001 From: billytrend-cohere <144115527+billytrend-cohere@users.noreply.github.com> Date: Thu, 15 Aug 2024 10:26:54 -0500 Subject: [PATCH 04/10] Update generators.yml --- fern/apis/v1/generators.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fern/apis/v1/generators.yml b/fern/apis/v1/generators.yml index b833ceda..fdff0f4d 100644 --- a/fern/apis/v1/generators.yml +++ b/fern/apis/v1/generators.yml @@ -1 +1 @@ -openapi: ../cohere-openapi.yaml +openapi: ../../cohere-openapi.yaml From 1cb84a408c671cfdb66656b84125220ebed41d55 Mon Sep 17 00:00:00 2001 From: billytrend-cohere <144115527+billytrend-cohere@users.noreply.github.com> Date: Thu, 15 Aug 2024 10:28:04 -0500 Subject: [PATCH 05/10] Update generators.yml --- fern/apis/v1/generators.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fern/apis/v1/generators.yml b/fern/apis/v1/generators.yml index fdff0f4d..2a712643 100644 --- a/fern/apis/v1/generators.yml +++ b/fern/apis/v1/generators.yml @@ -1 +1 @@ -openapi: ../../cohere-openapi.yaml +openapi: ../../../cohere-openapi.yaml From cf5eb7947311d9e38017d9f71e07614a32d061b2 Mon Sep 17 00:00:00 2001 From: billytrend-cohere <144115527+billytrend-cohere@users.noreply.github.com> Date: Thu, 15 Aug 2024 12:08:51 -0500 Subject: [PATCH 06/10] Update v1.yml --- fern/v1.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/fern/v1.yml b/fern/v1.yml index ff938fdb..8f6aae0a 100644 --- a/fern/v1.yml +++ b/fern/v1.yml @@ -597,6 +597,13 @@ navigation: title: Chat Non-streaming - endpoint: STREAM /v1/chat title: Chat Streaming + - section: "v2/chat" + skip-slug: true + contents: + - endpoint: POST /v2/chat + title: Chat Non-streaming + - endpoint: STREAM /v2/chat + title: Chat Streaming - section: "/embed" skip-slug: true contents: From 3f57e9264a67f5924e3fc232c7ecd40a687d3dbd Mon Sep 17 00:00:00 2001 From: billytrend-cohere <144115527+billytrend-cohere@users.noreply.github.com> Date: Thu, 15 Aug 2024 13:23:58 -0500 Subject: [PATCH 07/10] Update v1.yml --- fern/v1.yml | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/fern/v1.yml b/fern/v1.yml index 8f6aae0a..f08782e9 100644 --- a/fern/v1.yml +++ b/fern/v1.yml @@ -590,26 +590,26 @@ navigation: - section: API Reference skip-slug: true contents: - - section: "/chat" + - section: "/v1/chat" skip-slug: true contents: - endpoint: POST /v1/chat title: Chat Non-streaming - endpoint: STREAM /v1/chat title: Chat Streaming - - section: "v2/chat" + - section: "/v2/chat" skip-slug: true contents: - endpoint: POST /v2/chat title: Chat Non-streaming - endpoint: STREAM /v2/chat title: Chat Streaming - - section: "/embed" + - section: "/v1/embed" skip-slug: true contents: - POST /v1/embed - embedJobs: - title: "/embed-jobs" + title: "/v1/embed-jobs" skip-slug: true contents: - endpoint: POST /v1/embed-jobs @@ -620,16 +620,16 @@ navigation: slug: get-embed-job - endpoint: POST /v1/embed-jobs/{id}/cancel slug: cancel-embed-job - - section: "/rerank" + - section: "/v1/rerank" skip-slug: true contents: - POST /v1/rerank - - section: "/classify" + - section: "/v1/classify" skip-slug: true contents: - POST /v1/classify - datasets: - title: "/datasets" + title: "/v1/datasets" skip-slug: true contents: - endpoint: POST /v1/datasets @@ -642,16 +642,16 @@ navigation: slug: get-dataset - endpoint: DELETE /v1/datasets/{id} slug: delete-dataset - - section: "/tokenize" + - section: "/v1/tokenize" skip-slug: true contents: - POST /v1/tokenize - - section: "/detokenize" + - section: "/v1/detokenize" skip-slug: true contents: - POST /v1/detokenize - connectors: - title: "/connectors" + title: "/v1/connectors" skip-slug: true contents: - endpoint: GET /v1/connectors @@ -667,20 +667,20 @@ navigation: - endpoint: POST /v1/connectors/{id}/oauth/authorize slug: oauthauthorize-connector - models: - title: "/models" + title: "/v1/models" skip-slug: true contents: - endpoint: GET /v1/models/{model} slug: get-model - endpoint: GET /v1/models slug: list-models - - section: "/check-api-key" + - section: "/v1/check-api-key" skip-slug: true contents: - endpoint: POST /v1/check-api-key slug: checkapikey - finetuning: - title: "/finetuning" + title: "/v1/finetuning" skip-slug: true contents: - endpoint: GET /v1/finetuning/finetuned-models @@ -700,14 +700,14 @@ navigation: - section: Legacy skip-slug: true contents: - - section: "/generate" + - section: "/v1/generate" skip-slug: true contents: - endpoint: POST /v1/generate title: Chat Non-streaming - endpoint: STREAM /v1/generate title: Chat Streaming - - section: "/summarize" + - section: "/v1/summarize" skip-slug: true contents: - POST /v1/summarize From b9e252aedc2fbf3081aa44c3b3f0e2f3f454ff47 Mon Sep 17 00:00:00 2001 From: billytrend-cohere <144115527+billytrend-cohere@users.noreply.github.com> Date: Thu, 15 Aug 2024 13:29:41 -0500 Subject: [PATCH 08/10] Update v1.yml --- fern/v1.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/fern/v1.yml b/fern/v1.yml index f08782e9..97786b65 100644 --- a/fern/v1.yml +++ b/fern/v1.yml @@ -581,6 +581,7 @@ navigation: api-name: v1 audiences: - public + - v2-beta skip-slug: true flattened: true snippets: From fe0592cbbc7117687a46d3a002b3abcd9dbc9690 Mon Sep 17 00:00:00 2001 From: billytrend-cohere <144115527+billytrend-cohere@users.noreply.github.com> Date: Thu, 15 Aug 2024 13:29:56 -0500 Subject: [PATCH 09/10] Update docs.yml --- fern/docs.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/fern/docs.yml b/fern/docs.yml index a64e8b19..6d501535 100644 --- a/fern/docs.yml +++ b/fern/docs.yml @@ -11,10 +11,6 @@ versions: - display-name: v1 path: v1.yml slug: v1 - - display-name: v2 - path: v2.yml - slug: v2 - availability: beta logo: light: assets/logo.svg From 5daa6c362b2f4c5ed25aa0b4687b9d28220ece1d Mon Sep 17 00:00:00 2001 From: billytrend-cohere <144115527+billytrend-cohere@users.noreply.github.com> Date: Thu, 15 Aug 2024 13:37:33 -0500 Subject: [PATCH 10/10] Update v1.yml --- fern/v1.yml | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/fern/v1.yml b/fern/v1.yml index 97786b65..b70aa841 100644 --- a/fern/v1.yml +++ b/fern/v1.yml @@ -588,22 +588,25 @@ navigation: python: "cohere" typescript: "cohere-ai" layout: - - section: API Reference + - section: V2 (beta) skip-slug: true contents: - - section: "/v1/chat" + - section: "/v2/chat" skip-slug: true contents: - - endpoint: POST /v1/chat + - endpoint: POST /v2/chat title: Chat Non-streaming - - endpoint: STREAM /v1/chat + - endpoint: STREAM /v2/chat title: Chat Streaming - - section: "/v2/chat" + - section: API Reference + skip-slug: true + contents: + - section: "/v1/chat" skip-slug: true contents: - - endpoint: POST /v2/chat + - endpoint: POST /v1/chat title: Chat Non-streaming - - endpoint: STREAM /v2/chat + - endpoint: STREAM /v1/chat title: Chat Streaming - section: "/v1/embed" skip-slug: true