From 2da76e799ce9fc17ea403d62bac34aa3417fc1b7 Mon Sep 17 00:00:00 2001 From: platform-endpoints Date: Tue, 24 Sep 2024 12:54:25 +0000 Subject: [PATCH] Add spec changes Co-authored-by: billytrend-cohere <144115527+billytrend-cohere@users.noreply.github.com> --- cohere-openapi.yaml | 2826 +++++++++++++++-- snippets/snippets/curl/rerank-v2-post.sh | 15 + .../java/app/src/main/java/EmbedV2Post.java | 22 + .../java/app/src/main/java/RerankV2Post.java | 52 + .../app/src/main/java/chatpost/Default.java | 26 +- .../app/src/main/java/chatpost/Stream.java | 26 +- .../app/src/main/java/chatv2post/Default.java | 48 + .../src/main/java/chatv2post/Documents.java | 154 + .../app/src/main/java/chatv2post/Stream.java | 61 + .../app/src/main/java/chatv2post/Tools.java | 102 + snippets/snippets/node/embed-v2-post.ts | 14 + snippets/snippets/node/rerank-v2-post.ts | 30 + .../snippets/python/chat-v2-post/tools.py | 6 +- snippets/snippets/python/embed-v2-post.py | 8 + snippets/snippets/python/rerank-v2-post.py | 19 + 15 files changed, 3127 insertions(+), 282 deletions(-) create mode 100644 snippets/snippets/curl/rerank-v2-post.sh create mode 100644 snippets/snippets/java/app/src/main/java/EmbedV2Post.java create mode 100644 snippets/snippets/java/app/src/main/java/RerankV2Post.java create mode 100644 snippets/snippets/java/app/src/main/java/chatv2post/Default.java create mode 100644 snippets/snippets/java/app/src/main/java/chatv2post/Documents.java create mode 100644 snippets/snippets/java/app/src/main/java/chatv2post/Stream.java create mode 100644 snippets/snippets/java/app/src/main/java/chatv2post/Tools.java create mode 100644 snippets/snippets/node/embed-v2-post.ts create mode 100644 snippets/snippets/node/rerank-v2-post.ts create mode 100644 snippets/snippets/python/embed-v2-post.py create mode 100644 snippets/snippets/python/rerank-v2-post.py diff --git a/cohere-openapi.yaml b/cohere-openapi.yaml index a8af4120..50bff061 100644 --- a/cohere-openapi.yaml +++ b/cohere-openapi.yaml @@ -246,7 +246,7 @@ paths: import com.cohere.api.types.ChatMessage; - import com.cohere.api.types.ChatMessageRole; + import com.cohere.api.types.Message; import com.cohere.api.types.NonStreamedChatResponse; @@ -263,17 +263,19 @@ paths: .message("What year was he born?") .chatHistory( List.of( - ChatMessage.builder() - .role(ChatMessageRole.USER) - .message("Who discovered gravity?") - .build(), - ChatMessage.builder() - .role(ChatMessageRole.CHATBOT) - .message( - "The man who is widely credited" - + " with discovering gravity is" - + " Sir Isaac Newton") - .build())) + Message.user( + ChatMessage.builder() + .message("Who discovered gravity?") + .build()), + Message.chatbot( + ChatMessage.builder() + .message( + "The man who is widely" + + " credited with" + + " discovering gravity" + + " is Sir Isaac" + + " Newton") + .build()))) .build()); System.out.println(response); @@ -4980,10 +4982,10 @@ paths: import com.cohere.api.types.ChatMessage; - import com.cohere.api.types.ChatMessageRole; - import com.cohere.api.types.ChatTextGenerationEvent; + import com.cohere.api.types.Message; + import com.cohere.api.types.StreamedChatResponse; import java.util.List; @@ -4999,17 +5001,19 @@ paths: .message("What year was he born?") .chatHistory( List.of( - ChatMessage.builder() - .role(ChatMessageRole.USER) - .message("Who discovered gravity?") - .build(), - ChatMessage.builder() - .role(ChatMessageRole.CHATBOT) - .message( - "The man who is widely credited" - + " with discovering gravity is" - + " Sir Isaac Newton") - .build())) + Message.user( + ChatMessage.builder() + .message("Who discovered gravity?") + .build()), + Message.chatbot( + ChatMessage.builder() + .message( + "The man who is widely" + + " credited with" + + " discovering gravity" + + " is Sir Isaac" + + " Newton") + .build()))) .build()); for (StreamedChatResponse chatResponse : response) { @@ -6964,7 +6968,7 @@ paths: response = co.chat( model="command-r-plus", tools=[ - cohere.v2.Tool2(type='function', function={ + cohere.ToolV2(type='function', function={ "name": 'query_daily_sales_report', "description": 'Connects to a database to retrieve overall sales volumes and sales information for a given day.', "parameters": { @@ -6975,7 +6979,7 @@ paths: }, } }), - cohere.v2.Tool2(type='function', function={ + cohere.ToolV2(type='function', function={ "name": 'query_product_catalog', "description": 'Connects to a a product catalog with information about all the products being sold, including categories, prices, and stock levels.', "parameters": { @@ -6990,7 +6994,7 @@ paths: messages=[ { "role": "user", - "content":"Can you provide a sales summary for 29th September 2023, and also give me some details about the products in the 'Electronics' category, for example their prices and stock levels?" + "content": "Can you provide a sales summary for 29th September 2023, and also give me some details about the products in the 'Electronics' category, for example their prices and stock levels?" } ] ) @@ -9880,175 +9884,25 @@ paths: operationId: embedv2 parameters: - $ref: "#/components/parameters/RequestSource" - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: "#/components/schemas/EmbedByTypeResponse" - headers: - X-API-Warning: - schema: - type: string - x-fern-audiences: - - public - description: Warning description for incorrect usage of the API - "400": - $ref: "#/components/responses/BadRequest" - "401": - $ref: "#/components/responses/Unauthorized" - "403": - $ref: "#/components/responses/Forbidden" - "404": - $ref: "#/components/responses/NotFound" - "422": - $ref: "#/components/responses/UnprocessableEntity" - "429": - $ref: "#/components/responses/RateLimit" - "498": - $ref: "#/components/responses/InvalidToken" - "499": - $ref: "#/components/responses/RequestCancelled" - "500": - $ref: "#/components/responses/InternalServerError" - "501": - $ref: "#/components/responses/NotImplemented" - "503": - $ref: "#/components/responses/ServiceUnavailable" - "504": - $ref: "#/components/responses/GatewayTimeout" - description: |- - This endpoint returns text embeddings. An embedding is a list of floating point numbers that captures semantic information about the text that it represents. - - Embeddings can be used to create text classifiers as well as empower semantic search. To learn more about embeddings, see the embedding page. - - If you want to learn more how to use the embedding model, have a look at the [Semantic Search Guide](/docs/semantic-search). - requestBody: - content: - application/json: - schema: - type: object - x-fern-audiences: - - public - required: - - model - properties: - texts: - type: array - x-fern-audiences: - - public - minItems: 1 - maxItems: 96 - description: An array of strings for the model to embed. Maximum number of texts - per call is `96`. We recommend reducing the length of each - text to be under `512` tokens for optimal quality. - items: - type: string - x-fern-audiences: - - public - writeOnly: true - writeOnly: true - model: - type: string - x-fern-audiences: - - public - description: |- - Defaults to embed-english-v2.0 - - The identifier of the model. Smaller "light" models are faster, while larger models will perform better. [Custom models](/docs/training-custom-models) can also be supplied with their full ID. - - Available models and corresponding embedding dimensions: - - * `embed-english-v3.0` 1024 - * `embed-multilingual-v3.0` 1024 - * `embed-english-light-v3.0` 384 - * `embed-multilingual-light-v3.0` 384 - - * `embed-english-v2.0` 4096 - * `embed-english-light-v2.0` 1024 - * `embed-multilingual-v2.0` 768 - writeOnly: true - input_type: - x-fern-audiences: - - public - $ref: "#/components/schemas/EmbedInputType" - embedding_types: - type: array - x-fern-audiences: - - public - items: - $ref: "#/components/schemas/EmbeddingType" - description: |- - Specifies the types of embeddings you want to get back. Not required and default is None, which returns the Embed Floats response type. Can be one or more of the following types. - - * `"float"`: Use this when you want to get back the default float embeddings. Valid for all models. - * `"int8"`: Use this when you want to get back signed int8 embeddings. Valid for only v3 models. - * `"uint8"`: Use this when you want to get back unsigned int8 embeddings. Valid for only v3 models. - * `"binary"`: Use this when you want to get back signed binary embeddings. Valid for only v3 models. - * `"ubinary"`: Use this when you want to get back unsigned binary embeddings. Valid for only v3 models. - writeOnly: true - truncate: - type: string - x-fern-audiences: - - public - default: END - enum: - - NONE - - START - - END - description: |- - One of `NONE|START|END` to specify how the API will handle inputs longer than the maximum token length. - - Passing `START` will discard the start of the input. `END` will discard the end of the input. In both cases, input is discarded until the remaining input is exactly the maximum input token length for the model. - - If `NONE` is selected, when the input exceeds the maximum input token length an error will be returned. - writeOnly: true - description: "" - /v1/embed-jobs: - post: - x-fern-audiences: - - public - parameters: - - $ref: "#/components/parameters/RequestSource" - summary: Create an Embed Job - operationId: create-embed-job - tags: - - /embed-jobs - x-fern-sdk-group-name: embed-jobs - x-fern-sdk-method-name: create x-fern-examples: - code-samples: - - sdk: go - name: Cohere Go SDK + - sdk: typescript + name: Cohere TypeScript SDK 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, - }, - ) + const { CohereClient } = require('cohere-ai'); - if err != nil { - log.Fatal(err) - } + const cohere = new CohereClient({ + token: '<>', + }); - log.Printf("%+v", resp) - } + (async () => { + const embed = await cohere.v2.embed({ + texts: ['hello', 'goodbye'], + model: 'embed-english-v3.0', + inputType: 'classification', + }); + console.log(embed); + })(); - sdk: python name: Sync code: > @@ -10058,93 +9912,2376 @@ paths: 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" + response = co.embed( + texts=["hello", "goodbye"], model="embed-english-v3.0", input_type="classification" ) - - # poll the server until the job is complete - - response = co.wait(job) - - print(response) - sdk: python name: Async - code: > - import cohere - - import asyncio - - - 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) - - print(response) - - asyncio.run(main()) + code: + $ref: ./snippets/python-async/embed-v2-post.py - sdk: java name: Cohere java SDK code: > import com.cohere.api.Cohere; - import - com.cohere.api.resources.embedjobs.requests.CreateEmbedJobRequest; - - import com.cohere.api.types.CreateEmbedJobResponse; + import com.cohere.api.requests.EmbedRequest; import com.cohere.api.types.EmbedInputType; + import com.cohere.api.types.EmbedResponse; - public class EmbedJobsPost { + import java.util.List; + + + + public class EmbedPost { 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()); + 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: typescript - name: Cohere TypeScript SDK - code: | - const { CohereClient } = require('cohere-ai'); - - const cohere = new CohereClient({ - token: '<>', - }); - - (async () => { - const embedJob = await cohere.embedJobs.create({ - datasetId: 'my-dataset', - inputType: 'search_document', - model: 'embed-english-v3.0', - }); - - console.log(embedJob); - })(); - sdk: 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 '{ + code: + $ref: ./snippets/curl/embed-v2-post.sh + request: + texts: + - hello + - goodbye + model: embed-english-v3.0 + input_type: classification + response: + body: + id: 1c62213a-1f15-46f1-ac62-36f6bbaf3972 + texts: + - hello + - goodbye + embeddings: + - - 0.016296387 + - -0.008354187 + - -0.04699707 + - -0.07104492 + - 0.00013196468 + - -0.014892578 + - -0.018661499 + - 0.019134521 + - 0.008476257 + - 0.04159546 + - -0.036895752 + - -0.00048303604 + - 0.06414795 + - -0.036346436 + - 0.045806885 + - -0.03125 + - 0.03793335 + - 0.048583984 + - 0.0062179565 + - 0.0071144104 + - -0.020935059 + - 0.04196167 + - -0.039398193 + - 0.03463745 + - 0.051879883 + - 0.030838013 + - -0.0048103333 + - -0.00036287308 + - -0.017944336 + - -0.039611816 + - 0.013389587 + - 0.0044021606 + - 0.018951416 + - 0.020767212 + - -0.0025997162 + - 0.0904541 + - -0.0121154785 + - -0.026184082 + - 0.012413025 + - 0.004119873 + - 0.030654907 + - -0.030792236 + - -0.041107178 + - -0.02368164 + - -0.043304443 + - -0.00077438354 + - -0.017074585 + - -0.019729614 + - 0.078125 + - -0.031585693 + - 0.020217896 + - -0.01524353 + - 0.017471313 + - -0.0008010864 + - -0.03717041 + - 0.011062622 + - -0.072143555 + - -0.013175964 + - 0.01058197 + - 0.030853271 + - 0.044799805 + - 0.0045928955 + - 0.03253174 + - 0.047698975 + - -0.0039024353 + - -0.01965332 + - 0.024475098 + - -0.013755798 + - 0.018951416 + - -0.015487671 + - 0.015594482 + - 0.00096321106 + - -0.006450653 + - -0.04748535 + - -0.021972656 + - 0.06323242 + - -0.009498596 + - 0.014297485 + - 0.0038471222 + - -0.023117065 + - -0.02180481 + - -0.01928711 + - -0.08758545 + - -0.04852295 + - 0.029510498 + - 0.011276245 + - -0.013504028 + - -0.009391785 + - -0.0064468384 + - 0.010978699 + - -0.014404297 + - 0.053741455 + - 0.046569824 + - 0.00042700768 + - -0.037719727 + - 0.011985779 + - -0.009643555 + - 0.0067749023 + - 0.008071899 + - 0.018829346 + - -0.05419922 + - -0.020950317 + - -0.02659607 + - -0.028869629 + - -0.015716553 + - 0.022705078 + - -0.0046958923 + - 0.02192688 + - 0.032440186 + - 0.048034668 + - -0.006843567 + - 0.045074463 + - -0.02293396 + - 0.010238647 + - -0.04534912 + - 0.01638794 + - -0.00680542 + - 0.0038871765 + - -0.032836914 + - 0.051361084 + - 0.0395813 + - 0.032928467 + - -0.00843811 + - 0.007858276 + - -0.040802002 + - -0.008346558 + - -0.013252258 + - -0.046173096 + - 0.051727295 + - -0.027175903 + - -0.011497498 + - 0.04940796 + - -0.095214844 + - -0.0345459 + - -0.021453857 + - 0.0051002502 + - -0.01725769 + - -0.045196533 + - -0.0016956329 + - 0.021575928 + - 0.07720947 + - -0.00094270706 + - 0.020904541 + - 0.05001831 + - -0.033111572 + - 0.032287598 + - -0.0052833557 + - -0.00007402897 + - 0.035125732 + - 0.019424438 + - -0.06665039 + - -0.02557373 + - 0.010887146 + - 0.05807495 + - 0.015022278 + - 0.0657959 + - -0.015350342 + - 0.008468628 + - -0.017944336 + - 0.029388428 + - -0.005126953 + - 0.015914917 + - 0.051879883 + - -0.015975952 + - -0.039031982 + - -0.012374878 + - 0.0032424927 + - 0.0008568764 + - 0.014579773 + - 0.021530151 + - -0.0061912537 + - 0.028717041 + - 0.046844482 + - 0.032836914 + - 0.0071372986 + - -0.023406982 + - -0.03717041 + - 0.016723633 + - 0.03994751 + - 0.025390625 + - 0.03427124 + - -0.01914978 + - -0.026000977 + - 0.07342529 + - -0.03213501 + - -0.058258057 + - 0.029144287 + - 0.001042366 + - 0.030517578 + - 0.011474609 + - 0.058410645 + - 0.005027771 + - -0.038635254 + - -0.015029907 + - -0.015655518 + - -0.03918457 + - -0.016342163 + - -0.020858765 + - -0.0043907166 + - 0.03857422 + - 0.007423401 + - -0.0473938 + - 0.04257202 + - -0.043823242 + - -0.03842163 + - -0.033691406 + - -0.010925293 + - 0.012260437 + - 0.0009822845 + - 0.0058937073 + - -0.008644104 + - -0.031585693 + - 0.0055618286 + - -0.06976318 + - -0.030578613 + - -0.038970947 + - -0.08880615 + - -0.00315094 + - 0.00020766258 + - 0.04058838 + - 0.0028266907 + - -0.0018129349 + - -0.01625061 + - -0.022277832 + - -0.008956909 + - -0.009292603 + - -0.040771484 + - -0.008705139 + - -0.065979004 + - -0.010414124 + - -0.0152282715 + - 0.033447266 + - -0.033599854 + - -0.008049011 + - -0.020828247 + - 0.0053901672 + - 0.0002875328 + - 0.037078857 + - 0.015159607 + - -0.0016326904 + - 0.012397766 + - 0.0026817322 + - -0.032196045 + - -0.0079422 + - 0.03567505 + - -0.0010242462 + - 0.03652954 + - -0.0035171509 + - 0.01802063 + - 0.026641846 + - 0.0107421875 + - -0.021942139 + - 0.035095215 + - -0.0236969 + - -0.015975952 + - 0.039215088 + - 0.0038166046 + - 0.020462036 + - -0.039764404 + - 0.035888672 + - -0.038604736 + - -0.008621216 + - -0.012619019 + - -0.014602661 + - -0.036102295 + - -0.02368164 + - -0.0121536255 + - -0.0054512024 + - -0.015701294 + - -0.016296387 + - 0.016433716 + - -0.005672455 + - -0.019332886 + - 0.00025129318 + - 0.0803833 + - 0.04248047 + - -0.05960083 + - -0.009147644 + - -0.0021247864 + - 0.012481689 + - -0.015129089 + - -0.021133423 + - -0.01878357 + - 0.0027332306 + - 0.036956787 + - -0.0053253174 + - -0.0007238388 + - 0.016983032 + - -0.0034694672 + - 0.059387207 + - 0.076660156 + - 0.015312195 + - -0.015823364 + - 0.02456665 + - 0.012901306 + - 0.020126343 + - -0.032440186 + - 0.011291504 + - -0.001876831 + - -0.052215576 + - 0.004634857 + - 0.036956787 + - 0.006164551 + - -0.023422241 + - -0.025619507 + - 0.024261475 + - 0.023849487 + - 0.015007019 + - 0.020050049 + - -0.044067383 + - 0.030029297 + - 0.021377563 + - 0.011657715 + - 0.017196655 + - -0.032318115 + - -0.031555176 + - -0.00982666 + - -0.0039787292 + - -0.079589844 + - -0.006416321 + - 0.00844574 + - -0.007434845 + - -0.045013428 + - -0.02557373 + - -0.01537323 + - 0.027633667 + - -0.076538086 + - -0.0025749207 + - -0.05279541 + - 0.029373169 + - 0.047912598 + - 0.00083875656 + - -0.01234436 + - -0.017059326 + - 0.01159668 + - 0.014228821 + - 0.029571533 + - -0.055114746 + - 0.006389618 + - 0.028869629 + - 0.09375 + - -0.014251709 + - 0.029418945 + - 0.007633209 + - 0.010848999 + - -0.004055023 + - -0.02116394 + - 0.007194519 + - -0.0062217712 + - -0.01209259 + - 0.024749756 + - -0.037506104 + - -0.029510498 + - -0.028442383 + - 0.03189087 + - 0.0008239746 + - 0.007419586 + - -0.016723633 + - 0.06964111 + - -0.07232666 + - 0.022201538 + - -0.019882202 + - -0.0385437 + - -0.022567749 + - 0.010353088 + - -0.027755737 + - -0.006713867 + - -0.023406982 + - -0.025054932 + - -0.013076782 + - 0.015808105 + - -0.0073165894 + - 0.02949524 + - -0.036499023 + - -0.07287598 + - -0.01876831 + - -0.02709961 + - -0.06567383 + - 0.050567627 + - 0.004047394 + - 0.030471802 + - 0.025405884 + - 0.046783447 + - 0.01763916 + - 0.053466797 + - 0.049072266 + - -0.015197754 + - 0.0013389587 + - 0.049591064 + - 0.006965637 + - -0.00014233589 + - 0.01335907 + - -0.04675293 + - -0.026733398 + - 0.03024292 + - 0.0012464523 + - -0.037200928 + - 0.030166626 + - -0.08544922 + - -0.013893127 + - -0.014823914 + - 0.0014219284 + - -0.023620605 + - -0.0010480881 + - -0.072387695 + - 0.057922363 + - -0.04067993 + - -0.025299072 + - 0.020446777 + - 0.06451416 + - 0.007205963 + - 0.015838623 + - -0.008674622 + - 0.0002270937 + - -0.026321411 + - 0.027130127 + - -0.01828003 + - -0.011482239 + - 0.03463745 + - 0.00724411 + - -0.010406494 + - 0.025268555 + - -0.023651123 + - 0.04034424 + - -0.036834717 + - 0.05014038 + - -0.026184082 + - 0.036376953 + - 0.03253174 + - -0.01828003 + - -0.023376465 + - -0.034576416 + - -0.00598526 + - -0.023239136 + - -0.032409668 + - 0.07672119 + - -0.038604736 + - 0.056884766 + - -0.012550354 + - -0.03778076 + - -0.013061523 + - 0.017105103 + - 0.010482788 + - -0.005077362 + - -0.010719299 + - -0.018661499 + - 0.019760132 + - 0.022018433 + - -0.058746338 + - 0.03564453 + - -0.0892334 + - 0.025421143 + - -0.015716553 + - 0.07910156 + - -0.009361267 + - 0.016921997 + - 0.048736572 + - 0.035247803 + - 0.01864624 + - 0.011413574 + - 0.018295288 + - 0.00052690506 + - -0.07122803 + - -0.01890564 + - -0.017669678 + - 0.027694702 + - 0.0152282715 + - 0.006511688 + - -0.045837402 + - -0.009765625 + - 0.013877869 + - -0.0146102905 + - 0.033294678 + - -0.0019874573 + - 0.023040771 + - 0.025619507 + - -0.015823364 + - -0.020858765 + - -0.023529053 + - 0.0070152283 + - -0.0647583 + - 0.036224365 + - 0.0023403168 + - -0.062286377 + - -0.036315918 + - 0.021209717 + - -0.037353516 + - -0.03656006 + - 0.01889038 + - 0.023239136 + - 0.011764526 + - 0.005970001 + - 0.049346924 + - -0.006893158 + - -0.015068054 + - -0.0008716583 + - -0.0034999847 + - 0.04034424 + - 0.017913818 + - -0.06707764 + - -0.07531738 + - 0.00042319298 + - -0.00680542 + - -0.0023174286 + - 0.04425049 + - -0.05105591 + - -0.016967773 + - 0.020507812 + - 0.038604736 + - 0.029846191 + - 0.04309082 + - -0.00084733963 + - -0.008911133 + - 0.0082092285 + - -0.0050239563 + - 0.05038452 + - 0.014595032 + - 0.015182495 + - 0.007247925 + - -0.04046631 + - -0.011169434 + - -0.010292053 + - 0.068603516 + - 0.02470398 + - -0.0023403168 + - 0.005996704 + - -0.0010709763 + - 0.008178711 + - -0.029205322 + - -0.025253296 + - 0.05822754 + - 0.04269409 + - 0.059295654 + - -0.0011911392 + - -0.031311035 + - 0.023712158 + - -0.037506104 + - 0.004589081 + - 0.014923096 + - -0.019866943 + - -0.019180298 + - -0.0020999908 + - -0.008972168 + - 0.01348114 + - 0.014801025 + - -0.02645874 + - 0.019897461 + - 0.081970215 + - -0.05822754 + - 0.09399414 + - 0.001209259 + - -0.050750732 + - 0.062316895 + - -0.014892578 + - -0.019104004 + - -0.036987305 + - -0.040618896 + - -0.008163452 + - -0.0035247803 + - 0.06774902 + - -0.001420021 + - -0.0013103485 + - -0.031799316 + - -0.0023651123 + - 0.012298584 + - 0.003583908 + - 0.050964355 + - -0.01802063 + - -0.007091522 + - 0.01448822 + - -0.016159058 + - -0.019439697 + - -0.022491455 + - -0.036346436 + - -0.03491211 + - -0.0032920837 + - 0.003528595 + - -0.0016469955 + - 0.01612854 + - -0.003709793 + - 0.012840271 + - 0.0043182373 + - -0.030456543 + - 0.007369995 + - 0.0039787292 + - 0.036499023 + - 0.021362305 + - 0.00062942505 + - 0.0047073364 + - 0.026382446 + - -0.0020542145 + - -0.038757324 + - -0.00095272064 + - 0.0019435883 + - 0.007232666 + - -0.0031471252 + - 0.019943237 + - -0.062042236 + - 0.010826111 + - 0.0026607513 + - -0.04727173 + - 0.020126343 + - 0.046417236 + - -0.03881836 + - 0.011222839 + - 0.011428833 + - -0.056396484 + - 0.010879517 + - -0.011772156 + - -0.0038414001 + - 0.010246277 + - -0.020141602 + - -0.011169434 + - 0.006916046 + - -0.022659302 + - 0.010299683 + - 0.046966553 + - 0.0234375 + - -0.0016288757 + - -0.03262329 + - -0.01689148 + - -0.00031924248 + - 0.028152466 + - 0.004234314 + - 0.03878784 + - -0.03579712 + - 0.007457733 + - -0.0036907196 + - 0.0073051453 + - -0.00028276443 + - -0.0067100525 + - 0.003206253 + - -0.0021209717 + - -0.05960083 + - 0.024337769 + - 0.076171875 + - -0.012062073 + - -0.0032787323 + - -0.08380127 + - 0.024917603 + - 0.019073486 + - -0.012031555 + - -0.03237915 + - -0.0042686462 + - -0.01525116 + - -0.0158844 + - -0.0014514923 + - -0.024429321 + - -0.028442383 + - 0.020843506 + - 0.007133484 + - 0.024230957 + - 0.0002002716 + - -0.005466461 + - -0.0032367706 + - 0.012718201 + - 0.032806396 + - 0.062042236 + - -0.040283203 + - -0.025497437 + - 0.045013428 + - 0.054473877 + - -0.033599854 + - -0.0039482117 + - 0.02268982 + - -0.0012645721 + - 0.045166016 + - 0.0501709 + - -0.0022602081 + - 0.019897461 + - 0.007926941 + - 0.017364502 + - 0.011650085 + - -0.042510986 + - -0.059448242 + - 0.030014038 + - 0.039611816 + - 0.015571594 + - 0.04031372 + - -0.0006723404 + - -0.03353882 + - -0.05569458 + - 0.040283203 + - 0.019058228 + - -0.032592773 + - 0.004470825 + - 0.06359863 + - 0.029693604 + - 0.01826477 + - -0.0104522705 + - -0.043945312 + - -0.01802063 + - 0.0075187683 + - -0.02456665 + - 0.02798462 + - 0.0047340393 + - -0.017623901 + - -0.014335632 + - -0.04550171 + - -0.0039711 + - 0.023864746 + - -0.015281677 + - 0.055755615 + - -0.04864502 + - 0.033599854 + - 0.024810791 + - -0.03048706 + - -0.043121338 + - 0.011291504 + - 0.024932861 + - -0.0020275116 + - 0.032287598 + - -0.0234375 + - 0.006942749 + - -0.007221222 + - -0.03869629 + - -0.03765869 + - -0.03475952 + - -0.046936035 + - 0.03012085 + - -0.021362305 + - -0.023452759 + - 0.051239014 + - -0.009925842 + - 0.04925537 + - -0.00944519 + - -0.040008545 + - -0.019485474 + - -0.00022566319 + - -0.017028809 + - 0.03277588 + - 0.0066375732 + - -0.013328552 + - 0.01864624 + - -0.011726379 + - 0.023849487 + - 0.04006958 + - 0.03793335 + - 0.060821533 + - 0.005504608 + - -0.0395813 + - -0.010131836 + - 0.046539307 + - 0.030136108 + - 0.002231598 + - 0.042236328 + - 0.014755249 + - 0.047058105 + - -0.017318726 + - 0.008598328 + - 0.01966858 + - 0.0064430237 + - 0.03616333 + - -0.011985779 + - -0.003446579 + - -0.06616211 + - -0.0657959 + - 0.014137268 + - 0.044677734 + - -0.03515625 + - -0.05215454 + - -0.012710571 + - 0.0047416687 + - 0.05368042 + - 0.013900757 + - 0.05001831 + - 0.027709961 + - 0.02557373 + - -0.025512695 + - 0.0031032562 + - 0.072143555 + - 0.018829346 + - 0.0073928833 + - 0.009269714 + - -0.011299133 + - 0.0048828125 + - 0.014808655 + - -0.0184021 + - -0.00089359283 + - -0.0015716553 + - -0.012863159 + - 0.0074386597 + - -0.020767212 + - 0.02204895 + - -0.027404785 + - -0.021972656 + - 0.02494812 + - 0.044006348 + - -0.011581421 + - 0.06298828 + - 0.009010315 + - 0.03842163 + - -0.00005555153 + - 0.06774902 + - 0.036254883 + - -0.016311646 + - -0.000004887581 + - 0.0057373047 + - 0.03704834 + - -0.041503906 + - 0.0074043274 + - -0.012290955 + - -0.020263672 + - -0.0057792664 + - -0.025878906 + - -0.021652222 + - -0.008079529 + - 0.022613525 + - -0.012069702 + - 0.050079346 + - -0.004283905 + - -0.021118164 + - -0.010559082 + - -0.0041160583 + - -0.00026345253 + - -0.01260376 + - 0.050628662 + - -0.03137207 + - 0.027526855 + - -0.052642822 + - -0.0046463013 + - 0.04937744 + - -0.0017156601 + - 0.014625549 + - -0.022476196 + - 0.02571106 + - 0.043884277 + - -0.016952515 + - -0.021011353 + - 0.056396484 + - 0.056762695 + - 0.013473511 + - -0.02357483 + - 0.043792725 + - 0.032470703 + - -0.052612305 + - -0.017837524 + - -0.000067055225 + - 0.039276123 + - -0.012283325 + - -0.0029888153 + - -0.024719238 + - 0.012870789 + - -0.032287598 + - 0.028839111 + - 0.008056641 + - 0.011100769 + - -0.034210205 + - 0.028198242 + - 0.01940918 + - 0.029052734 + - 0.030303955 + - 0.03475952 + - -0.03982544 + - 0.026870728 + - 0.02079773 + - 0.03012085 + - -0.044281006 + - 0.006462097 + - -0.008705139 + - -0.024734497 + - 0.02458191 + - -0.050201416 + - -0.028778076 + - 0.036956787 + - 0.025634766 + - -0.025650024 + - 0.020629883 + - -0.04385376 + - 0.009536743 + - -0.0027256012 + - 0.031158447 + - 0.008712769 + - -0.039855957 + - -0.018249512 + - -0.011268616 + - 0.009689331 + - -0.032073975 + - 0.023010254 + - 0.04925537 + - 0.013168335 + - 0.02734375 + - 0.031707764 + - -0.024032593 + - -0.010604858 + - -0.00258255 + - 0.0054092407 + - 0.033569336 + - 0.0068359375 + - 0.019882202 + - 0.018096924 + - -0.05392456 + - -0.0030059814 + - -0.01374054 + - -0.008483887 + - 0.016494751 + - -0.015487671 + - 0.016143799 + - -0.028198242 + - -0.016326904 + - -0.013160706 + - -0.046905518 + - 0.026428223 + - -0.02420044 + - -0.022262573 + - 0.041748047 + - 0.05557251 + - -0.0044059753 + - -0.030960083 + - -0.023544312 + - 0.0103302 + - -0.013534546 + - -0.016830444 + - 0.028167725 + - 0.0061950684 + - 0.02178955 + - -0.06945801 + - -0.040039062 + - -0.0024642944 + - -0.06359863 + - -0.020812988 + - 0.029006958 + - 0.0072364807 + - -0.028747559 + - -0.057891846 + - 0.022155762 + - -0.035369873 + - -0.025909424 + - -0.04095459 + - 0.0019893646 + - -0.0038146973 + - -0.030639648 + - -0.038970947 + - -0.0026626587 + - -0.0047454834 + - -0.014816284 + - 0.008575439 + - -0.032165527 + - -0.011062622 + - 0.003622055 + - -0.0129852295 + - -0.0007658005 + - -0.009902954 + - 0.03704834 + - -0.02456665 + - 0.020385742 + - 0.0019044876 + - -0.008552551 + - -0.028137207 + - -0.006500244 + - 0.017227173 + - -0.0077285767 + - -0.05496216 + - 0.038024902 + - -0.0335083 + - 0.047668457 + - -0.02998352 + - -0.0395813 + - -0.0068359375 + - -0.024627686 + - -0.005756378 + - 0.025863647 + - 0.032104492 + - -0.029022217 + - -0.08685303 + - -0.014724731 + - -0.035583496 + - 0.024002075 + - 0.008422852 + - 0.012931824 + - -0.0055656433 + - -0.013748169 + - -0.021530151 + - -0.034332275 + - -0.008766174 + - -0.025222778 + - 0.019836426 + - -0.011619568 + - -0.037963867 + - 0.013519287 + - -0.035736084 + - 0.049102783 + - -0.011398315 + - 0.050598145 + - -0.066833496 + - 0.080566406 + - -0.061553955 + - -0.041778564 + - 0.01864624 + - 0.014907837 + - -0.010482788 + - 0.035217285 + - -0.0473938 + - -0.031951904 + - 0.052886963 + - -0.022109985 + - 0.031677246 + - -0.01977539 + - 0.08282471 + - 0.012901306 + - -0.009490967 + - 0.0030956268 + - 0.023895264 + - 0.012611389 + - -0.0011844635 + - -0.007633209 + - 0.019195557 + - -0.05404663 + - 0.006187439 + - -0.06762695 + - -0.049468994 + - 0.028121948 + - -0.004032135 + - -0.043151855 + - 0.028121948 + - -0.0058555603 + - 0.019454956 + - 0.0028438568 + - -0.0036354065 + - -0.015411377 + - -0.026535034 + - 0.03704834 + - -0.01802063 + - 0.009765625 + - - 0.04663086 + - -0.023239136 + - 0.008163452 + - -0.03945923 + - -0.018051147 + - -0.011123657 + - 0.0022335052 + - -0.0015516281 + - -0.002336502 + - 0.031799316 + - -0.049591064 + - -0.049835205 + - 0.019317627 + - -0.013328552 + - -0.01838684 + - -0.067871094 + - 0.02671814 + - 0.038085938 + - 0.03265381 + - -0.0043907166 + - 0.026321411 + - 0.0070114136 + - -0.037628174 + - 0.008026123 + - 0.015525818 + - 0.066589355 + - -0.018005371 + - -0.0017309189 + - -0.052368164 + - -0.055511475 + - -0.00504303 + - 0.043029785 + - -0.013328552 + - 0.08581543 + - -0.038269043 + - 0.051971436 + - -0.04675293 + - 0.038146973 + - 0.05328369 + - -0.028762817 + - 0.01625061 + - -0.008644104 + - -0.060150146 + - -0.0259552 + - -0.05432129 + - -0.00680542 + - -0.012649536 + - 0.0025501251 + - 0.060272217 + - -0.013168335 + - 0.046691895 + - 0.030395508 + - 0.039733887 + - 0.00044679642 + - -0.034240723 + - 0.01828003 + - -0.047546387 + - -0.036499023 + - 0.024505615 + - 0.027374268 + - 0.015197754 + - -0.003932953 + - 0.03475952 + - 0.013633728 + - 0.020858765 + - -0.025344849 + - -0.056732178 + - 0.008178711 + - 0.043304443 + - 0.014625549 + - -0.0020503998 + - -0.033569336 + - -0.00178051 + - -0.0446167 + - -0.045837402 + - 0.089538574 + - 0.00440979 + - 0.03741455 + - 0.0015287399 + - -0.035339355 + - 0.017654419 + - -0.008956909 + - -0.035064697 + - -0.014251709 + - 0.008331299 + - 0.0077781677 + - 0.0020999908 + - -0.021636963 + - -0.014625549 + - -0.0209198 + - -0.009429932 + - 0.070617676 + - 0.013923645 + - -0.025558472 + - -0.0519104 + - -0.0049552917 + - 0.000998497 + - -0.01448822 + - -0.027175903 + - -0.04083252 + - -0.032043457 + - -0.0096588135 + - -0.047088623 + - -0.0012331009 + - -0.025878906 + - 0.031799316 + - -0.023712158 + - 0.015701294 + - 0.017730713 + - 0.062927246 + - 0.009178162 + - -0.046295166 + - -0.014701843 + - -0.007751465 + - -0.021148682 + - 0.033966064 + - -0.013664246 + - 0.03945923 + - -0.02520752 + - 0.08905029 + - -0.039520264 + - -0.012435913 + - -0.057403564 + - 0.007068634 + - 0.006061554 + - -0.040161133 + - -0.015548706 + - 0.080078125 + - 0.08862305 + - 0.008003235 + - -0.048339844 + - 0.037750244 + - -0.04498291 + - -0.065979004 + - -0.032470703 + - -0.03225708 + - 0.004890442 + - -0.013023376 + - -0.020965576 + - 0.035095215 + - 0.035491943 + - -0.01486969 + - 0.027023315 + - 0.009552002 + - -0.01285553 + - 0.044891357 + - 0.00062322617 + - -0.030639648 + - 0.024108887 + - 0.0035648346 + - -0.06585693 + - -0.011070251 + - 0.037506104 + - 0.05697632 + - -0.027236938 + - 0.03475952 + - 0.0143585205 + - -0.014442444 + - -0.011405945 + - -0.013648987 + - -0.028625488 + - 0.024902344 + - 0.09387207 + - -0.012741089 + - -0.040985107 + - -0.018814087 + - 0.0046920776 + - -0.017715454 + - 0.013839722 + - 0.0022621155 + - 0.0024433136 + - -0.028366089 + - -0.0046310425 + - 0.028717041 + - -0.00013160706 + - 0.006690979 + - -0.053863525 + - 0.03302002 + - 0.040802002 + - 0.03201294 + - 0.032073975 + - -0.03125 + - -0.005241394 + - 0.048828125 + - -0.016204834 + - -0.0014667511 + - -0.013572693 + - 0.007949829 + - 0.019744873 + - -0.004776001 + - -0.0022506714 + - 0.033111572 + - 0.00039958954 + - 0.008369446 + - -0.021057129 + - -0.033935547 + - -0.03692627 + - 0.0042762756 + - -0.030380249 + - -0.01876831 + - -0.023529053 + - 0.004764557 + - 0.026947021 + - -0.013267517 + - -0.023666382 + - 0.0024929047 + - -0.017990112 + - 0.035217285 + - 0.0034389496 + - 0.030380249 + - 0.02015686 + - -0.013061523 + - -0.047790527 + - 0.042633057 + - 0.009559631 + - -0.03186035 + - -0.02796936 + - -0.0151901245 + - -0.0039482117 + - 0.0345459 + - -0.018096924 + - 0.012062073 + - -0.02180481 + - 0.031402588 + - 0.041412354 + - -0.052459717 + - 0.006286621 + - -0.033203125 + - -0.0013237 + - -0.012466431 + - -0.041748047 + - 0.027313232 + - -0.0284729 + - -0.05682373 + - -0.02809143 + - 0.030899048 + - 0.023773193 + - 0.044677734 + - -0.0064353943 + - -0.0000064373016 + - 0.011512756 + - 0.0028190613 + - -0.041870117 + - -0.028182983 + - 0.014595032 + - -0.0143966675 + - 0.022949219 + - -0.004371643 + - 0.01461792 + - 0.0035171509 + - 0.01398468 + - -0.04473877 + - 0.04232788 + - -0.033599854 + - -0.000647068 + - 0.034606934 + - 0.006160736 + - -0.014640808 + - 0.028137207 + - -0.02470398 + - 0.0043563843 + - 0.00039553642 + - -0.039886475 + - 0.014251709 + - -0.035736084 + - -0.021347046 + - -0.029663086 + - -0.011688232 + - -0.038085938 + - -0.0034008026 + - 0.029144287 + - -0.010948181 + - -0.024978638 + - 0.009468079 + - 0.093933105 + - 0.014205933 + - -0.08569336 + - -0.011657715 + - 0.02027893 + - 0.0063095093 + - -0.0035533905 + - 0.020446777 + - 0.029968262 + - -0.002008438 + - 0.03253174 + - 0.029891968 + - 0.019577026 + - -0.002922058 + - -0.009994507 + - 0.029418945 + - 0.049987793 + - 0.046295166 + - -0.0072898865 + - 0.019638062 + - 0.042816162 + - 0.0066108704 + - 0.06591797 + - 0.04714966 + - -0.026062012 + - -0.019470215 + - 0.009979248 + - 0.018081665 + - 0.000009059906 + - -0.043060303 + - -0.0043907166 + - 0.064331055 + - 0.051605225 + - -0.0040893555 + - 0.018081665 + - -0.024749756 + - -0.014915466 + - -0.048614502 + - 0.023483276 + - 0.013282776 + - -0.011741638 + - -0.036346436 + - -0.0076293945 + - 0.023086548 + - -0.051849365 + - 0.023223877 + - 0.033721924 + - -0.003929138 + - -0.044647217 + - 0.020019531 + - -0.029678345 + - -0.0031986237 + - 0.030548096 + - -0.040161133 + - -0.020874023 + - 0.028793335 + - 0.037872314 + - 0.011314392 + - -0.030838013 + - -0.051818848 + - -0.007774353 + - 0.0070724487 + - 0.02507019 + - -0.0112838745 + - 0.014930725 + - 0.010543823 + - 0.085998535 + - 0.019332886 + - 0.0107803345 + - 0.00014901161 + - 0.001613617 + - -0.024993896 + - -0.04940796 + - 0.010643005 + - 0.04269409 + - -0.02571106 + - 0.001124382 + - -0.018844604 + - -0.014953613 + - 0.027786255 + - 0.033447266 + - 0.0038719177 + - 0.011268616 + - 0.004295349 + - 0.028656006 + - -0.078063965 + - -0.012619019 + - -0.03527832 + - -0.061279297 + - 0.0625 + - 0.038116455 + - -0.008308411 + - -0.017913818 + - 0.031311035 + - -0.018722534 + - 0.0362854 + - -0.019363403 + - 0.021362305 + - -0.0029010773 + - -0.030288696 + - -0.07293701 + - 0.008544922 + - 0.006755829 + - -0.068237305 + - 0.0491333 + - 0.016494751 + - -0.021621704 + - 0.020980835 + - 0.026443481 + - 0.051879883 + - 0.035583496 + - 0.030548096 + - -0.03366089 + - -0.017532349 + - 0.066101074 + - 0.03930664 + - 0.013633728 + - -0.008621216 + - 0.031982422 + - -0.042388916 + - -0.00042247772 + - -0.020492554 + - 0.04006958 + - 0.052825928 + - -0.0044136047 + - -0.02243042 + - -0.04260254 + - 0.02418518 + - -0.020584106 + - -0.0027770996 + - -0.05908203 + - 0.026611328 + - -0.046051025 + - -0.03451538 + - 0.017944336 + - 0.054260254 + - 0.019348145 + - 0.0070114136 + - 0.014205933 + - -0.019454956 + - -0.021514893 + - 0.010383606 + - 0.050109863 + - 0.020584106 + - -0.031677246 + - -0.048187256 + - 0.01449585 + - 0.04650879 + - 0.025222778 + - 0.004135132 + - 0.02017212 + - 0.044311523 + - -0.03427124 + - -0.023757935 + - 0.03479004 + - -0.012031555 + - -0.030380249 + - -0.021560669 + - -0.010375977 + - -0.05041504 + - -0.060821533 + - 0.012283325 + - -0.026367188 + - 0.061920166 + - 0.026367188 + - -0.037078857 + - -0.015136719 + - 0.033355713 + - -0.010055542 + - 0.025314331 + - -0.027893066 + - -0.010032654 + - 0.017684937 + - -0.00002783537 + - -0.061157227 + - 0.030273438 + - -0.103759766 + - 0.035583496 + - -0.028167725 + - 0.07171631 + - -0.0211792 + - -0.013725281 + - 0.04437256 + - 0.041137695 + - 0.027145386 + - 0.032073975 + - 0.008926392 + - -0.021560669 + - 0.007381439 + - 0.019165039 + - 0.0012969971 + - -0.01928711 + - 0.026672363 + - -0.01222229 + - -0.056365967 + - 0.010398865 + - -0.02255249 + - 0.00093221664 + - -0.009353638 + - 0.016082764 + - 0.022872925 + - 0.025024414 + - -0.024459839 + - 0.040618896 + - -0.049224854 + - -0.0035133362 + - -0.047698975 + - 0.01727295 + - 0.034057617 + - -0.004096985 + - -0.009361267 + - 0.011291504 + - -0.010093689 + - -0.017990112 + - 0.04107666 + - -0.058563232 + - -0.03387451 + - -0.046905518 + - 0.015411377 + - -0.02003479 + - -0.010528564 + - -0.01689148 + - 0.010391235 + - -0.040618896 + - 0.029205322 + - -0.020492554 + - -0.082092285 + - 0.0004811287 + - 0.043518066 + - -0.044830322 + - 0.020141602 + - -0.02319336 + - 0.0024662018 + - 0.012825012 + - 0.04977417 + - 0.06225586 + - 0.027801514 + - 0.005153656 + - 0.04147339 + - 0.0011873245 + - 0.004486084 + - -0.02494812 + - 0.061706543 + - 0.012184143 + - -0.0027637482 + - -0.018447876 + - -0.008987427 + - -0.0362854 + - 0.10205078 + - 0.026138306 + - -0.056549072 + - 0.015899658 + - 0.04449463 + - -0.017837524 + - -0.0044898987 + - -0.04348755 + - 0.06689453 + - 0.008728027 + - 0.047454834 + - 0.03289795 + - -0.034851074 + - 0.04675293 + - -0.058807373 + - 0.03164673 + - 0.01322937 + - -0.06958008 + - -0.042816162 + - -0.022918701 + - -0.019760132 + - 0.008293152 + - 0.02709961 + - -0.05822754 + - 0.011459351 + - -0.0008597374 + - -0.01574707 + - 0.027954102 + - -0.029785156 + - -0.03665161 + - 0.017562866 + - -0.027297974 + - -0.024017334 + - -0.0423584 + - -0.039245605 + - 0.0028457642 + - -0.0010719299 + - 0.01763916 + - 0.009902954 + - -0.023849487 + - -0.009399414 + - -0.016464233 + - 0.045074463 + - -0.0056762695 + - 0.04537964 + - -0.04397583 + - -0.025817871 + - 0.037353516 + - -0.018737793 + - 0.01084137 + - 0.0038528442 + - -0.04547119 + - -0.024475098 + - -0.05545044 + - -0.005756378 + - 0.008132935 + - 0.014541626 + - -0.0020751953 + - 0.03793335 + - -0.004421234 + - -0.037261963 + - -0.00818634 + - 0.026733398 + - 0.04776001 + - -0.012313843 + - 0.0019369125 + - -0.0006084442 + - 0.01335907 + - -0.033813477 + - -0.024459839 + - 0.046783447 + - -0.006389618 + - -0.055999756 + - -0.059295654 + - 0.008743286 + - -0.033966064 + - 0.022537231 + - -0.018722534 + - -0.041259766 + - 0.040039062 + - 0.028747559 + - -0.03515625 + - 0.0019016266 + - 0.041778564 + - -0.0046539307 + - 0.00014257431 + - 0.011451721 + - 0.016998291 + - 0.00522995 + - -0.04837036 + - -0.024520874 + - 0.025466919 + - -0.020706177 + - 0.017608643 + - 0.062042236 + - -0.0039596558 + - -0.021911621 + - -0.013893127 + - -0.0000885129 + - 0.00075626373 + - 0.03414917 + - 0.011314392 + - 0.018661499 + - -0.009719849 + - 0.012748718 + - -0.026809692 + - -0.01436615 + - 0.021469116 + - -0.036254883 + - 0.00907135 + - -0.026016235 + - -0.01625061 + - 0.030075073 + - 0.011817932 + - -0.0038528442 + - -0.0028858185 + - -0.021820068 + - 0.037475586 + - 0.0115356445 + - -0.0077285767 + - -0.05328369 + - -0.051361084 + - 0.040649414 + - -0.005958557 + - -0.02279663 + - 0.01953125 + - -0.016937256 + - 0.03781128 + - -0.0016212463 + - 0.015098572 + - -0.01626587 + - 0.0067443848 + - 0.027175903 + - 0.011459351 + - 0.038513184 + - 0.06222534 + - -0.0073547363 + - -0.010383606 + - 0.0017681122 + - 0.045043945 + - -0.044921875 + - -0.0104599 + - 0.035858154 + - -0.008323669 + - 0.0025901794 + - 0.021514893 + - -0.010971069 + - 0.016738892 + - 0.0018157959 + - -0.0071258545 + - -0.029022217 + - -0.047027588 + - -0.02670288 + - 0.029220581 + - -0.022750854 + - 0.025054932 + - -0.008544922 + - 0.006164551 + - -0.029052734 + - -0.031066895 + - 0.06304932 + - -0.044647217 + - -0.017562866 + - -0.0068511963 + - 0.06604004 + - 0.039916992 + - -0.007041931 + - -0.02772522 + - -0.05795288 + - -0.022247314 + - -0.02810669 + - -0.03845215 + - 0.045074463 + - -0.014060974 + - -0.016174316 + - 0.046722412 + - -0.0006046295 + - -0.019500732 + - -0.025985718 + - 0.032989502 + - 0.028366089 + - 0.0021324158 + - 0.0020503998 + - 0.051574707 + - 0.009117126 + - -0.03112793 + - -0.006565094 + - 0.019226074 + - 0.009971619 + - -0.0064735413 + - -0.017700195 + - 0.0024414062 + - -0.0008454323 + - -0.04071045 + - -0.034820557 + - -0.031066895 + - -0.044677734 + - 0.039398193 + - -0.012580872 + - -0.06549072 + - 0.027130127 + - -0.0309906 + - 0.023727417 + - -0.019760132 + - 0.0066490173 + - -0.004798889 + - 0.009155273 + - -0.009902954 + - 0.047576904 + - 0.005466461 + - 0.001537323 + - 0.014862061 + - -0.0027828217 + - -0.0079956055 + - 0.043182373 + - 0.0051841736 + - 0.034484863 + - -0.028015137 + - -0.012870789 + - -0.019714355 + - 0.036071777 + - 0.015716553 + - -0.016860962 + - 0.0034122467 + - -0.014289856 + - 0.039031982 + - 0.017730713 + - -0.013549805 + - 0.046691895 + - 0.022094727 + - 0.04647827 + - 0.008033752 + - 0.028747559 + - -0.030288696 + - -0.018722534 + - -0.015113831 + - 0.051971436 + - -0.040893555 + - -0.039978027 + - -0.0042266846 + - -0.008346558 + - 0.059814453 + - 0.0011167526 + - 0.056030273 + - -0.08166504 + - -0.059631348 + - -0.015731812 + - 0.009529114 + - 0.025756836 + - 0.022232056 + - -0.0049819946 + - 0.021118164 + - -0.020446777 + - 0.0032253265 + - 0.017105103 + - -0.030944824 + - 0.010154724 + - -0.021881104 + - -0.018081665 + - 0.029342651 + - 0.024047852 + - 0.017700195 + - -0.02268982 + - 0.018356323 + - 0.026519775 + - 0.032226562 + - -0.004711151 + - 0.018753052 + - 0.007789612 + - 0.033172607 + - -0.034423828 + - 0.035247803 + - -0.019729614 + - -0.021194458 + - 0.0071411133 + - -0.014549255 + - -0.0073165894 + - -0.05596924 + - 0.015060425 + - -0.014305115 + - -0.030090332 + - 0.001613617 + - -0.026809692 + - -0.02571106 + - -0.0041275024 + - 0.027389526 + - -0.0059509277 + - 0.0473938 + - -0.0002002716 + - 0.00037145615 + - 0.0031642914 + - -0.0044441223 + - 0.0023765564 + - 0.0121154785 + - 0.04260254 + - -0.035736084 + - 0.019424438 + - -0.005558014 + - 0.0038166046 + - 0.03717041 + - -0.0031261444 + - 0.0446167 + - 0.015098572 + - -0.0022087097 + - 0.0385437 + - 0.024505615 + - -0.03353882 + - -0.028533936 + - 0.06048584 + - -0.019332886 + - -0.046539307 + - 0.007232666 + - -0.031585693 + - 0.02168274 + - 0.0046195984 + - -0.041412354 + - 0.032592773 + - 0.056671143 + - 0.031173706 + - -0.011398315 + - 0.033416748 + - 0.01802063 + - -0.0259552 + - -0.0028705597 + - 0.046539307 + - -0.040008545 + - 0.022567749 + - 0.020980835 + - 0.024383545 + - 0.02861023 + - 0.010574341 + - -0.008300781 + - 0.024261475 + - 0.030319214 + - -0.011238098 + - -0.030197144 + - 0.013389587 + - 0.010879517 + - -0.031311035 + - 0.035308838 + - -0.014755249 + - 0.01612854 + - 0.05722046 + - -0.019470215 + - -0.014045715 + - 0.022842407 + - -0.085998535 + - 0.017166138 + - 0.011474609 + - 0.018325806 + - 0.010398865 + - 0.00434494 + - -0.013153076 + - 0.025482178 + - 0.007217407 + - -0.0017223358 + - 0.041046143 + - 0.036895752 + - -0.028656006 + - -0.008026123 + - 0.026550293 + - -0.0146102905 + - 0.0053215027 + - -0.057037354 + - 0.008743286 + - 0.018066406 + - 0.0025310516 + - -0.0035171509 + - -0.02230835 + - -0.018218994 + - 0.0069618225 + - -0.006111145 + - 0.017532349 + - 0.034210205 + - -0.040496826 + - 0.031433105 + - -0.006587982 + - -0.031097412 + - -0.0154418945 + - -0.009414673 + - 0.006729126 + - 0.004711151 + - 0.00920105 + - 0.0025501251 + - -0.0016479492 + - -0.0107803345 + - -0.070129395 + - -0.046203613 + - 0.06616211 + - -0.019622803 + - -0.06298828 + - -0.022628784 + - 0.04156494 + - 0.026672363 + - -0.11505127 + - -0.080200195 + - -0.0491333 + - -0.03744507 + - -0.0178833 + - 0.016326904 + - 0.03201294 + - -0.013259888 + - -0.042114258 + - 0.0023727417 + - 0.005683899 + - -0.027908325 + - 0.040039062 + - -0.055847168 + - -0.03781128 + - -0.018753052 + - 0.03274536 + - 0.0121536255 + - 0.04360962 + - -0.0110321045 + - 0.017913818 + - -0.0231781 + - -0.018936157 + - -0.002658844 + - 0.011222839 + - -0.0082473755 + - -0.0039043427 + - 0.011512756 + - -0.014328003 + - 0.037994385 + - -0.020767212 + - 0.025314331 + - -0.023727417 + - 0.030303955 + - 0.03302002 + - 0.0040512085 + - -0.074401855 + - 0.027450562 + - -0.030838013 + - 0.042053223 + - -0.04425049 + - -0.022613525 + - 0.0025463104 + - 0.029449463 + - -0.0023975372 + - 0.03717041 + - 0.020751953 + - -0.000009357929 + - -0.06842041 + - -0.045074463 + - -0.035980225 + - 0.03060913 + - 0.00049352646 + - -0.0013618469 + - 0.018676758 + - 0.00070238113 + - -0.015472412 + - -0.035736084 + - -0.008995056 + - 0.008773804 + - 0.009635925 + - 0.023330688 + - -0.027008057 + - -0.0074501038 + - -0.0040893555 + - 0.010391235 + - -0.030014038 + - -0.04119873 + - -0.06329346 + - 0.049926758 + - -0.016952515 + - -0.015045166 + - -0.0010814667 + - 0.020309448 + - -0.0034770966 + - 0.05996704 + - -0.043273926 + - -0.035491943 + - 0.017654419 + - 0.033325195 + - -0.015403748 + - 0.03942871 + - -0.003692627 + - -0.008995056 + - -0.012290955 + - -0.004722595 + - 0.010276794 + - -0.027023315 + - -0.0052871704 + - 0.019729614 + - 0.026519775 + - -0.029541016 + - -0.05505371 + - 0.007499695 + - -0.030639648 + - 0.00042963028 + - -0.016693115 + - 0.03125 + - 0.03543091 + - 0.010482788 + - 0.018081665 + - 0.030441284 + - 0.030960083 + - -0.008422852 + - -0.00983429 + - 0.047332764 + - 0.0023212433 + - 0.0052719116 + meta: + api_version: + version: "1" + billed_units: + input_tokens: 2 + response_type: embeddings_floats + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/EmbedByTypeResponse" + headers: + X-API-Warning: + schema: + type: string + x-fern-audiences: + - public + description: Warning description for incorrect usage of the API + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "403": + $ref: "#/components/responses/Forbidden" + "404": + $ref: "#/components/responses/NotFound" + "422": + $ref: "#/components/responses/UnprocessableEntity" + "429": + $ref: "#/components/responses/RateLimit" + "498": + $ref: "#/components/responses/InvalidToken" + "499": + $ref: "#/components/responses/RequestCancelled" + "500": + $ref: "#/components/responses/InternalServerError" + "501": + $ref: "#/components/responses/NotImplemented" + "503": + $ref: "#/components/responses/ServiceUnavailable" + "504": + $ref: "#/components/responses/GatewayTimeout" + description: |- + This endpoint returns text embeddings. An embedding is a list of floating point numbers that captures semantic information about the text that it represents. + + Embeddings can be used to create text classifiers as well as empower semantic search. To learn more about embeddings, see the embedding page. + + If you want to learn more how to use the embedding model, have a look at the [Semantic Search Guide](/docs/semantic-search). + requestBody: + content: + application/json: + schema: + type: object + x-fern-audiences: + - public + required: + - model + properties: + texts: + type: array + x-fern-audiences: + - public + minItems: 1 + maxItems: 96 + description: An array of strings for the model to embed. Maximum number of texts + per call is `96`. We recommend reducing the length of each + text to be under `512` tokens for optimal quality. + items: + type: string + x-fern-audiences: + - public + writeOnly: true + writeOnly: true + model: + type: string + x-fern-audiences: + - public + description: |- + Defaults to embed-english-v2.0 + + The identifier of the model. Smaller "light" models are faster, while larger models will perform better. [Custom models](/docs/training-custom-models) can also be supplied with their full ID. + + Available models and corresponding embedding dimensions: + + * `embed-english-v3.0` 1024 + * `embed-multilingual-v3.0` 1024 + * `embed-english-light-v3.0` 384 + * `embed-multilingual-light-v3.0` 384 + + * `embed-english-v2.0` 4096 + * `embed-english-light-v2.0` 1024 + * `embed-multilingual-v2.0` 768 + writeOnly: true + input_type: + x-fern-audiences: + - public + $ref: "#/components/schemas/EmbedInputType" + embedding_types: + type: array + x-fern-audiences: + - public + items: + $ref: "#/components/schemas/EmbeddingType" + description: |- + Specifies the types of embeddings you want to get back. Not required and default is None, which returns the Embed Floats response type. Can be one or more of the following types. + + * `"float"`: Use this when you want to get back the default float embeddings. Valid for all models. + * `"int8"`: Use this when you want to get back signed int8 embeddings. Valid for only v3 models. + * `"uint8"`: Use this when you want to get back unsigned int8 embeddings. Valid for only v3 models. + * `"binary"`: Use this when you want to get back signed binary embeddings. Valid for only v3 models. + * `"ubinary"`: Use this when you want to get back unsigned binary embeddings. Valid for only v3 models. + writeOnly: true + truncate: + type: string + x-fern-audiences: + - public + default: END + enum: + - NONE + - START + - END + description: |- + One of `NONE|START|END` to specify how the API will handle inputs longer than the maximum token length. + + Passing `START` will discard the start of the input. `END` will discard the end of the input. In both cases, input is discarded until the remaining input is exactly the maximum input token length for the model. + + If `NONE` is selected, when the input exceeds the maximum input token length an error will be returned. + writeOnly: true + description: "" + /v1/embed-jobs: + post: + x-fern-audiences: + - public + parameters: + - $ref: "#/components/parameters/RequestSource" + summary: Create an Embed Job + operationId: create-embed-job + tags: + - /embed-jobs + x-fern-sdk-group-name: embed-jobs + x-fern-sdk-method-name: create + x-fern-examples: + - code-samples: + - sdk: go + name: Cohere Go SDK + 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 + name: Sync + code: > + import cohere + + + 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" + ) + + + # poll the server until the job is complete + + response = co.wait(job) + + + print(response) + - sdk: python + name: Async + code: > + import cohere + + import asyncio + + + 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) + + print(response) + + asyncio.run(main()) + - sdk: java + name: Cohere java SDK + code: > + import com.cohere.api.Cohere; + + import + com.cohere.api.resources.embedjobs.requests.CreateEmbedJobRequest; + + import com.cohere.api.types.CreateEmbedJobResponse; + + import com.cohere.api.types.EmbedInputType; + + + + public class EmbedJobsPost { + public static void main(String[] args) { + Cohere cohere = Cohere.builder().token("<>").clientName("snippet").build(); + + CreateEmbedJobResponse response = cohere.embedJobs().create(CreateEmbedJobRequest.builder().model("embed-english-v3.0").datasetId("ds.id").inputType(EmbedInputType.SEARCH_DOCUMENT).build()); + + System.out.println(response); + } + } + - sdk: typescript + name: Cohere TypeScript SDK + code: | + const { CohereClient } = require('cohere-ai'); + + const cohere = new CohereClient({ + token: '<>', + }); + + (async () => { + const embedJob = await cohere.embedJobs.create({ + datasetId: 'my-dataset', + inputType: 'search_document', + model: 'embed-english-v3.0', + }); + + console.log(embedJob); + })(); + - sdk: 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" }' @@ -11200,6 +13337,185 @@ paths: 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-fern-examples: + - code-samples: + - sdk: typescript + name: Cohere TypeScript SDK + code: > + const { CohereClient } = require('cohere-ai'); + + + const cohere = new CohereClient({ + token: '<>', + }); + + + (async () => { + const rerank = await cohere.v2.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); + })(); + - sdk: python + name: Sync + code: > + import cohere + + + co = cohere.Client("<>") + + + docs = [ + "Carson City is the capital city of the American state of Nevada.", + "The Commonwealth of the Northern Mariana Islands is a group of islands in the Pacific Ocean. Its capital is Saipan.", + "Capitalization or capitalisation in English grammar is the use of a capital letter at the start of a word. English usage varies from capitalization in other languages.", + "Washington, D.C. (also known as simply Washington or D.C., and officially as the District of Columbia) is the capital of the United States. It is a federal district.", + "Capital punishment (the death penalty) has existed in the United States since beforethe United States was a country. As of 2017, capital punishment is legal in 30 of the 50 states.", + ] + + + response = co.rerank( + model="rerank-english-v3.0", + query="What is the capital of the United States?", + documents=docs, + top_n=3, + ) + + print(response) + - sdk: python + name: Async + code: + $ref: ./snippets/python-async/rerank-v2-post.py + - sdk: java + name: Cohere java SDK + code: > + /* (C)2024 */ + + import com.cohere.api.Cohere; + + import com.cohere.api.resources.v2.requests.V2RerankRequest; + + import + com.cohere.api.resources.v2.types.V2RerankRequestDocumentsItem; + + import com.cohere.api.resources.v2.types.V2RerankResponse; + + import java.util.List; + + + public class RerankV2Post { + public static void main(String[] args) { + Cohere cohere = Cohere.builder().token("<>").clientName("snippet").build(); + + V2RerankResponse response = + cohere.v2().rerank( + V2RerankRequest.builder() + .model("rerank-english-v3.0") + .query("What is the capital of the United States?") + .documents( + List.of( + V2RerankRequestDocumentsItem.of( + "Carson City is the capital city of the" + + " American state of Nevada."), + V2RerankRequestDocumentsItem.of( + "The Commonwealth of the Northern Mariana" + + " Islands is a group of islands in" + + " the Pacific Ocean. Its capital is" + + " Saipan."), + V2RerankRequestDocumentsItem.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."), + V2RerankRequestDocumentsItem.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."), + V2RerankRequestDocumentsItem.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."))) + .topN(3) + .build()); + + System.out.println(response); + } + } + - sdk: 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."] + }' + request: + 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? + top_n: 3 + model: rerank-english-v3.0 + response: + body: + id: 8bc745a3-7871-4597-822e-18c95d5df48c + results: + - index: 3 + relevance_score: 0.999071 + - index: 4 + relevance_score: 0.7867867 + - index: 0 + relevance_score: 0.32713068 + meta: + api_version: + version: "1" + billed_units: + search_units: 1 /v1/classify: post: parameters: diff --git a/snippets/snippets/curl/rerank-v2-post.sh b/snippets/snippets/curl/rerank-v2-post.sh new file mode 100644 index 00000000..11dead44 --- /dev/null +++ b/snippets/snippets/curl/rerank-v2-post.sh @@ -0,0 +1,15 @@ +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."] + }' \ No newline at end of file diff --git a/snippets/snippets/java/app/src/main/java/EmbedV2Post.java b/snippets/snippets/java/app/src/main/java/EmbedV2Post.java new file mode 100644 index 00000000..20630a88 --- /dev/null +++ b/snippets/snippets/java/app/src/main/java/EmbedV2Post.java @@ -0,0 +1,22 @@ +/* (C)2024 */ +import com.cohere.api.Cohere; +import com.cohere.api.resources.v2.requests.V2EmbedRequest; +import com.cohere.api.types.EmbedByTypeResponse; +import com.cohere.api.types.EmbedInputType; +import java.util.List; + +public class EmbedV2Post { + public static void main(String[] args) { + Cohere cohere = Cohere.builder().token("<>").clientName("snippet").build(); + + EmbedByTypeResponse response = + cohere.v2().embed( + V2EmbedRequest.builder() + .model("embed-english-v3.0") + .texts(List.of("hello", "goodbye")) + .inputType(EmbedInputType.CLASSIFICATION) + .build()); + + System.out.println(response); + } +} diff --git a/snippets/snippets/java/app/src/main/java/RerankV2Post.java b/snippets/snippets/java/app/src/main/java/RerankV2Post.java new file mode 100644 index 00000000..a6f1d26a --- /dev/null +++ b/snippets/snippets/java/app/src/main/java/RerankV2Post.java @@ -0,0 +1,52 @@ +/* (C)2024 */ +import com.cohere.api.Cohere; +import com.cohere.api.resources.v2.requests.V2RerankRequest; +import com.cohere.api.resources.v2.types.V2RerankRequestDocumentsItem; +import com.cohere.api.resources.v2.types.V2RerankResponse; +import java.util.List; + +public class RerankV2Post { + public static void main(String[] args) { + Cohere cohere = Cohere.builder().token("<>").clientName("snippet").build(); + + V2RerankResponse response = + cohere.v2().rerank( + V2RerankRequest.builder() + .model("rerank-english-v3.0") + .query("What is the capital of the United States?") + .documents( + List.of( + V2RerankRequestDocumentsItem.of( + "Carson City is the capital city of the" + + " American state of Nevada."), + V2RerankRequestDocumentsItem.of( + "The Commonwealth of the Northern Mariana" + + " Islands is a group of islands in" + + " the Pacific Ocean. Its capital is" + + " Saipan."), + V2RerankRequestDocumentsItem.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."), + V2RerankRequestDocumentsItem.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."), + V2RerankRequestDocumentsItem.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."))) + .topN(3) + .build()); + + System.out.println(response); + } +} diff --git a/snippets/snippets/java/app/src/main/java/chatpost/Default.java b/snippets/snippets/java/app/src/main/java/chatpost/Default.java index b687539b..22d1b9de 100644 --- a/snippets/snippets/java/app/src/main/java/chatpost/Default.java +++ b/snippets/snippets/java/app/src/main/java/chatpost/Default.java @@ -4,7 +4,7 @@ import com.cohere.api.Cohere; import com.cohere.api.requests.ChatRequest; import com.cohere.api.types.ChatMessage; -import com.cohere.api.types.ChatMessageRole; +import com.cohere.api.types.Message; import com.cohere.api.types.NonStreamedChatResponse; import java.util.List; @@ -18,17 +18,19 @@ public static void main(String[] args) { .message("What year was he born?") .chatHistory( List.of( - ChatMessage.builder() - .role(ChatMessageRole.USER) - .message("Who discovered gravity?") - .build(), - ChatMessage.builder() - .role(ChatMessageRole.CHATBOT) - .message( - "The man who is widely credited" - + " with discovering gravity is" - + " Sir Isaac Newton") - .build())) + Message.user( + ChatMessage.builder() + .message("Who discovered gravity?") + .build()), + Message.chatbot( + ChatMessage.builder() + .message( + "The man who is widely" + + " credited with" + + " discovering gravity" + + " is Sir Isaac" + + " Newton") + .build()))) .build()); System.out.println(response); diff --git a/snippets/snippets/java/app/src/main/java/chatpost/Stream.java b/snippets/snippets/java/app/src/main/java/chatpost/Stream.java index 890d267a..aecacbfc 100644 --- a/snippets/snippets/java/app/src/main/java/chatpost/Stream.java +++ b/snippets/snippets/java/app/src/main/java/chatpost/Stream.java @@ -4,8 +4,8 @@ import com.cohere.api.Cohere; import com.cohere.api.requests.ChatStreamRequest; import com.cohere.api.types.ChatMessage; -import com.cohere.api.types.ChatMessageRole; import com.cohere.api.types.ChatTextGenerationEvent; +import com.cohere.api.types.Message; import com.cohere.api.types.StreamedChatResponse; import java.util.List; @@ -19,17 +19,19 @@ public static void main(String[] args) { .message("What year was he born?") .chatHistory( List.of( - ChatMessage.builder() - .role(ChatMessageRole.USER) - .message("Who discovered gravity?") - .build(), - ChatMessage.builder() - .role(ChatMessageRole.CHATBOT) - .message( - "The man who is widely credited" - + " with discovering gravity is" - + " Sir Isaac Newton") - .build())) + Message.user( + ChatMessage.builder() + .message("Who discovered gravity?") + .build()), + Message.chatbot( + ChatMessage.builder() + .message( + "The man who is widely" + + " credited with" + + " discovering gravity" + + " is Sir Isaac" + + " Newton") + .build()))) .build()); for (StreamedChatResponse chatResponse : response) { diff --git a/snippets/snippets/java/app/src/main/java/chatv2post/Default.java b/snippets/snippets/java/app/src/main/java/chatv2post/Default.java new file mode 100644 index 00000000..7ea6c73f --- /dev/null +++ b/snippets/snippets/java/app/src/main/java/chatv2post/Default.java @@ -0,0 +1,48 @@ +/* (C)2024 */ +package chatv2post; + +import com.cohere.api.Cohere; +import com.cohere.api.resources.v2.requests.V2ChatRequest; +import com.cohere.api.types.*; +import java.util.List; + +public class Default { + public static void main(String[] args) { + Cohere cohere = Cohere.builder().token("<>").clientName("snippet").build(); + + ChatResponse response = + cohere.v2() + .chat( + V2ChatRequest.builder() + .model("command-r-plus") + .messages( + List.of( + ChatMessageV2.user( + UserMessage.builder() + .content( + UserMessageContent + .of( + "Who discovered" + + " gravity?")) + .build()), + ChatMessageV2.assistant( + AssistantMessage.builder() + .content( + AssistantMessageContent + .of( + "The man" + + " who is" + + " widely" + + " credited" + + " with" + + " discovering" + + " gravity" + + " is Sir" + + " Isaac" + + " Newton")) + .build()))) + .build()); + + System.out.println(response); + } +} diff --git a/snippets/snippets/java/app/src/main/java/chatv2post/Documents.java b/snippets/snippets/java/app/src/main/java/chatv2post/Documents.java new file mode 100644 index 00000000..c709ada5 --- /dev/null +++ b/snippets/snippets/java/app/src/main/java/chatv2post/Documents.java @@ -0,0 +1,154 @@ +/* (C)2024 */ +package chatv2post; + +import com.cohere.api.Cohere; +import com.cohere.api.resources.v2.requests.V2ChatRequest; +import com.cohere.api.resources.v2.types.V2ChatRequestDocumentsItem; +import com.cohere.api.types.*; +import java.util.List; + +public class Documents { + public static void main(String[] args) { + Cohere cohere = Cohere.builder().token("<>").clientName("snippet").build(); + + ChatResponse response = + cohere.v2() + .chat( + V2ChatRequest.builder() + .model("command-r-plus") + .messages( + List.of( + ChatMessageV2.user( + UserMessage.builder() + .content( + UserMessageContent + .of( + "Who is" + + " the most" + + " popular?")) + .build()))) + .documents( + List.of( + V2ChatRequestDocumentsItem.of( + "↓ Skip to Main Content\n\n" + + "Music industry – One step" + + " closer to being" + + " accurate\n\n" + + "CSPC: Backstreet Boys" + + " Popularity Analysis\n\n" + + "Hernán Lopez Posted on" + + " February 9, 2017 Posted in" + + " CSPC 72 Comments Tagged" + + " with Backstreet Boys, Boy" + + " band\n\n" + + "At one point, Backstreet" + + " Boys defined success:" + + " massive albums sales across" + + " the globe, great singles" + + " sales, plenty of chart" + + " topping releases, hugely" + + " hyped tours and tremendous" + + " media coverage.\n\n" + + "It is true that they" + + " benefited from" + + " extraordinarily good market" + + " conditions in all markets." + + " After all, the all-time" + + " record year for the music" + + " business, as far as" + + " revenues in billion dollars" + + " are concerned, was actually" + + " 1999. That is, back when" + + " this five men group was at" + + " its peak."), + V2ChatRequestDocumentsItem.of( + "↓ Skip to Main Content\n\n" + + "Music industry – One step" + + " closer to being" + + " accurate\n\n" + + "CSPC: NSYNC Popularity" + + " Analysis\n\n" + + "MJD Posted on February 9," + + " 2018 Posted in CSPC 27" + + " Comments Tagged with Boy" + + " band, N'Sync\n\n" + + "At the turn of the" + + " millennium three teen acts" + + " were huge in the US, the" + + " Backstreet Boys, Britney" + + " Spears and NSYNC. The" + + " latter is the only one we" + + " haven’t study so far. It" + + " took 15 years and Adele to" + + " break their record of 2,4" + + " million units sold of No" + + " Strings Attached in its" + + " first week alone.\n\n" + + "It wasn’t a fluke, as the" + + " second fastest selling" + + " album of the Soundscan era" + + " prior 2015, was also theirs" + + " since Celebrity debuted" + + " with 1,88 million units" + + " sold."), + V2ChatRequestDocumentsItem.of( + " 1997, 1998, 2000 and 2001 also" + + " rank amongst some of the" + + " very best years.\n\n" + + "Yet the way many music" + + " consumers – especially" + + " teenagers and young women’s" + + " – embraced their output" + + " deserves its own chapter." + + " If Jonas Brothers and more" + + " recently One Direction" + + " reached a great level of" + + " popularity during the past" + + " decade, the type of success" + + " achieved by Backstreet Boys" + + " is in a completely" + + " different level as they" + + " really dominated the" + + " business for a few years" + + " all over the world," + + " including in some countries" + + " that were traditionally" + + " hard to penetrate for" + + " Western artists.\n\n" + + "We will try to analyze the" + + " extent of that hegemony" + + " with this new article with" + + " final results which will" + + " more than surprise many" + + " readers."), + V2ChatRequestDocumentsItem.of( + " Was the teen group led by Justin" + + " Timberlake really that big?" + + " Was it only in the US where" + + " they found success? Or were" + + " they a global" + + " phenomenon?\n\n" + + "As usual, I’ll be using the" + + " Commensurate Sales to" + + " Popularity Concept in order" + + " to relevantly gauge their" + + " results. This concept will" + + " not only bring you sales" + + " information for all NSYNC‘s" + + " albums, physical and" + + " download singles, as well" + + " as audio and video" + + " streaming, but it will also" + + " determine their true" + + " popularity. If you are not" + + " yet familiar with the CSPC" + + " method, the next page" + + " explains it with a short" + + " video. I fully recommend" + + " watching the video before" + + " getting into the sales" + + " figures."))) + .build()); + System.out.println(response); + } +} diff --git a/snippets/snippets/java/app/src/main/java/chatv2post/Stream.java b/snippets/snippets/java/app/src/main/java/chatv2post/Stream.java new file mode 100644 index 00000000..22c57bf9 --- /dev/null +++ b/snippets/snippets/java/app/src/main/java/chatv2post/Stream.java @@ -0,0 +1,61 @@ +/* (C)2024 */ +package chatv2post; + +import com.cohere.api.Cohere; +import com.cohere.api.resources.v2.requests.V2ChatStreamRequest; +import com.cohere.api.types.*; +import java.util.List; + +public class Stream { + public static void main(String[] args) { + Cohere cohere = Cohere.builder().token("<>").clientName("snippet").build(); + + Iterable response = + cohere.v2() + .chatStream( + V2ChatStreamRequest.builder() + .model("command-r-plus") + .messages( + List.of( + ChatMessageV2.user( + UserMessage.builder() + .content( + UserMessageContent + .of( + "Who discovered" + + " gravity?")) + .build()), + ChatMessageV2.assistant( + AssistantMessage.builder() + .content( + AssistantMessageContent + .of( + "The man" + + " who is" + + " widely" + + " credited" + + " with" + + " discovering" + + " gravity" + + " is Sir" + + " Isaac" + + " Newton")) + .build()))) + .build()); + + for (StreamedChatResponseV2 chatResponse : response) { + if (chatResponse.isContentDelta()) { + System.out.println( + chatResponse + .getContentDelta() + .flatMap(ChatContentDeltaEvent::getDelta) + .flatMap(ChatContentDeltaEventDelta::getMessage) + .flatMap(ChatContentDeltaEventDeltaMessage::getContent) + .flatMap(ChatContentDeltaEventDeltaMessageContent::getText) + .orElse("")); + } + } + + System.out.println(response); + } +} diff --git a/snippets/snippets/java/app/src/main/java/chatv2post/Tools.java b/snippets/snippets/java/app/src/main/java/chatv2post/Tools.java new file mode 100644 index 00000000..b788035c --- /dev/null +++ b/snippets/snippets/java/app/src/main/java/chatv2post/Tools.java @@ -0,0 +1,102 @@ +/* (C)2024 */ +package chatv2post; + +import com.cohere.api.Cohere; +import com.cohere.api.resources.v2.requests.V2ChatRequest; +import com.cohere.api.types.*; +import java.util.List; +import java.util.Map; + +public class Tools { + public static void main(String[] args) { + Cohere cohere = Cohere.builder().token("<>").clientName("snippet").build(); + + ChatResponse response = + cohere.v2() + .chat( + V2ChatRequest.builder() + .model("command-r-plus") + .tools( + List.of( + ToolV2.builder() + .function( + ToolV2Function.builder() + .name( + "query_daily_sales_report") + .description( + "Connects" + + " to a" + + " database" + + " to retrieve" + + " overall" + + " sales" + + " volumes" + + " and sales" + + " information" + + " for a" + + " given" + + " day.") + .parameters( + Map.of( + "day", + ToolParameterDefinitionsValue + .builder() + .type( + "str") + .description( + "Retrieves" + + " sales" + + " data" + + " for this" + + " day," + + " formatted" + + " as YYYY-MM-DD.") + .required( + true) + .build())) + .build()) + .build(), + ToolV2.builder() + .function( + ToolV2Function.builder() + .name( + "query_product_catalog") + .description("Connects" + + " to a" + + " a product" + + " catalog" + + " with information" + + " about all" + + " the products being" + + " sold," + + " including" + + " categories," + + " prices, and stock" + + " levels.") + .parameters( + Map.of( + "category", + ToolParameterDefinitionsValue + .builder() + .type( + "str") + .description( + "Retrieves" + + " product" + + " information" + + " data" + + " for all" + + " products" + + " in this" + + " category.") + .required( + true) + .build())) + .build()) + .build()) + ) + .build()); + + System.out.println(response); + } +} diff --git a/snippets/snippets/node/embed-v2-post.ts b/snippets/snippets/node/embed-v2-post.ts new file mode 100644 index 00000000..9f155496 --- /dev/null +++ b/snippets/snippets/node/embed-v2-post.ts @@ -0,0 +1,14 @@ +const { CohereClient } = require('cohere-ai'); + +const cohere = new CohereClient({ + token: '<>', +}); + +(async () => { + const embed = await cohere.v2.embed({ + texts: ['hello', 'goodbye'], + model: 'embed-english-v3.0', + inputType: 'classification', + }); + console.log(embed); +})(); diff --git a/snippets/snippets/node/rerank-v2-post.ts b/snippets/snippets/node/rerank-v2-post.ts new file mode 100644 index 00000000..0c1fb72f --- /dev/null +++ b/snippets/snippets/node/rerank-v2-post.ts @@ -0,0 +1,30 @@ +const { CohereClient } = require('cohere-ai'); + +const cohere = new CohereClient({ + token: '<>', +}); + +(async () => { + const rerank = await cohere.v2.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); +})(); diff --git a/snippets/snippets/python/chat-v2-post/tools.py b/snippets/snippets/python/chat-v2-post/tools.py index c67d3428..58e3b6e9 100644 --- a/snippets/snippets/python/chat-v2-post/tools.py +++ b/snippets/snippets/python/chat-v2-post/tools.py @@ -5,7 +5,7 @@ response = co.chat( model="command-r-plus", tools=[ - cohere.v2.Tool2(type='function', function={ + cohere.ToolV2(type='function', function={ "name": 'query_daily_sales_report', "description": 'Connects to a database to retrieve overall sales volumes and sales information for a given day.', "parameters": { @@ -16,7 +16,7 @@ }, } }), - cohere.v2.Tool2(type='function', function={ + cohere.ToolV2(type='function', function={ "name": 'query_product_catalog', "description": 'Connects to a a product catalog with information about all the products being sold, including categories, prices, and stock levels.', "parameters": { @@ -31,7 +31,7 @@ messages=[ { "role": "user", - "content":"Can you provide a sales summary for 29th September 2023, and also give me some details about the products in the 'Electronics' category, for example their prices and stock levels?" + "content": "Can you provide a sales summary for 29th September 2023, and also give me some details about the products in the 'Electronics' category, for example their prices and stock levels?" } ] ) diff --git a/snippets/snippets/python/embed-v2-post.py b/snippets/snippets/python/embed-v2-post.py new file mode 100644 index 00000000..618659de --- /dev/null +++ b/snippets/snippets/python/embed-v2-post.py @@ -0,0 +1,8 @@ +import cohere + +co = cohere.Client("<>") + +response = co.embed( + texts=["hello", "goodbye"], model="embed-english-v3.0", input_type="classification" +) +print(response) diff --git a/snippets/snippets/python/rerank-v2-post.py b/snippets/snippets/python/rerank-v2-post.py new file mode 100644 index 00000000..5150cadb --- /dev/null +++ b/snippets/snippets/python/rerank-v2-post.py @@ -0,0 +1,19 @@ +import cohere + +co = cohere.Client("<>") + +docs = [ + "Carson City is the capital city of the American state of Nevada.", + "The Commonwealth of the Northern Mariana Islands is a group of islands in the Pacific Ocean. Its capital is Saipan.", + "Capitalization or capitalisation in English grammar is the use of a capital letter at the start of a word. English usage varies from capitalization in other languages.", + "Washington, D.C. (also known as simply Washington or D.C., and officially as the District of Columbia) is the capital of the United States. It is a federal district.", + "Capital punishment (the death penalty) has existed in the United States since beforethe United States was a country. As of 2017, capital punishment is legal in 30 of the 50 states.", +] + +response = co.rerank( + model="rerank-english-v3.0", + query="What is the capital of the United States?", + documents=docs, + top_n=3, +) +print(response)