From e913082c3f55aecc003949c65bc216702e76dd1a Mon Sep 17 00:00:00 2001 From: platform-endpoints Date: Mon, 19 Aug 2024 12:25:07 +0000 Subject: [PATCH] Add spec changes Co-authored-by: billytrend-cohere <144115527+billytrend-cohere@users.noreply.github.com> --- cohere-openapi.yaml | 4644 +++++++---------- .../snippets/requests/chat-post/default.yaml | 1 + .../requests/chat-post/documents.yaml | 1 + .../snippets/requests/chat-post/stream.yaml | 1 + .../snippets/requests/chat-post/tools.yaml | 1 + snippets/snippets/requests/classify-post.yaml | 1 + .../snippets/requests/connector-create.yaml | 1 + .../snippets/requests/connector-delete.yaml | 1 + snippets/snippets/requests/connector-get.yaml | 1 + .../snippets/requests/connector-patch.yaml | 1 + .../connectors-id-oauth-authorize-post.yaml | 1 + .../snippets/requests/connectors-list.yaml | 1 + snippets/snippets/requests/dataset-get.yaml | 1 + snippets/snippets/requests/dataset-post.yaml | 1 + .../snippets/requests/dataset-usage-get.yaml | 1 + .../snippets/requests/detokenize-post.yaml | 1 + .../snippets/requests/embed-jobs-cancel.yaml | 1 + .../snippets/requests/embed-jobs-get.yaml | 1 + .../snippets/requests/embed-jobs-post.yaml | 1 + snippets/snippets/requests/embed-post.yaml | 1 + .../snippets/requests/emebed-jobs-get.yaml | 1 + .../finetuning/create-finetuned-model.yaml | 1 + .../finetuning/delete-finetuned-model.yaml | 1 + .../finetuning/get-finetuned-model.yaml | 1 + .../requests/finetuning/list-events.yaml | 1 + .../finetuning/list-finetuned-models.yaml | 1 + .../list-training-step-metrics.yaml | 1 + .../finetuning/update-finetuned-model.yaml | 1 + snippets/snippets/requests/generate-post.yaml | 1 + .../snippets/requests/models-list-get.yaml | 1 + snippets/snippets/requests/rerank-post.yaml | 1 + .../snippets/requests/summarize-post.yaml | 1 + snippets/snippets/requests/tokenize-post.yaml | 1 + .../snippets/responses/chat-post/default.yaml | 1 + .../responses/chat-post/documents.yaml | 1 + .../snippets/responses/chat-post/stream.yaml | 1 + .../snippets/responses/chat-post/tools.yaml | 1 + .../snippets/responses/classify-post.yaml | 1 + .../snippets/responses/connector-create.yaml | 1 + .../snippets/responses/connector-delete.yaml | 1 + .../snippets/responses/connector-get.yaml | 1 + .../snippets/responses/connector-patch.yaml | 1 + .../connectors-id-oauth-authorize-post.yaml | 1 + .../snippets/responses/connectors-list.yaml | 1 + snippets/snippets/responses/dataset-get.yaml | 1 + snippets/snippets/responses/dataset-post.yaml | 1 + .../snippets/responses/dataset-usage-get.yaml | 1 + .../snippets/responses/detokenize-post.yaml | 1 + .../snippets/responses/embed-jobs-cancel.yaml | 1 + .../snippets/responses/embed-jobs-get.yaml | 1 + .../snippets/responses/embed-jobs-post.yaml | 1 + snippets/snippets/responses/embed-post.yaml | 1 + .../snippets/responses/emebed-jobs-get.yaml | 1 + .../finetuning/create-finetuned-model.yaml | 1 + .../finetuning/delete-finetuned-model.yaml | 1 + .../finetuning/get-finetuned-model.yaml | 1 + .../responses/finetuning/list-events.yaml | 1 + .../finetuning/list-finetuned-models.yaml | 1 + .../list-training-step-metrics.yaml | 1 + .../finetuning/update-finetuned-model.yaml | 1 + .../snippets/responses/generate-post.yaml | 1 + .../snippets/responses/models-list-get.yaml | 1 + snippets/snippets/responses/rerank-post.yaml | 1 + .../snippets/responses/summarize-post.yaml | 1 + .../snippets/responses/tokenize-post.yaml | 1 + 65 files changed, 2085 insertions(+), 2623 deletions(-) create mode 100644 snippets/snippets/requests/chat-post/default.yaml create mode 100644 snippets/snippets/requests/chat-post/documents.yaml create mode 100644 snippets/snippets/requests/chat-post/stream.yaml create mode 100644 snippets/snippets/requests/chat-post/tools.yaml create mode 100644 snippets/snippets/requests/classify-post.yaml create mode 100644 snippets/snippets/requests/connector-create.yaml create mode 100644 snippets/snippets/requests/connector-delete.yaml create mode 100644 snippets/snippets/requests/connector-get.yaml create mode 100644 snippets/snippets/requests/connector-patch.yaml create mode 100644 snippets/snippets/requests/connectors-id-oauth-authorize-post.yaml create mode 100644 snippets/snippets/requests/connectors-list.yaml create mode 100644 snippets/snippets/requests/dataset-get.yaml create mode 100644 snippets/snippets/requests/dataset-post.yaml create mode 100644 snippets/snippets/requests/dataset-usage-get.yaml create mode 100644 snippets/snippets/requests/detokenize-post.yaml create mode 100644 snippets/snippets/requests/embed-jobs-cancel.yaml create mode 100644 snippets/snippets/requests/embed-jobs-get.yaml create mode 100644 snippets/snippets/requests/embed-jobs-post.yaml create mode 100644 snippets/snippets/requests/embed-post.yaml create mode 100644 snippets/snippets/requests/emebed-jobs-get.yaml create mode 100644 snippets/snippets/requests/finetuning/create-finetuned-model.yaml create mode 100644 snippets/snippets/requests/finetuning/delete-finetuned-model.yaml create mode 100644 snippets/snippets/requests/finetuning/get-finetuned-model.yaml create mode 100644 snippets/snippets/requests/finetuning/list-events.yaml create mode 100644 snippets/snippets/requests/finetuning/list-finetuned-models.yaml create mode 100644 snippets/snippets/requests/finetuning/list-training-step-metrics.yaml create mode 100644 snippets/snippets/requests/finetuning/update-finetuned-model.yaml create mode 100644 snippets/snippets/requests/generate-post.yaml create mode 100644 snippets/snippets/requests/models-list-get.yaml create mode 100644 snippets/snippets/requests/rerank-post.yaml create mode 100644 snippets/snippets/requests/summarize-post.yaml create mode 100644 snippets/snippets/requests/tokenize-post.yaml create mode 100644 snippets/snippets/responses/chat-post/default.yaml create mode 100644 snippets/snippets/responses/chat-post/documents.yaml create mode 100644 snippets/snippets/responses/chat-post/stream.yaml create mode 100644 snippets/snippets/responses/chat-post/tools.yaml create mode 100644 snippets/snippets/responses/classify-post.yaml create mode 100644 snippets/snippets/responses/connector-create.yaml create mode 100644 snippets/snippets/responses/connector-delete.yaml create mode 100644 snippets/snippets/responses/connector-get.yaml create mode 100644 snippets/snippets/responses/connector-patch.yaml create mode 100644 snippets/snippets/responses/connectors-id-oauth-authorize-post.yaml create mode 100644 snippets/snippets/responses/connectors-list.yaml create mode 100644 snippets/snippets/responses/dataset-get.yaml create mode 100644 snippets/snippets/responses/dataset-post.yaml create mode 100644 snippets/snippets/responses/dataset-usage-get.yaml create mode 100644 snippets/snippets/responses/detokenize-post.yaml create mode 100644 snippets/snippets/responses/embed-jobs-cancel.yaml create mode 100644 snippets/snippets/responses/embed-jobs-get.yaml create mode 100644 snippets/snippets/responses/embed-jobs-post.yaml create mode 100644 snippets/snippets/responses/embed-post.yaml create mode 100644 snippets/snippets/responses/emebed-jobs-get.yaml create mode 100644 snippets/snippets/responses/finetuning/create-finetuned-model.yaml create mode 100644 snippets/snippets/responses/finetuning/delete-finetuned-model.yaml create mode 100644 snippets/snippets/responses/finetuning/get-finetuned-model.yaml create mode 100644 snippets/snippets/responses/finetuning/list-events.yaml create mode 100644 snippets/snippets/responses/finetuning/list-finetuned-models.yaml create mode 100644 snippets/snippets/responses/finetuning/list-training-step-metrics.yaml create mode 100644 snippets/snippets/responses/finetuning/update-finetuned-model.yaml create mode 100644 snippets/snippets/responses/generate-post.yaml create mode 100644 snippets/snippets/responses/models-list-get.yaml create mode 100644 snippets/snippets/responses/rerank-post.yaml create mode 100644 snippets/snippets/responses/summarize-post.yaml create mode 100644 snippets/snippets/responses/tokenize-post.yaml diff --git a/cohere-openapi.yaml b/cohere-openapi.yaml index e27c73590..f3897af15 100644 --- a/cohere-openapi.yaml +++ b/cohere-openapi.yaml @@ -1230,12 +1230,10 @@ paths: 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. @@ -1521,65 +1519,81 @@ paths: type: array items: $ref: "#/components/schemas/Tool-2" - tool_choice: - type: string - enum: - - AUTO - - NONE - - ANY + 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` content in the response will be empty 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. citation_mode: type: string enum: - FAST - ACCURATE - truncation_mode: - type: string - enum: - OFF - - AUTO - - AUTO_PRESERVE_ORDER + description: | + Defaults to `"accurate"`. + 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. response_format: - type: object - properties: - type: - type: string - enum: - - json_object - description: When set to JSON, the output will be parse-able valid JSON (or run - out of context). - schema: - description: | - A JSON schema object that the output will adhere to. Refer to https://json-schema.org/ for reference about schemas. - type: object + $ref: "#/components/schemas/ResponseFormat" max_tokens: type: integer - description: The maximum number of tokens to generate. + 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. stop_sequences: type: array items: type: string - description: A list of strings that the model will stop generating at. - max_input_tokens: - type: integer - description: The maximum number of tokens to feed into the model. + 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. temperature: type: number - description: The temperature of the model. 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. seed: type: integer + minimum: 0 + maximum: 18446744073709552000 + 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. frequency_penalty: type: number - description: The frequency penalty of the model. format: float + 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. presence_penalty: type: number - description: The presence penalty of the model. format: float + 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. k: - type: integer + type: number + format: float + default: 0 + minimum: 0 + maximum: 500 + 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`. p: - type: integer + type: number + format: float + default: 0.75 + minimum: 0.01 + maximum: 0.99 + 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`. responses: "200": description: OK @@ -1941,140 +1955,123 @@ paths: 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: '<>', - }); + x-fern-examples: + - code-samples: + - sdk: go + 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) + } + } + } + - sdk: node + code: | + const { CohereClient } = require('cohere-ai'); - (async () => { - const generate = await cohere.generate({ - prompt: 'Please explain to me how LLMs work', + const cohere = new CohereClient({ + token: '<>', }); - console.log(generate); - })(); - - language: python - name: Sync - install: python -m pip install cohere --upgrade - code: | - import cohere + (async () => { + const generate = await cohere.generate({ + prompt: 'Please explain to me how LLMs work', + }); - co = cohere.Client("<>") + console.log(generate); + })(); + - sdk: python + code: | + import cohere - 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.Client("<>") - co = cohere.AsyncClient("<>") + response = co.generate( + prompt="Please explain to me how LLMs work", + ) + print(response) + - sdk: python + 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; + async def main(): + response = await co.generate( + prompt="Please explain to me how LLMs work", + ) + print(response) - import com.cohere.api.requests.GenerateRequest; + asyncio.run(main()) + - sdk: java + code: > + import com.cohere.api.Cohere; - import com.cohere.api.types.Generation; + 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()); + public class GeneratePost { + public static void main(String[] args) { + Cohere cohere = Cohere.builder().token("<>").clientName("snippet").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" - }' + Generation response = cohere.generate(GenerateRequest.builder().prompt("Please explain to me how LLMs work").build()); + + System.out.println(response); + } + } + - sdk: 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 @@ -2117,9 +2114,9 @@ paths: "504": $ref: "#/components/responses/GatewayTimeout" description: | - - 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. - + > 🚧 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: @@ -2129,13 +2126,6 @@ paths: 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 @@ -2313,10 +2303,6 @@ paths: required: - prompt writeOnly: true - examples: - Example: - value: - prompt: Please explain to me how LLMs work description: "" /v1/embed: post: @@ -2326,138 +2312,121 @@ paths: 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: '<>', - }); + x-fern-examples: + - code-samples: + - sdk: go + 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) + } + - sdk: node + code: | + const { CohereClient } = require('cohere-ai'); - (async () => { - const embed = await cohere.embed({ - texts: ['hello', 'goodbye'], - model: 'embed-english-v3.0', - inputType: 'classification', + const cohere = new CohereClient({ + token: '<>', }); - console.log(embed); - })(); - - language: python - name: Sync - install: python -m pip install cohere --upgrade - code: > - import cohere + (async () => { + const embed = await cohere.embed({ + texts: ['hello', 'goodbye'], + model: 'embed-english-v3.0', + inputType: 'classification', + }); + console.log(embed); + })(); + - sdk: python + code: > + import cohere - co = cohere.Client("<>") + 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 + response = co.embed( + texts=["hello", "goodbye"], model="embed-english-v3.0", input_type="classification" + ) - import asyncio + print(response) + - sdk: python + code: > + import cohere + import asyncio - co = cohere.AsyncClient("<>") + 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; + async def main(): + response = await co.embed( + texts=["hello", "goodbye"], model="embed-english-v3.0", input_type="classification" + ) + print(response) - import com.cohere.api.requests.EmbedRequest; + asyncio.run(main()) + - sdk: java + code: > + import com.cohere.api.Cohere; - import com.cohere.api.types.EmbedInputType; + import com.cohere.api.requests.EmbedRequest; - import com.cohere.api.types.EmbedResponse; + import com.cohere.api.types.EmbedInputType; + import com.cohere.api.types.EmbedResponse; - import java.util.List; + 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()); + public class EmbedPost { + public static void main(String[] args) { + Cohere cohere = Cohere.builder().token("<>").clientName("snippet").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" - }' + EmbedResponse response = cohere.embed(EmbedRequest.builder().texts(List.of("hello", "goodbye")).model("embed-english-v3.0").inputType(EmbedInputType.CLASSIFICATION).build()); + + System.out.println(response); + } + } + - sdk: 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 @@ -2589,12 +2558,6 @@ paths: writeOnly: true required: - texts - examples: - Example: - value: - texts: - - hello - - goodbye description: "" /v1/embed-jobs: post: @@ -2608,150 +2571,131 @@ paths: - /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 - + x-fern-examples: + - code-samples: + - sdk: go + 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) + } + - sdk: python + code: > + import cohere - co = cohere.Client("<>") + co = cohere.Client("<>") - # start an embed job - job = co.embed_jobs.create( - dataset_id="my-dataset-id", input_type="search_document", model="embed-english-v3.0" - ) + # start an embed job + job = co.embed_jobs.create( + dataset_id="my-dataset-id", input_type="search_document", model="embed-english-v3.0" + ) - # poll the server until the job is complete - response = co.wait(job) + # 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 + print(response) + - sdk: python + code: > + import cohere + import asyncio - co = cohere.AsyncClient("<>") + co = cohere.AsyncClient("<>") - async def main(): - # start an embed job - job = await co.embed_jobs.create( - dataset_id="my-dataset-id", input_type="search_document", model="embed-english-v3.0" - ) - # poll the server until the job is complete - response = await co.wait(job) + async def main(): + # start an embed job + job = await co.embed_jobs.create( + dataset_id="my-dataset-id", input_type="search_document", model="embed-english-v3.0" + ) - print(response) + # poll the server until the job is complete + response = await co.wait(job) - asyncio.run(main()) - - language: java - name: Cohere java SDK - install: implementation 'com.cohere:cohere-java:1.0.4' - code: > - import com.cohere.api.Cohere; + print(response) - import - com.cohere.api.resources.embedjobs.requests.CreateEmbedJobRequest; + asyncio.run(main()) + - sdk: java + code: > + import com.cohere.api.Cohere; - import com.cohere.api.types.CreateEmbedJobResponse; + import + com.cohere.api.resources.embedjobs.requests.CreateEmbedJobRequest; - import com.cohere.api.types.EmbedInputType; + 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()); + public class EmbedJobsPost { + public static void main(String[] args) { + Cohere cohere = Cohere.builder().token("<>").clientName("snippet").build(); - System.out.println(response); - } - } - - language: node - name: Cohere TypeScript SDK - install: npm i cohere-ai - code: | - const { CohereClient } = require('cohere-ai'); + CreateEmbedJobResponse response = cohere.embedJobs().create(CreateEmbedJobRequest.builder().model("embed-english-v3.0").datasetId("ds.id").inputType(EmbedInputType.SEARCH_DOCUMENT).build()); - const cohere = new CohereClient({ - token: '<>', - }); + System.out.println(response); + } + } + - sdk: node + code: | + const { CohereClient } = require('cohere-ai'); - (async () => { - const embedJob = await cohere.embedJobs.create({ - datasetId: 'my-dataset', - inputType: 'search_document', - model: 'embed-english-v3.0', + const cohere = new CohereClient({ + token: '<>', }); - 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" - }' + (async () => { + const embedJob = await cohere.embedJobs.create({ + datasetId: 'my-dataset', + inputType: 'search_document', + model: 'embed-english-v3.0', + }); + + console.log(embedJob); + })(); + - sdk: 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 @@ -2811,109 +2755,90 @@ paths: - /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" + x-fern-examples: + - code-samples: + - sdk: go + code: | + package main - client "github.com/cohere-ai/cohere-go/v2/client" - ) + import ( + "context" + "log" - func main() { - co := client.NewClient(client.WithToken("<>")) + client "github.com/cohere-ai/cohere-go/v2/client" + ) - resp, err := co.EmbedJobs.Get(context.TODO(), "embed_job_id") + func main() { + co := client.NewClient(client.WithToken("<>")) - if err != nil { - log.Fatal(err) - } + resp, err := co.EmbedJobs.Get(context.TODO(), "embed_job_id") - log.Printf("%+v", resp) - } - - language: python - name: Sync - install: python -m pip install cohere --upgrade - code: | - import cohere + if err != nil { + log.Fatal(err) + } - co = cohere.Client("<>") + log.Printf("%+v", resp) + } + - sdk: python + code: | + import cohere - # list embed jobs - response = co.embed_jobs.list() + co = cohere.Client("<>") - print(response) - - language: python - name: Async - install: python -m pip install cohere --upgrade - code: | - import cohere - import asyncio + # list embed jobs + response = co.embed_jobs.list() - co = cohere.AsyncClient("<>") + print(response) + - sdk: python + code: | + import cohere + import asyncio + co = cohere.AsyncClient("<>") - async def main(): - response = await co.embed_jobs.list() - print(response) + async def main(): + response = await co.embed_jobs.list() - asyncio.run(main()) - - language: java - name: Cohere java SDK - install: implementation 'com.cohere:cohere-java:1.0.4' - code: > - import com.cohere.api.Cohere; + print(response) - import com.cohere.api.types.ListEmbedJobResponse; + asyncio.run(main()) + - sdk: java + 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(); + public class EmbedJobsGet { + public static void main(String[] args) { + Cohere cohere = Cohere.builder().token("<>").clientName("snippet").build(); - System.out.println(response); - } - } - - language: node - name: Cohere TypeScript SDK - install: npm i cohere-ai - code: | - const { CohereClient } = require('cohere-ai'); + ListEmbedJobResponse response = cohere.embedJobs().list(); - const cohere = new CohereClient({ - token: '<>', - }); + System.out.println(response); + } + } + - sdk: node + code: | + const { CohereClient } = require('cohere-ai'); - (async () => { - const embedJobs = await cohere.embedJobs.list(); + const cohere = new CohereClient({ + token: '<>', + }); - 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" + (async () => { + const embedJobs = await cohere.embedJobs.list(); + + console.log(embedJobs); + })(); + - sdk: 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 @@ -2974,109 +2899,90 @@ paths: - /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" + x-fern-examples: + - code-samples: + - sdk: go + code: | + package main - client "github.com/cohere-ai/cohere-go/v2/client" - ) + import ( + "context" + "log" - func main() { - co := client.NewClient(client.WithToken("<>")) + client "github.com/cohere-ai/cohere-go/v2/client" + ) - resp, err := co.EmbedJobs.List(context.TODO()) + func main() { + co := client.NewClient(client.WithToken("<>")) - if err != nil { - log.Fatal(err) - } + resp, err := co.EmbedJobs.List(context.TODO()) - log.Printf("%+v", resp) - } - - language: python - name: Sync - install: python -m pip install cohere --upgrade - code: | - import cohere + if err != nil { + log.Fatal(err) + } - co = cohere.Client("<>") + log.Printf("%+v", resp) + } + - sdk: python + code: | + import cohere - # get embed job - response = co.embed_jobs.get("job_id") + co = cohere.Client("<>") - print(response) - - language: python - name: Async - install: python -m pip install cohere --upgrade - code: | - import cohere - import asyncio + # get embed job + response = co.embed_jobs.get("job_id") - co = cohere.AsyncClient("<>") + print(response) + - sdk: python + code: | + import cohere + import asyncio + co = cohere.AsyncClient("<>") - async def main(): - response = await co.embed_jobs.get("job_id") - print(response) + async def main(): + response = await co.embed_jobs.get("job_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; + print(response) - import com.cohere.api.types.ListEmbedJobResponse; + asyncio.run(main()) + - sdk: java + 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(); + public class EmbedJobsGet { + public static void main(String[] args) { + Cohere cohere = Cohere.builder().token("<>").clientName("snippet").build(); - System.out.println(response); - } - } - - language: node - name: Cohere TypeScript SDK - install: npm i cohere-ai - code: | - const { CohereClient } = require('cohere-ai'); + ListEmbedJobResponse response = cohere.embedJobs().list(); - const cohere = new CohereClient({ - token: '<>', - }); + System.out.println(response); + } + } + - sdk: node + code: | + const { CohereClient } = require('cohere-ai'); - (async () => { - const embedJob = await cohere.embedJobs.get('job_id'); + const cohere = new CohereClient({ + token: '<>', + }); - 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" + (async () => { + const embedJob = await cohere.embedJobs.get('job_id'); + + console.log(embedJob); + })(); + - sdk: 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 @@ -3137,99 +3043,80 @@ paths: - /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" + x-fern-examples: + - code-samples: + - sdk: go + code: | + package main - client "github.com/cohere-ai/cohere-go/v2/client" - ) + import ( + "context" + "log" - func main() { - co := client.NewClient(client.WithToken("<>")) + client "github.com/cohere-ai/cohere-go/v2/client" + ) - err := co.EmbedJobs.Cancel(context.TODO(), "embed_job_id") + func main() { + co := client.NewClient(client.WithToken("<>")) - if err != nil { - log.Fatal(err) - } + err := co.EmbedJobs.Cancel(context.TODO(), "embed_job_id") - } - - language: python - name: Sync - install: python -m pip install cohere --upgrade - code: | - import cohere + if err != nil { + log.Fatal(err) + } - co = cohere.Client("<>") + } + - sdk: python + code: | + import cohere - # 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.Client("<>") - co = cohere.AsyncClient("<>") + # cancel an embed job + co.embed_jobs.cancel("job_id") + - sdk: python + 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; + async def main(): + await co.embed_jobs.cancel("job_id") + - sdk: java + 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'); + public class EmbedJobsCancel { + public static void main(String[] args) { + Cohere cohere = Cohere.builder().token("<>").clientName("snippet").build(); - const cohere = new CohereClient({ - token: '<>', - }); + cohere.embedJobs().cancel("job_id"); + } + } + - sdk: node + code: | + const { CohereClient } = require('cohere-ai'); - (async () => { - const embedJob = await cohere.embedJobs.cancel('job_id'); + const cohere = new CohereClient({ + token: '<>', + }); - 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" + (async () => { + const embedJob = await cohere.embedJobs.cancel('job_id'); + + console.log(embedJob); + })(); + - sdk: 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 @@ -3445,219 +3332,184 @@ paths: 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'); + x-fern-examples: + - code-samples: + - sdk: go + 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) + } + - sdk: node + code: > + const { CohereClient } = require('cohere-ai'); - const cohere = new CohereClient({ - token: '<>', - }); + 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', - }); + (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 + console.log(rerank); + })(); + - sdk: python + code: > + import cohere - co = cohere.Client("<>") + 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.", - ] + 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, - ) + 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 + print(response) + - sdk: python + code: > + import cohere - import asyncio + import asyncio - co = cohere.AsyncClient("<>") + 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.", - ] + 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) + 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; + asyncio.run(main()) + - sdk: java + code: > + import com.cohere.api.Cohere; - import com.cohere.api.requests.RerankRequest; + import com.cohere.api.requests.RerankRequest; - import com.cohere.api.types.RerankRequestDocumentsItem; + import com.cohere.api.types.RerankRequestDocumentsItem; - import com.cohere.api.types.RerankResponse; + import com.cohere.api.types.RerankResponse; - import java.util.List; + import java.util.List; - public class RerankPost { - public static void main(String[] args) { - Cohere cohere = Cohere.builder().token("<>").clientName("snippet").build(); + 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()); + 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."] - }' + System.out.println(response); + } + } + - sdk: 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."] + }' /v1/classify: post: parameters: @@ -3666,241 +3518,224 @@ paths: - 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: '<>', - }); + x-fern-examples: + - code-samples: + - sdk: go + 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) + } + - sdk: node + code: > + const { CohereClient } = require('cohere-ai'); - (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 $'], + const cohere = new CohereClient({ + token: '<>', }); - 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"} - ] - }' + (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); + })(); + - sdk: python + 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) + - sdk: python + 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()) + - sdk: java + 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); + } + } + - sdk: 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 @@ -3910,38 +3745,6 @@ paths: 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 @@ -4054,42 +3857,6 @@ paths: 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: @@ -4131,61 +3898,26 @@ paths: 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. + 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).\nNote": + 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: @@ -4224,33 +3956,6 @@ paths: 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: "" /v1/datasets: post: @@ -4369,165 +4074,146 @@ paths: - public description: The delimiter used for .csv uploads. - $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 + x-fern-examples: + - code-samples: + - sdk: go + code: > + package main - import ( - "context" - "io" - "log" - "strings" + import ( + "context" + "io" + "log" + "strings" - cohere "github.com/cohere-ai/cohere-go/v2" - client "github.com/cohere-ai/cohere-go/v2/client" - ) + cohere "github.com/cohere-ai/cohere-go/v2" + client "github.com/cohere-ai/cohere-go/v2/client" + ) - type MyReader struct { - io.Reader - name string - } + type MyReader struct { + io.Reader + name string + } - func (m *MyReader) Name() string { - return m.name - } + func (m *MyReader) Name() string { + return m.name + } - func main() { - co := client.NewClient(client.WithToken("<>")) + 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, - }, - ) + 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) - } + if err != nil { + log.Fatal(err) + } - log.Printf("%+v", resp) - } - - language: python - name: Sync - install: python -m pip install cohere --upgrade - code: | - import cohere + log.Printf("%+v", resp) + } + - sdk: python + code: | + import cohere - co = cohere.Client("<>") + co = cohere.Client("<>") - # upload a dataset - my_dataset = co.datasets.create( - name="prompt-completion-dataset", - data=open("./prompt-completion.jsonl", "rb"), - type="prompt-completion-finetune-input", - ) + # upload a dataset + my_dataset = 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) + # 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 + print(response) + - sdk: python + code: | + import cohere + import asyncio - co = cohere.AsyncClient("<>") + co = cohere.AsyncClient("<>") - async def main(): + 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", - ) + # 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) + # wait for validation to complete + response = await co.wait(response) - print(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; + asyncio.run(main()) + - sdk: java + code: > + import com.cohere.api.Cohere; - import - com.cohere.api.resources.datasets.requests.DatasetsCreateRequest; + import + com.cohere.api.resources.datasets.requests.DatasetsCreateRequest; - import - com.cohere.api.resources.datasets.types.DatasetsCreateResponse; + import + com.cohere.api.resources.datasets.types.DatasetsCreateResponse; - import com.cohere.api.types.DatasetType; + import com.cohere.api.types.DatasetType; - import java.util.Optional; + import java.util.Optional; - public class DatasetPost { - public static void main(String[] args) { - Cohere cohere = Cohere.builder().token("<>").clientName("snippet").build(); + 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()); + 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'); + System.out.println(response); + } + } + - sdk: node + code: > + const { CohereClient } = require('cohere-ai'); - const fs = require('fs'); + const fs = require('fs'); - const cohere = new CohereClient({ - token: '<>', - }); + 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"} + (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); + 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 + console.log(dataset); + })(); + - sdk: 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. @@ -4621,110 +4307,91 @@ paths: 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" + x-fern-examples: + - code-samples: + - sdk: go + code: | + package main - client "github.com/cohere-ai/cohere-go/v2/client" - ) + import ( + "context" + "log" - func main() { - co := client.NewClient(client.WithToken("<>")) + client "github.com/cohere-ai/cohere-go/v2/client" + ) - resp, err := co.Datasets.Get(context.TODO(), "dataset_id") + func main() { + co := client.NewClient(client.WithToken("<>")) - if err != nil { - log.Fatal(err) - } + resp, err := co.Datasets.Get(context.TODO(), "dataset_id") - log.Printf("%+v", resp) - } - - language: python - name: Sync - install: python -m pip install cohere --upgrade - code: | - import cohere + if err != nil { + log.Fatal(err) + } - co = cohere.Client("<>") + log.Printf("%+v", resp) + } + - sdk: python + code: | + import cohere - # get dataset - response = co.datasets.get(id="<>") + co = cohere.Client("<>") - print(response) - - language: python - name: Async - install: python -m pip install cohere --upgrade - code: | - import cohere - import asyncio + # get dataset + response = co.datasets.get(id="<>") - co = cohere.AsyncClient("<>") + print(response) + - sdk: python + code: | + import cohere + import asyncio + co = cohere.AsyncClient("<>") - async def main(): - response = await co.datasets.get(id="<>") - print(response) + async def main(): + response = await co.datasets.get(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; + print(response) - import - com.cohere.api.resources.datasets.types.DatasetsGetResponse; + asyncio.run(main()) + - sdk: java + 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"); + public class DatasetGet { + public static void main(String[] args) { + Cohere cohere = Cohere.builder().token("<>").clientName("snippet").build(); - System.out.println(response); - } - } - - language: node - name: Cohere TypeScript SDK - install: npm i cohere-ai - code: | - const { CohereClient } = require('cohere-ai'); + DatasetsGetResponse response = cohere.datasets().get("dataset_id"); - const cohere = new CohereClient({ - token: '<>', - }); + System.out.println(response); + } + } + - sdk: node + code: | + const { CohereClient } = require('cohere-ai'); - (async () => { - const datasets = await cohere.datasets.get('<>'); + const cohere = new CohereClient({ + token: '<>', + }); - 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" + (async () => { + const datasets = await cohere.datasets.get('<>'); + + console.log(datasets); + })(); + - sdk: 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. @@ -4779,110 +4446,91 @@ paths: - $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" + x-fern-examples: + - code-samples: + - sdk: go + code: | + package main - client "github.com/cohere-ai/cohere-go/v2/client" - ) + import ( + "context" + "log" - func main() { - co := client.NewClient(client.WithToken("<>")) + client "github.com/cohere-ai/cohere-go/v2/client" + ) - resp, err := co.Datasets.GetUsage(context.TODO()) + func main() { + co := client.NewClient(client.WithToken("<>")) - if err != nil { - log.Fatal(err) - } + resp, err := co.Datasets.GetUsage(context.TODO()) - log.Printf("%+v", resp) - } - - language: python - name: Sync - install: python -m pip install cohere --upgrade - code: | - import cohere + if err != nil { + log.Fatal(err) + } - co = cohere.Client("<>") + log.Printf("%+v", resp) + } + - sdk: python + code: | + import cohere - # get usage - response = co.datasets.get_usage() + co = cohere.Client("<>") - print(response) - - language: python - name: Async - install: python -m pip install cohere --upgrade - code: | - import cohere - import asyncio + # get usage + response = co.datasets.get_usage() - co = cohere.AsyncClient("<>") + print(response) + - sdk: python + code: | + import cohere + import asyncio + co = cohere.AsyncClient("<>") - async def main(): - response = await co.datasets.get_usage() - print(response) + async def main(): + response = await co.datasets.get_usage() - asyncio.run(main()) - - language: java - name: Cohere java SDK - install: implementation 'com.cohere:cohere-java:1.0.4' - code: > - import com.cohere.api.Cohere; + print(response) - import - com.cohere.api.resources.datasets.types.DatasetsGetUsageResponse; + asyncio.run(main()) + - sdk: java + 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(); + public class DatasetUsageGet { + public static void main(String[] args) { + Cohere cohere = Cohere.builder().token("<>").clientName("snippet").build(); - System.out.println(response); - } - } - - language: node - name: Cohere TypeScript SDK - install: npm i cohere-ai - code: | - const { CohereClient } = require('cohere-ai'); + DatasetsGetUsageResponse response = cohere.datasets().getUsage(); - const cohere = new CohereClient({ - token: '<>', - }); + System.out.println(response); + } + } + - sdk: node + code: | + const { CohereClient } = require('cohere-ai'); - (async () => { - const usage = await cohere.datasets.getUsage('id'); + const cohere = new CohereClient({ + token: '<>', + }); - 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" + (async () => { + const usage = await cohere.datasets.getUsage('id'); + + console.log(usage); + })(); + - sdk: 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. @@ -4946,110 +4594,91 @@ paths: - 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" + x-fern-examples: + - code-samples: + - sdk: go + code: | + package main - client "github.com/cohere-ai/cohere-go/v2/client" - ) + import ( + "context" + "log" - func main() { - co := client.NewClient(client.WithToken("<>")) + client "github.com/cohere-ai/cohere-go/v2/client" + ) - resp, err := co.Datasets.Get(context.TODO(), "dataset_id") + func main() { + co := client.NewClient(client.WithToken("<>")) - if err != nil { - log.Fatal(err) - } + resp, err := co.Datasets.Get(context.TODO(), "dataset_id") - log.Printf("%+v", resp) - } - - language: python - name: Sync - install: python -m pip install cohere --upgrade - code: | - import cohere + if err != nil { + log.Fatal(err) + } - co = cohere.Client("<>") + log.Printf("%+v", resp) + } + - sdk: python + code: | + import cohere - # get dataset - response = co.datasets.get(id="<>") + co = cohere.Client("<>") - print(response) - - language: python - name: Async - install: python -m pip install cohere --upgrade - code: | - import cohere - import asyncio + # get dataset + response = co.datasets.get(id="<>") - co = cohere.AsyncClient("<>") + print(response) + - sdk: python + code: | + import cohere + import asyncio + co = cohere.AsyncClient("<>") - async def main(): - response = await co.datasets.get(id="<>") - print(response) + async def main(): + response = await co.datasets.get(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; + print(response) - import - com.cohere.api.resources.datasets.types.DatasetsGetResponse; + asyncio.run(main()) + - sdk: java + 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"); + public class DatasetGet { + public static void main(String[] args) { + Cohere cohere = Cohere.builder().token("<>").clientName("snippet").build(); - System.out.println(response); - } - } - - language: node - name: Cohere TypeScript SDK - install: npm i cohere-ai - code: | - const { CohereClient } = require('cohere-ai'); + DatasetsGetResponse response = cohere.datasets().get("dataset_id"); - const cohere = new CohereClient({ - token: '<>', - }); + System.out.println(response); + } + } + - sdk: node + code: | + const { CohereClient } = require('cohere-ai'); - (async () => { - const datasets = await cohere.datasets.get('<>'); + const cohere = new CohereClient({ + token: '<>', + }); - 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" + (async () => { + const datasets = await cohere.datasets.get('<>'); + + console.log(datasets); + })(); + - sdk: 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. @@ -5109,87 +4738,70 @@ paths: - 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 + x-fern-examples: + - code-samples: + - sdk: go + code: | + package main - import ( - "context" - "log" + import ( + "context" + "log" - client "github.com/cohere-ai/cohere-go/v2/client" - ) + client "github.com/cohere-ai/cohere-go/v2/client" + ) - func main() { - co := client.NewClient(client.WithToken("<>")) + func main() { + co := client.NewClient(client.WithToken("<>")) - _, err := co.Datasets.Delete(context.TODO(), "dataset_id") + _, err := co.Datasets.Delete(context.TODO(), "dataset_id") - if err != nil { - log.Fatal(err) - } + if err != nil { + log.Fatal(err) + } - } - - language: python - name: Sync - install: python -m pip install cohere --upgrade - code: | - import cohere + } + - sdk: python + code: | + import cohere - co = cohere.Client("<>") + 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 + # delete dataset + co.datasets.delete("id") + - sdk: python + code: | + import cohere + import asyncio - co = cohere.AsyncClient("<>") + co = cohere.AsyncClient("<>") - async def main(): - await co.delete_dataset("id") + 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; + asyncio.run(main()) + - sdk: java + code: > + import com.cohere.api.Cohere; - public class DatasetDelete { - public static void main(String[] args) { - Cohere cohere = Cohere.builder().token("<>").clientName("snippet").build(); + public class DatasetDelete { + public static void main(String[] args) { + Cohere cohere = Cohere.builder().token("<>").clientName("snippet").build(); - cohere.datasets().delete("id"); + 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" + } + } + - sdk: 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. @@ -5231,223 +4843,206 @@ paths: 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 + x-fern-examples: + - code-samples: + - sdk: go + code: > + package main - import ( - "context" - "log" + import ( + "context" + "log" - cohere "github.com/cohere-ai/cohere-go/v2" - client "github.com/cohere-ai/cohere-go/v2/client" - ) + cohere "github.com/cohere-ai/cohere-go/v2" + client "github.com/cohere-ai/cohere-go/v2/client" + ) - func main() { - co := client.NewClient(client.WithToken("<>")) + 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", - }, - ) + 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) - } + 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'); + log.Printf("%+v", resp) + } + - sdk: node + code: > + const { CohereClient } = require('cohere-ai'); - const cohere = new CohereClient({ - token: '<>', - }); + 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." - }' + (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); + })(); + - sdk: python + 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) + - sdk: python + 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()) + - sdk: java + 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); + } + } + - sdk: 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 @@ -5504,9 +5099,9 @@ paths: "504": $ref: "#/components/responses/GatewayTimeout" description: | - - 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. - + > 🚧 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: @@ -5602,38 +5197,6 @@ paths: 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: "" /v1/tokenize: post: @@ -5900,135 +5463,118 @@ paths: 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: '<>', - }); + x-fern-examples: + - code-samples: + - sdk: go + 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) + } + - sdk: node + code: | + const { CohereClient } = require('cohere-ai'); - (async () => { - const detokenize = await cohere.detokenize({ - tokens: [10002, 2261, 2012, 8, 2792, 43], - model: 'command', + const cohere = new CohereClient({ + token: '<>', }); - console.log(detokenize); - })(); - - language: python - name: Sync - install: python -m pip install cohere --upgrade - code: > - import cohere + (async () => { + const detokenize = await cohere.detokenize({ + tokens: [10002, 2261, 2012, 8, 2792, 43], + model: 'command', + }); + console.log(detokenize); + })(); + - sdk: python + code: > + import cohere - co = cohere.Client("<>") + 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 + response = co.detokenize( + tokens=[8466, 5169, 2594, 8, 2792, 43], model="command" # optional + ) - import asyncio + print(response) + - sdk: python + code: > + import cohere + import asyncio - co = cohere.AsyncClient("<>") + 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; + async def main(): + response = await co.detokenize( + tokens=[8466, 5169, 2594, 8, 2792, 43], model="command" # optional + ) + print(response) - import com.cohere.api.requests.DetokenizeRequest; + asyncio.run(main()) + - sdk: java + code: > + import com.cohere.api.Cohere; - import com.cohere.api.types.DetokenizeResponse; + import com.cohere.api.requests.DetokenizeRequest; + import com.cohere.api.types.DetokenizeResponse; - import java.util.List; + 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() - ); + public class DetokenizePost { + public static void main(String[] args) { + Cohere cohere = Cohere.builder().token("<>").clientName("snippet").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] - }' + DetokenizeResponse response = cohere.detokenize( + DetokenizeRequest.builder().model("command").tokens(List.of(8466, 5169, 2594, 8, 2792, 43)).build() + ); + + System.out.println(response); + } + } + - sdk: 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 @@ -6058,13 +5604,6 @@ paths: - public required: - text - examples: - Example: - value: - text: detokenized! :D - meta: - api_version: - version: "1" "400": $ref: "#/components/responses/BadRequest" "401": @@ -6122,17 +5661,6 @@ paths: required: - tokens - model - examples: - Example: - value: - tokens: - - 10104 - - 12221 - - 1315 - - 34 - - 1420 - - 69 - model: command description: "" parameters: [] /v1/connectors: @@ -6198,108 +5726,89 @@ paths: $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 + x-fern-examples: + - code-samples: + - sdk: go + code: | + package main - import ( - "context" - "log" + import ( + "context" + "log" - cohere "github.com/cohere-ai/cohere-go/v2" - client "github.com/cohere-ai/cohere-go/v2/client" - ) + cohere "github.com/cohere-ai/cohere-go/v2" + client "github.com/cohere-ai/cohere-go/v2/client" + ) - func main() { - co := client.NewClient(client.WithToken("<>")) + func main() { + co := client.NewClient(client.WithToken("<>")) - resp, err := co.Connectors.List( - context.TODO(), - &cohere.ConnectorsListRequest{}) + resp, err := co.Connectors.List( + context.TODO(), + &cohere.ConnectorsListRequest{}) - if err != nil { - log.Fatal(err) - } + 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 + log.Printf("%+v", resp) + } + - sdk: python + code: | + import cohere - co = cohere.AsyncClient("<>") + co = cohere.Client("<>") + response = co.connectors.list() + print(response) + - sdk: python + 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; + async def main(): + response = await co.connectors.list() + print(response) - import com.cohere.api.types.ListConnectorsResponse; + asyncio.run(main()) + - sdk: java + 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(); + public class ConnectorsList { + public static void main(String[] args) { + Cohere cohere = Cohere.builder().token("<>").clientName("snippet").build(); - System.out.println(list); - } - } - - language: node - name: Cohere TypeScript SDK - install: npm i cohere-ai - code: | - const { CohereClient } = require('cohere-ai'); + ListConnectorsResponse list = cohere.connectors().list(); - const cohere = new CohereClient({ - token: '<>', - }); + System.out.println(list); + } + } + - sdk: node + code: | + const { CohereClient } = require('cohere-ai'); - (async () => { - const connectors = await cohere.connectors.list(); + const cohere = new CohereClient({ + token: '<>', + }); - 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" + (async () => { + const connectors = await cohere.connectors.list(); + + console.log(connectors); + })(); + - sdk: 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 @@ -6353,136 +5862,117 @@ paths: $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 + x-fern-examples: + - code-samples: + - sdk: go + 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) + } + - sdk: python + code: | + import cohere - import ( - "context" - "log" + co = cohere.Client("<>") + response = co.connectors.create( + name="Example connector", + url="https://connector-example.com/search", + ) + print(response) + - sdk: python + code: | + import cohere + import asyncio - cohere "github.com/cohere-ai/cohere-go/v2" - client "github.com/cohere-ai/cohere-go/v2/client" - ) + co = cohere.AsyncClient("<>") - 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", - }, - }, - ) + async def main(): + response = await co.connectors.create( + name="Example connector", + url="https://connector-example.com/search", + ) + print(response) - if err != nil { - log.Fatal(err) - } + asyncio.run(main()) + - sdk: java + code: > + import com.cohere.api.Cohere; - log.Printf("%+v", resp) - } - - language: python - name: Sync - install: python -m pip install cohere --upgrade - code: | - import cohere + import + com.cohere.api.resources.connectors.requests.CreateConnectorRequest; - 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 + import com.cohere.api.types.CreateConnectorResponse; - co = cohere.AsyncClient("<>") - async def main(): - response = await co.connectors.create( - name="Example connector", - url="https://connector-example.com/search", - ) - print(response) + public class ConnectorCreate { + public static void main(String[] args) { + Cohere cohere = Cohere.builder().token("<>").clientName("snippet").build(); - asyncio.run(main()) - - language: java - name: Cohere java SDK - install: implementation 'com.cohere:cohere-java:1.0.4' - code: > - import com.cohere.api.Cohere; + CreateConnectorResponse response = cohere.connectors().create(CreateConnectorRequest.builder() + .name("Example connector") + .url("https://connector-example.com/search").build()); - 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: '<>', - }); + System.out.println(response); + } + } + - sdk: node + code: | + const { CohereClient } = require('cohere-ai'); - (async () => { - const connector = await cohere.connectors.create({ - name: 'test-connector', - url: 'https://example.com/search', - description: 'A test connector', + const cohere = new CohereClient({ + token: '<>', }); - 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" - }' + (async () => { + const connector = await cohere.connectors.create({ + name: 'test-connector', + url: 'https://example.com/search', + description: 'A test connector', + }); + + console.log(connector); + })(); + - sdk: 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" + }' "/v1/connectors/{id}": get: x-fern-audiences: @@ -6537,103 +6027,86 @@ paths: $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 + x-fern-examples: + - code-samples: + - sdk: go + code: | + package main - import ( - "context" - "log" + import ( + "context" + "log" - client "github.com/cohere-ai/cohere-go/v2/client" - ) + client "github.com/cohere-ai/cohere-go/v2/client" + ) - func main() { - co := client.NewClient(client.WithToken("<>")) + func main() { + co := client.NewClient(client.WithToken("<>")) - resp, err := co.Connectors.Get(context.TODO(), "connector_id") + resp, err := co.Connectors.Get(context.TODO(), "connector_id") - if err != nil { - log.Fatal(err) - } + 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 + log.Printf("%+v", resp) + } + - sdk: python + code: | + import cohere - co = cohere.AsyncClient("<>") + co = cohere.Client("<>") + response = co.connectors.get("test-id") + print(response) + - sdk: python + 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; + async def main(): + response = await co.connectors.get("test-id") + print(response) - import com.cohere.api.types.GetConnectorResponse; + asyncio.run(main()) + - sdk: java + 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"); + public class ConnectorGet { + public static void main(String[] args) { + Cohere cohere = Cohere.builder().token("<>").clientName("snippet").build(); - System.out.println(response); - } - } - - language: node - name: Cohere TypeScript SDK - install: npm i cohere-ai - code: | - const { CohereClient } = require('cohere-ai'); + GetConnectorResponse response = cohere.connectors().get("test-id"); - const cohere = new CohereClient({ - token: '<>', - }); + System.out.println(response); + } + } + - sdk: node + code: | + const { CohereClient } = require('cohere-ai'); - (async () => { - const connector = await cohere.connectors.get('connector-id'); + const cohere = new CohereClient({ + token: '<>', + }); - 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" + (async () => { + const connector = await cohere.connectors.get('connector-id'); + + console.log(connector); + })(); + - sdk: 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 @@ -6694,129 +6167,114 @@ paths: $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 - + x-fern-examples: + - code-samples: + - sdk: go + 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) + } + - sdk: python + code: > + import cohere - co = cohere.Client("<>") - response = co.connectors.update( - connector_id="test-id", name="new name", url="https://example.com/search" - ) + co = cohere.Client("<>") - print(response) - - language: python - name: Async - install: python -m pip install cohere --upgrade - code: > - import cohere - - import asyncio + response = co.connectors.update( + connector_id="test-id", name="new name", url="https://example.com/search" + ) + print(response) + - sdk: python + code: > + import cohere - co = cohere.AsyncClient("<>") + 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; + 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()) + - sdk: java + code: > + import com.cohere.api.Cohere; - public class ConnectorPatch { - public static void main(String[] args) { - Cohere cohere = Cohere.builder().token("<>").clientName("snippet").build(); + import + com.cohere.api.resources.connectors.requests.UpdateConnectorRequest; - 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', - }); + public class ConnectorPatch { + public static void main(String[] args) { + Cohere cohere = Cohere.builder().token("<>").clientName("snippet").build(); - 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" - }' + cohere.connectors().update("test-id", UpdateConnectorRequest.builder() + .name("new name") + .url("https://connector-example.com/search").build()); + } + } + - sdk: node + 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); + })(); + - sdk: 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 @@ -6870,96 +6328,81 @@ paths: $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 + x-fern-examples: + - code-samples: + - sdk: go + code: > + package main - import ( - "context" - "log" - client "github.com/cohere-ai/cohere-go/v2/client" - ) + import ( + "context" + "log" - func main() { - co := client.NewClient(client.WithToken("<>")) + client "github.com/cohere-ai/cohere-go/v2/client" + ) - resp, err := co.Connectors.Delete(context.TODO(), "connector_id") - if err != nil { - log.Fatal(err) - } + func main() { + co := client.NewClient(client.WithToken("<>")) - log.Printf("%+v", resp) - } - - language: node - name: Cohere TypeScript SDK - install: npm i cohere-ai - code: | - const { CohereClient } = require('cohere-ai'); + resp, err := co.Connectors.Delete(context.TODO(), "connector_id") - const cohere = new CohereClient({ - token: '<>', - }); + if err != nil { + log.Fatal(err) + } - (async () => { - await cohere.connectors.delete('connector-id'); - })(); - - language: python - name: Sync - install: python -m pip install cohere --upgrade - code: | - import cohere + log.Printf("%+v", resp) + } + - sdk: node + code: | + const { CohereClient } = require('cohere-ai'); - co = cohere.Client("<>") - co.connectors.delete("test-id") - - language: python - name: Async - install: python -m pip install cohere --upgrade - code: | - import cohere - import asyncio + const cohere = new CohereClient({ + token: '<>', + }); - co = cohere.AsyncClient("<>") + (async () => { + await cohere.connectors.delete('connector-id'); + })(); + - sdk: python + code: | + import cohere + co = cohere.Client("<>") + co.connectors.delete("test-id") + - sdk: python + code: | + import cohere + import asyncio - async def main(): - await co.connectors.delete("test-id") + co = cohere.AsyncClient("<>") - asyncio.run(main()) - - language: java - name: Cohere java SDK - install: implementation 'com.cohere:cohere-java:1.0.4' - code: >+ - import com.cohere.api.Cohere; + async def main(): + await co.connectors.delete("test-id") + asyncio.run(main()) + - sdk: java + 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" + public class ConnectorDelete { + public static void main(String[] args) { + Cohere cohere = Cohere.builder().token("<>").clientName("snippet").build(); + + cohere.connectors().delete("test-id"); + } + } + + - sdk: curl + code: |- + curl --request DELETE \ + --url https://api.cohere.com/v1/connectors/id \ + --header 'accept: application/json' \ + --header "Authorization: bearer $CO_API_KEY" "/v1/connectors/{id}/oauth/authorize": post: x-fern-audiences: @@ -7022,129 +6465,110 @@ paths: $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 + x-fern-examples: + - code-samples: + - sdk: go + 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) + } + - sdk: python + code: > + import cohere - co = cohere.Client("<>") + co = cohere.Client("<>") - response = co.connectors.o_auth_authorize( - connector_id="test-id", after_token_redirect="https://test.com" - ) + 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 + print(response) + - sdk: python + code: > + import cohere - import asyncio + import asyncio - co = cohere.AsyncClient("<>") + 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) + 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; + asyncio.run(main()) + - sdk: java + code: > + import com.cohere.api.Cohere; - import - com.cohere.api.resources.connectors.requests.ConnectorsOAuthAuthorizeRequest; + import + com.cohere.api.resources.connectors.requests.ConnectorsOAuthAuthorizeRequest; - import com.cohere.api.types.OAuthAuthorizeResponse; + import com.cohere.api.types.OAuthAuthorizeResponse; - public class ConnectorsIdOauthAuthorizePost { - public static void main(String[] args) { - Cohere cohere = Cohere.builder().token("<>").clientName("snippet").build(); + 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()); + 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'); + System.out.println(response); + } + } + - sdk: node + code: > + const { CohereClient } = require('cohere-ai'); - const cohere = new CohereClient({ - token: '<>', - }); + const cohere = new CohereClient({ + token: '<>', + }); - (async () => { - const connector = await cohere.connectors.oAuthAuthorize('connector-id', { - redirect_uri: 'https://example.com/oauth/callback', - }); + (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" + console.log(connector); + })(); + - sdk: 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" "/v1/models/{model}": get: summary: Get a Model @@ -7282,106 +6706,89 @@ paths: $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 + x-fern-examples: + - code-samples: + - sdk: python + code: | + import cohere - co = cohere.AsyncClient("<>") + co = cohere.Client("<>") + response = co.models.list() + print(response) + - sdk: python + 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; + async def main(): + response = await co.models.list() + print(response) - import com.cohere.api.types.ListModelsResponse; + asyncio.run(main()) + - sdk: java + 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(); + public class ModelsListGet { + public static void main(String[] args) { + Cohere cohere = Cohere.builder().token("<>").clientName("snippet").build(); - 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'); + ListModelsResponse response = cohere.models().list(); - const cohere = new CohereClient({ - token: '<>', - }); + System.out.println(response); + } + } + - sdk: curl + code: |- + curl --request GET \ + --url https://api.cohere.com/v1/models \ + --header 'accept: application/json' \ + --header "Authorization: bearer $CO_API_KEY" + - sdk: node + code: | + const { CohereClient } = require('cohere-ai'); + + const cohere = new CohereClient({ + token: '<>', + }); - (async () => { - const models = await cohere.models.list(); + (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 + console.log(models); + })(); + - sdk: go + code: > + package main - import ( - "context" - "log" + import ( + "context" + "log" - cohere "github.com/cohere-ai/cohere-go/v2" - client "github.com/cohere-ai/cohere-go/v2/client" - ) + cohere "github.com/cohere-ai/cohere-go/v2" + client "github.com/cohere-ai/cohere-go/v2/client" + ) - func main() { - co := client.NewClient(client.WithToken("<>")) + func main() { + co := client.NewClient(client.WithToken("<>")) - resp, err := co.Models.List(context.TODO(), &cohere.ModelsListRequest{}) + resp, err := co.Models.List(context.TODO(), &cohere.ModelsListRequest{}) - if err != nil { - log.Fatal(err) - } + if err != nil { + log.Fatal(err) + } - log.Printf("%+v", resp) - } + log.Printf("%+v", resp) + } /v1/check-api-key: post: parameters: @@ -9806,7 +9213,6 @@ components: description: Content block of the message that contains information about documents. required: - type - - id - document properties: type: @@ -9848,6 +9254,9 @@ components: enum: - user content: + description: | + The content of the message. This can be a string or a list of content blocks. + If a string is provided, it will be treated as a text content block. oneOf: - type: string - type: array @@ -9923,11 +9332,14 @@ components: - function function: type: object + description: The function to be executed. properties: name: type: string + description: The name of the function. description: type: string + description: The description of the function. parameters: type: object description: The parameters of the function as a JSON schema. @@ -13010,20 +12422,6 @@ components: 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 diff --git a/snippets/snippets/requests/chat-post/default.yaml b/snippets/snippets/requests/chat-post/default.yaml new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/snippets/snippets/requests/chat-post/default.yaml @@ -0,0 +1 @@ +{} diff --git a/snippets/snippets/requests/chat-post/documents.yaml b/snippets/snippets/requests/chat-post/documents.yaml new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/snippets/snippets/requests/chat-post/documents.yaml @@ -0,0 +1 @@ +{} diff --git a/snippets/snippets/requests/chat-post/stream.yaml b/snippets/snippets/requests/chat-post/stream.yaml new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/snippets/snippets/requests/chat-post/stream.yaml @@ -0,0 +1 @@ +{} diff --git a/snippets/snippets/requests/chat-post/tools.yaml b/snippets/snippets/requests/chat-post/tools.yaml new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/snippets/snippets/requests/chat-post/tools.yaml @@ -0,0 +1 @@ +{} diff --git a/snippets/snippets/requests/classify-post.yaml b/snippets/snippets/requests/classify-post.yaml new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/snippets/snippets/requests/classify-post.yaml @@ -0,0 +1 @@ +{} diff --git a/snippets/snippets/requests/connector-create.yaml b/snippets/snippets/requests/connector-create.yaml new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/snippets/snippets/requests/connector-create.yaml @@ -0,0 +1 @@ +{} diff --git a/snippets/snippets/requests/connector-delete.yaml b/snippets/snippets/requests/connector-delete.yaml new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/snippets/snippets/requests/connector-delete.yaml @@ -0,0 +1 @@ +{} diff --git a/snippets/snippets/requests/connector-get.yaml b/snippets/snippets/requests/connector-get.yaml new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/snippets/snippets/requests/connector-get.yaml @@ -0,0 +1 @@ +{} diff --git a/snippets/snippets/requests/connector-patch.yaml b/snippets/snippets/requests/connector-patch.yaml new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/snippets/snippets/requests/connector-patch.yaml @@ -0,0 +1 @@ +{} diff --git a/snippets/snippets/requests/connectors-id-oauth-authorize-post.yaml b/snippets/snippets/requests/connectors-id-oauth-authorize-post.yaml new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/snippets/snippets/requests/connectors-id-oauth-authorize-post.yaml @@ -0,0 +1 @@ +{} diff --git a/snippets/snippets/requests/connectors-list.yaml b/snippets/snippets/requests/connectors-list.yaml new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/snippets/snippets/requests/connectors-list.yaml @@ -0,0 +1 @@ +{} diff --git a/snippets/snippets/requests/dataset-get.yaml b/snippets/snippets/requests/dataset-get.yaml new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/snippets/snippets/requests/dataset-get.yaml @@ -0,0 +1 @@ +{} diff --git a/snippets/snippets/requests/dataset-post.yaml b/snippets/snippets/requests/dataset-post.yaml new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/snippets/snippets/requests/dataset-post.yaml @@ -0,0 +1 @@ +{} diff --git a/snippets/snippets/requests/dataset-usage-get.yaml b/snippets/snippets/requests/dataset-usage-get.yaml new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/snippets/snippets/requests/dataset-usage-get.yaml @@ -0,0 +1 @@ +{} diff --git a/snippets/snippets/requests/detokenize-post.yaml b/snippets/snippets/requests/detokenize-post.yaml new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/snippets/snippets/requests/detokenize-post.yaml @@ -0,0 +1 @@ +{} diff --git a/snippets/snippets/requests/embed-jobs-cancel.yaml b/snippets/snippets/requests/embed-jobs-cancel.yaml new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/snippets/snippets/requests/embed-jobs-cancel.yaml @@ -0,0 +1 @@ +{} diff --git a/snippets/snippets/requests/embed-jobs-get.yaml b/snippets/snippets/requests/embed-jobs-get.yaml new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/snippets/snippets/requests/embed-jobs-get.yaml @@ -0,0 +1 @@ +{} diff --git a/snippets/snippets/requests/embed-jobs-post.yaml b/snippets/snippets/requests/embed-jobs-post.yaml new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/snippets/snippets/requests/embed-jobs-post.yaml @@ -0,0 +1 @@ +{} diff --git a/snippets/snippets/requests/embed-post.yaml b/snippets/snippets/requests/embed-post.yaml new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/snippets/snippets/requests/embed-post.yaml @@ -0,0 +1 @@ +{} diff --git a/snippets/snippets/requests/emebed-jobs-get.yaml b/snippets/snippets/requests/emebed-jobs-get.yaml new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/snippets/snippets/requests/emebed-jobs-get.yaml @@ -0,0 +1 @@ +{} diff --git a/snippets/snippets/requests/finetuning/create-finetuned-model.yaml b/snippets/snippets/requests/finetuning/create-finetuned-model.yaml new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/snippets/snippets/requests/finetuning/create-finetuned-model.yaml @@ -0,0 +1 @@ +{} diff --git a/snippets/snippets/requests/finetuning/delete-finetuned-model.yaml b/snippets/snippets/requests/finetuning/delete-finetuned-model.yaml new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/snippets/snippets/requests/finetuning/delete-finetuned-model.yaml @@ -0,0 +1 @@ +{} diff --git a/snippets/snippets/requests/finetuning/get-finetuned-model.yaml b/snippets/snippets/requests/finetuning/get-finetuned-model.yaml new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/snippets/snippets/requests/finetuning/get-finetuned-model.yaml @@ -0,0 +1 @@ +{} diff --git a/snippets/snippets/requests/finetuning/list-events.yaml b/snippets/snippets/requests/finetuning/list-events.yaml new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/snippets/snippets/requests/finetuning/list-events.yaml @@ -0,0 +1 @@ +{} diff --git a/snippets/snippets/requests/finetuning/list-finetuned-models.yaml b/snippets/snippets/requests/finetuning/list-finetuned-models.yaml new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/snippets/snippets/requests/finetuning/list-finetuned-models.yaml @@ -0,0 +1 @@ +{} diff --git a/snippets/snippets/requests/finetuning/list-training-step-metrics.yaml b/snippets/snippets/requests/finetuning/list-training-step-metrics.yaml new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/snippets/snippets/requests/finetuning/list-training-step-metrics.yaml @@ -0,0 +1 @@ +{} diff --git a/snippets/snippets/requests/finetuning/update-finetuned-model.yaml b/snippets/snippets/requests/finetuning/update-finetuned-model.yaml new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/snippets/snippets/requests/finetuning/update-finetuned-model.yaml @@ -0,0 +1 @@ +{} diff --git a/snippets/snippets/requests/generate-post.yaml b/snippets/snippets/requests/generate-post.yaml new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/snippets/snippets/requests/generate-post.yaml @@ -0,0 +1 @@ +{} diff --git a/snippets/snippets/requests/models-list-get.yaml b/snippets/snippets/requests/models-list-get.yaml new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/snippets/snippets/requests/models-list-get.yaml @@ -0,0 +1 @@ +{} diff --git a/snippets/snippets/requests/rerank-post.yaml b/snippets/snippets/requests/rerank-post.yaml new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/snippets/snippets/requests/rerank-post.yaml @@ -0,0 +1 @@ +{} diff --git a/snippets/snippets/requests/summarize-post.yaml b/snippets/snippets/requests/summarize-post.yaml new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/snippets/snippets/requests/summarize-post.yaml @@ -0,0 +1 @@ +{} diff --git a/snippets/snippets/requests/tokenize-post.yaml b/snippets/snippets/requests/tokenize-post.yaml new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/snippets/snippets/requests/tokenize-post.yaml @@ -0,0 +1 @@ +{} diff --git a/snippets/snippets/responses/chat-post/default.yaml b/snippets/snippets/responses/chat-post/default.yaml new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/snippets/snippets/responses/chat-post/default.yaml @@ -0,0 +1 @@ +{} diff --git a/snippets/snippets/responses/chat-post/documents.yaml b/snippets/snippets/responses/chat-post/documents.yaml new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/snippets/snippets/responses/chat-post/documents.yaml @@ -0,0 +1 @@ +{} diff --git a/snippets/snippets/responses/chat-post/stream.yaml b/snippets/snippets/responses/chat-post/stream.yaml new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/snippets/snippets/responses/chat-post/stream.yaml @@ -0,0 +1 @@ +{} diff --git a/snippets/snippets/responses/chat-post/tools.yaml b/snippets/snippets/responses/chat-post/tools.yaml new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/snippets/snippets/responses/chat-post/tools.yaml @@ -0,0 +1 @@ +{} diff --git a/snippets/snippets/responses/classify-post.yaml b/snippets/snippets/responses/classify-post.yaml new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/snippets/snippets/responses/classify-post.yaml @@ -0,0 +1 @@ +{} diff --git a/snippets/snippets/responses/connector-create.yaml b/snippets/snippets/responses/connector-create.yaml new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/snippets/snippets/responses/connector-create.yaml @@ -0,0 +1 @@ +{} diff --git a/snippets/snippets/responses/connector-delete.yaml b/snippets/snippets/responses/connector-delete.yaml new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/snippets/snippets/responses/connector-delete.yaml @@ -0,0 +1 @@ +{} diff --git a/snippets/snippets/responses/connector-get.yaml b/snippets/snippets/responses/connector-get.yaml new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/snippets/snippets/responses/connector-get.yaml @@ -0,0 +1 @@ +{} diff --git a/snippets/snippets/responses/connector-patch.yaml b/snippets/snippets/responses/connector-patch.yaml new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/snippets/snippets/responses/connector-patch.yaml @@ -0,0 +1 @@ +{} diff --git a/snippets/snippets/responses/connectors-id-oauth-authorize-post.yaml b/snippets/snippets/responses/connectors-id-oauth-authorize-post.yaml new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/snippets/snippets/responses/connectors-id-oauth-authorize-post.yaml @@ -0,0 +1 @@ +{} diff --git a/snippets/snippets/responses/connectors-list.yaml b/snippets/snippets/responses/connectors-list.yaml new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/snippets/snippets/responses/connectors-list.yaml @@ -0,0 +1 @@ +{} diff --git a/snippets/snippets/responses/dataset-get.yaml b/snippets/snippets/responses/dataset-get.yaml new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/snippets/snippets/responses/dataset-get.yaml @@ -0,0 +1 @@ +{} diff --git a/snippets/snippets/responses/dataset-post.yaml b/snippets/snippets/responses/dataset-post.yaml new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/snippets/snippets/responses/dataset-post.yaml @@ -0,0 +1 @@ +{} diff --git a/snippets/snippets/responses/dataset-usage-get.yaml b/snippets/snippets/responses/dataset-usage-get.yaml new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/snippets/snippets/responses/dataset-usage-get.yaml @@ -0,0 +1 @@ +{} diff --git a/snippets/snippets/responses/detokenize-post.yaml b/snippets/snippets/responses/detokenize-post.yaml new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/snippets/snippets/responses/detokenize-post.yaml @@ -0,0 +1 @@ +{} diff --git a/snippets/snippets/responses/embed-jobs-cancel.yaml b/snippets/snippets/responses/embed-jobs-cancel.yaml new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/snippets/snippets/responses/embed-jobs-cancel.yaml @@ -0,0 +1 @@ +{} diff --git a/snippets/snippets/responses/embed-jobs-get.yaml b/snippets/snippets/responses/embed-jobs-get.yaml new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/snippets/snippets/responses/embed-jobs-get.yaml @@ -0,0 +1 @@ +{} diff --git a/snippets/snippets/responses/embed-jobs-post.yaml b/snippets/snippets/responses/embed-jobs-post.yaml new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/snippets/snippets/responses/embed-jobs-post.yaml @@ -0,0 +1 @@ +{} diff --git a/snippets/snippets/responses/embed-post.yaml b/snippets/snippets/responses/embed-post.yaml new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/snippets/snippets/responses/embed-post.yaml @@ -0,0 +1 @@ +{} diff --git a/snippets/snippets/responses/emebed-jobs-get.yaml b/snippets/snippets/responses/emebed-jobs-get.yaml new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/snippets/snippets/responses/emebed-jobs-get.yaml @@ -0,0 +1 @@ +{} diff --git a/snippets/snippets/responses/finetuning/create-finetuned-model.yaml b/snippets/snippets/responses/finetuning/create-finetuned-model.yaml new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/snippets/snippets/responses/finetuning/create-finetuned-model.yaml @@ -0,0 +1 @@ +{} diff --git a/snippets/snippets/responses/finetuning/delete-finetuned-model.yaml b/snippets/snippets/responses/finetuning/delete-finetuned-model.yaml new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/snippets/snippets/responses/finetuning/delete-finetuned-model.yaml @@ -0,0 +1 @@ +{} diff --git a/snippets/snippets/responses/finetuning/get-finetuned-model.yaml b/snippets/snippets/responses/finetuning/get-finetuned-model.yaml new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/snippets/snippets/responses/finetuning/get-finetuned-model.yaml @@ -0,0 +1 @@ +{} diff --git a/snippets/snippets/responses/finetuning/list-events.yaml b/snippets/snippets/responses/finetuning/list-events.yaml new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/snippets/snippets/responses/finetuning/list-events.yaml @@ -0,0 +1 @@ +{} diff --git a/snippets/snippets/responses/finetuning/list-finetuned-models.yaml b/snippets/snippets/responses/finetuning/list-finetuned-models.yaml new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/snippets/snippets/responses/finetuning/list-finetuned-models.yaml @@ -0,0 +1 @@ +{} diff --git a/snippets/snippets/responses/finetuning/list-training-step-metrics.yaml b/snippets/snippets/responses/finetuning/list-training-step-metrics.yaml new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/snippets/snippets/responses/finetuning/list-training-step-metrics.yaml @@ -0,0 +1 @@ +{} diff --git a/snippets/snippets/responses/finetuning/update-finetuned-model.yaml b/snippets/snippets/responses/finetuning/update-finetuned-model.yaml new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/snippets/snippets/responses/finetuning/update-finetuned-model.yaml @@ -0,0 +1 @@ +{} diff --git a/snippets/snippets/responses/generate-post.yaml b/snippets/snippets/responses/generate-post.yaml new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/snippets/snippets/responses/generate-post.yaml @@ -0,0 +1 @@ +{} diff --git a/snippets/snippets/responses/models-list-get.yaml b/snippets/snippets/responses/models-list-get.yaml new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/snippets/snippets/responses/models-list-get.yaml @@ -0,0 +1 @@ +{} diff --git a/snippets/snippets/responses/rerank-post.yaml b/snippets/snippets/responses/rerank-post.yaml new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/snippets/snippets/responses/rerank-post.yaml @@ -0,0 +1 @@ +{} diff --git a/snippets/snippets/responses/summarize-post.yaml b/snippets/snippets/responses/summarize-post.yaml new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/snippets/snippets/responses/summarize-post.yaml @@ -0,0 +1 @@ +{} diff --git a/snippets/snippets/responses/tokenize-post.yaml b/snippets/snippets/responses/tokenize-post.yaml new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/snippets/snippets/responses/tokenize-post.yaml @@ -0,0 +1 @@ +{}