From 9704841cba34d3c63b5aec66b85d76b8ef09161c Mon Sep 17 00:00:00 2001 From: platform-endpoints Date: Tue, 27 Aug 2024 19:01:42 +0000 Subject: [PATCH] Add spec changes Co-authored-by: Lucas Fayoux <8889400+lfayoux@users.noreply.github.com> --- cohere-openapi.yaml | 951 ++++++++++++++++-- .../snippets/python/chat-v2-post/default.py | 7 +- .../snippets/python/chat-v2-post/documents.py | 11 +- .../snippets/python/chat-v2-post/stream.py | 11 +- .../snippets/python/chat-v2-post/tools.py | 7 +- .../requests/chat-v2-post/default.yaml | 5 + .../requests/chat-v2-post/documents.yaml | 55 + .../requests/chat-v2-post/stream.yaml | 5 + .../snippets/requests/chat-v2-post/tools.yaml | 32 + .../responses/chat-v2-post/default.yaml | 15 + .../responses/chat-v2-post/documents.yaml | 267 +++++ .../responses/chat-v2-post/stream.yaml | 86 ++ .../responses/chat-v2-post/tools.yaml | 25 + 13 files changed, 1379 insertions(+), 98 deletions(-) create mode 100644 snippets/snippets/requests/chat-v2-post/default.yaml create mode 100644 snippets/snippets/requests/chat-v2-post/documents.yaml create mode 100644 snippets/snippets/requests/chat-v2-post/stream.yaml create mode 100644 snippets/snippets/requests/chat-v2-post/tools.yaml create mode 100644 snippets/snippets/responses/chat-v2-post/default.yaml create mode 100644 snippets/snippets/responses/chat-v2-post/documents.yaml create mode 100644 snippets/snippets/responses/chat-v2-post/stream.yaml create mode 100644 snippets/snippets/responses/chat-v2-post/tools.yaml diff --git a/cohere-openapi.yaml b/cohere-openapi.yaml index 2e2a1515..ff4f39c6 100644 --- a/cohere-openapi.yaml +++ b/cohere-openapi.yaml @@ -5841,7 +5841,7 @@ paths: finish_reason: $ref: "#/components/schemas/ChatFinishReason" message: - $ref: "#/components/schemas/AssistantMessage" + $ref: "#/components/schemas/AssistantMessageResponse" usage: $ref: "#/components/schemas/Usage" response-stream: @@ -5872,6 +5872,8 @@ paths: citation-start: "#/components/schemas/CitationStartEvent" citation-end: "#/components/schemas/CitationEndEvent" message-end: "#/components/schemas/ChatMessageEndEvent" + description: | + Generates a message from the model in response to a provided conversation. To learn how to use the Chat API with Streaming and RAG follow our Text Generation guides. requestBody: content: application/json: @@ -5883,7 +5885,11 @@ paths: properties: model: type: string - description: The model to use for the chat. + description: The name of a compatible [Cohere + model](https://docs.cohere.com/docs/models) (such as + command-r or command-r-plus) or the ID of a + [fine-tuned](https://docs.cohere.com/docs/chat-fine-tuning) + model. messages: $ref: "#/components/schemas/ChatMessages" tools: @@ -5904,7 +5910,7 @@ paths: 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: - $ref: "#/components/schemas/ResponseFormat" + $ref: "#/components/schemas/ResponseFormat-2" max_tokens: type: integer description: | @@ -6023,7 +6029,7 @@ paths: console.log(response); })(); - sdk: python - name: Sync + name: Default code: | import cohere @@ -6032,9 +6038,10 @@ paths: response = co.chat( model="command-r-plus", messages=[ - cohere.v2.ChatMessage2_User( - content="hello world!" - ) + { + "role": "user", + "content": "hello world!" + } ] ) @@ -6061,6 +6068,88 @@ paths: print(response) asyncio.run(main()) + request: + model: "command-r" + messages: + - role: "user" + content: "Tell me about LLMs" + stream: false + response: + body: + id: c14c80c3-18eb-4519-9460-6c92edd8cfb4 + message: + role: "assistant" + content: + - type: "text" + text: "LLMs stand for Large Language Models, which are a type of neural network + model specialized in processing and generating human + language. They are designed to understand and respond to + natural language input and have become increasingly + popular and valuable in recent years. + + + LLMs are trained on vast amounts of text data, enabling + them to learn patterns, grammar, and semantic meanings + present in the language. These models can then be used for + various natural language processing tasks, such as text + generation, summarization, question answering, machine + translation, sentiment analysis, and even some aspects of + natural language understanding. + + + Some well-known examples of LLMs include: + + + 1. GPT-3 (Generative Pre-trained Transformer 3) — An + open-source LLM developed by OpenAI, capable of generating + human-like text and performing various language tasks. + + + 2. BERT (Bidirectional Encoder Representations from + Transformers) — A Google-developed LLM that is + particularly good at understanding contextual + relationships in text, and is widely used for natural + language understanding tasks like sentiment analysis and + named entity recognition. + + + 3. T5 (Text-to-Text Transfer Transformer) — Also from + Google, T5 is a flexible LLM that frames all language + tasks as text-to-text problems, where the model learns to + generate output text based on input text prompts. + + + 4. RoBERTa (Robustly Optimized BERT Approach) — A variant + of BERT that uses additional training techniques to + improve performance. + + + 5. DeBERTa (Decoding-enhanced BERT with disentangled + attention) — Another variant of BERT that introduces a new + attention mechanism. + + + LLMs have become increasingly powerful and larger in + scale, improving the accuracy and sophistication of + language tasks. They are also being used as a foundation + for developing various applications, including chatbots, + content recommendation systems, language translation + services, and more.\ + + + The future of LLMs holds the potential for even more + sophisticated language technologies, with ongoing research + and development focused on enhancing their capabilities, + improving efficiency, and exploring their applications in + various domains." + finish_reason: complete + usage: + billed_units: + input_tokens: 5 + output_tokens: 418 + tokens: + input_tokens: 71 + output_tokens: 418 - code-samples: - sdk: typescript name: Documents @@ -6097,17 +6186,479 @@ paths: response = co.chat( model="command-r-plus", messages=[ - cohere.v2.ChatMessage2_User( - content=[ - cohere.v2.TextContent(text="Who's the best?"), - ], - documents=[{'id': '1', 'title': 'The best', 'text': 'Cohere is the best!'}] - ) + { + "role": "user", + "content": "Who's the best?", + "documents": [{'id': '1', 'title': 'The best', 'text': 'Cohere is the best!'}] + } ] ) print(response) + request: + model: "command-r" + messages: + - role: "user" + content: "Who is more popular: Nsync or Backstreet Boys?" + documents: + - title: "CSPC: Backstreet Boys Popularity Analysis - ChartMasters" + snippet: >- + ↓ Skip to Main Content + + + Music industry – One step closer to being accurate + + + CSPC: Backstreet Boys Popularity Analysis + + + Hernán Lopez Posted on February 9, 2017 Posted in CSPC 72 + Comments Tagged with Backstreet Boys, Boy band + + + 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. + + + 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. + - title: "CSPC: NSYNC Popularity Analysis - ChartMasters" + snippet: >- + ↓ Skip to Main Content + + + Music industry – One step closer to being accurate + + + CSPC: NSYNC Popularity Analysis + + + MJD Posted on February 9, 2018 Posted in CSPC 27 Comments + Tagged with Boy band, N'Sync + + + 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. + + + 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. + - title: "CSPC: Backstreet Boys Popularity Analysis - ChartMasters" + snippet: >- + 1997, 1998, 2000 and 2001 also rank amongst some of the + very best years. + + 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. + + + We will try to analyze the extent of that hegemony with + this new article with final results which will more than + surprise many readers. + - title: "CSPC: NSYNC Popularity Analysis - ChartMasters" + snippet: >- + Was the teen group led by Justin Timberlake really that + big? Was it only in the US where they found success? Or + were they a global phenomenon? + + 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. + stream: false + response: + body: + id: c14c80c3-18eb-4519-9460-6c92edd8cfb4 + message: + role: "assistant" + content: + - type: "text" + text: >- + Both NSync and Backstreet Boys were extremely popular at + the turn of the millennium. Backstreet Boys had massive + album sales across the globe, great singles sales, plenty + of chart-topping releases, hyped tours, and tremendous + media coverage. NSync also had huge sales, with their + album No Strings Attached selling 2.4 million units in its + first week. They also had the second fastest-selling album + of the Soundscan era before 2015, with Celebrity debuting + at 1.88 million units sold. + + + While it is difficult to say for sure which of the two + bands was more popular, Backstreet Boys did have success + in some countries that were traditionally hard to + penetrate for Western artists. + citations: + - start: 36 + end: 84 + text: extremely popular at the turn of the millennium. + sources: + - type: document + id: doc_1 + document: + snippet: >- + ↓ Skip to Main Content + + + Music industry – One step closer to being accurate + + + CSPC: NSYNC Popularity Analysis + + + MJD Posted on February 9, 2018 Posted in CSPC 27 + Comments Tagged with Boy band, N'Sync + + + 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. + + + 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. + title: "CSPC: NSYNC Popularity Analysis - ChartMasters" + - start: 105 + end: 141 + text: massive album sales across the globe + sources: + - type: document + id: doc_0 + document: + snippet: >- + ↓ Skip to Main Content + + + Music industry – One step closer to being accurate + + + CSPC: Backstreet Boys Popularity Analysis + + + Hernán Lopez Posted on February 9, 2017 Posted in + CSPC 72 Comments Tagged with Backstreet Boys, Boy + band + + + 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. + + + 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. + title: "CSPC: Backstreet Boys Popularity Analysis - ChartMasters" + - start: 143 + end: 162 + text: great singles sales + sources: + - type: document + id: doc_0 + document: + snippet: >- + ↓ Skip to Main Content + + + Music industry – One step closer to being accurate + + + CSPC: Backstreet Boys Popularity Analysis + + + Hernán Lopez Posted on February 9, 2017 Posted in + CSPC 72 Comments Tagged with Backstreet Boys, Boy + band + + + 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. + + + 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. + title: "CSPC: Backstreet Boys Popularity Analysis - ChartMasters" + - start: 164 + end: 196 + text: plenty of chart-topping releases + sources: + - type: document + id: doc_0 + document: + snippet: >- + ↓ Skip to Main Content + + + Music industry – One step closer to being accurate + + + CSPC: Backstreet Boys Popularity Analysis + + + Hernán Lopez Posted on February 9, 2017 Posted in + CSPC 72 Comments Tagged with Backstreet Boys, Boy + band + + + 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. + + + 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. + title: "CSPC: Backstreet Boys Popularity Analysis - ChartMasters" + - start: 198 + end: 209 + text: hyped tours + sources: + - type: document + id: doc_0 + document: + snippet: >- + ↓ Skip to Main Content + + + Music industry – One step closer to being accurate + + + CSPC: Backstreet Boys Popularity Analysis + + + Hernán Lopez Posted on February 9, 2017 Posted in + CSPC 72 Comments Tagged with Backstreet Boys, Boy + band + + + 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. + + + 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. + title: "CSPC: Backstreet Boys Popularity Analysis - ChartMasters" + - start: 215 + end: 241 + text: tremendous media coverage. + sources: + - type: document + id: doc_0 + document: + snippet: >- + ↓ Skip to Main Content + + + Music industry – One step closer to being accurate + + + CSPC: Backstreet Boys Popularity Analysis + + + Hernán Lopez Posted on February 9, 2017 Posted in + CSPC 72 Comments Tagged with Backstreet Boys, Boy + band + + + 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. + + + 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. + title: "CSPC: Backstreet Boys Popularity Analysis - ChartMasters" + - start: 280 + end: 350 + text: album No Strings Attached selling 2.4 million units in its first week. + sources: + - type: document + id: doc_1 + document: + snippet: >- + ↓ Skip to Main Content + + + Music industry – One step closer to being accurate + + + CSPC: NSYNC Popularity Analysis + + + MJD Posted on February 9, 2018 Posted in CSPC 27 + Comments Tagged with Boy band, N'Sync + + + 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. + + + 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. + title: "CSPC: NSYNC Popularity Analysis - ChartMasters" + - start: 369 + end: 430 + text: second fastest-selling album of the Soundscan era before 2015 + sources: + - type: document + id: doc_1 + document: + snippet: >- + ↓ Skip to Main Content + + + Music industry – One step closer to being accurate + + + CSPC: NSYNC Popularity Analysis + + + MJD Posted on February 9, 2018 Posted in CSPC 27 + Comments Tagged with Boy band, N'Sync + + + 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. + + + 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. + title: "CSPC: NSYNC Popularity Analysis - ChartMasters" + - start: 437 + end: 483 + text: Celebrity debuting at 1.88 million units sold. + sources: + - type: document + id: doc_1 + document: + snippet: >- + ↓ Skip to Main Content + + + Music industry – One step closer to being accurate + + + CSPC: NSYNC Popularity Analysis + + + MJD Posted on February 9, 2018 Posted in CSPC 27 + Comments Tagged with Boy band, N'Sync + + + 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. + + + 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. + title: "CSPC: NSYNC Popularity Analysis - ChartMasters" + - start: 589 + end: 677 + text: success in some countries that were traditionally hard to penetrate for + Western artists. + sources: + - type: document + id: doc_2 + document: + snippet: >- + 1997, 1998, 2000 and 2001 also rank amongst some of + the very best years. + + 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. + + + We will try to analyze the extent of that hegemony + with this new article with final results which will + more than surprise many readers. + title: "CSPC: Backstreet Boys Popularity Analysis - ChartMasters" + finish_reason: complete + usage: + billed_units: + input_tokens: 682 + output_tokens: 143 + tokens: + input_tokens: 1380 + output_tokens: 434 - code-samples: - sdk: typescript name: Streaming @@ -6145,15 +6696,108 @@ paths: response = co.chat_stream( model="command-r-plus", messages=[ - cohere.v2.ChatMessage2_User( - content="hello world!" - ) + { + "role": "user", + "content": "hello world!" + } ] ) for event in response: - if event.event_type == "text-generation": - print(event.text, end='') + if event.type == "content-delta": + print(event.delta.message.content.text, end='') + request: + model: "command-r" + messages: + - role: "user" + content: "Hello!" + stream: true + response: + stream: + - type: message-start + id: 29f14a5a-11de-4cae-9800-25e4747408ea + delta: + message: + role: "assistant" + content: [] + tool_plan: "" + tool_calls: [] + citations: [] + - type: content-start + index: 0 + delta: + message: + content: + type: "text" + text: "" + - type: content-delta + index: 0 + delta: + message: + content: + text: "Hello" + - type: content-delta + index: 0 + delta: + message: + content: + text: "!" + - type: content-delta + index: 0 + delta: + message: + content: + text: " How" + - type: content-delta + index: 0 + delta: + message: + content: + text: " can" + - type: content-delta + index: 0 + delta: + message: + content: + text: " I" + - type: content-delta + index: 0 + delta: + message: + content: + text: " help" + - type: content-delta + index: 0 + delta: + message: + content: + text: " you" + - type: content-delta + index: 0 + delta: + message: + content: + text: " today" + - type: content-delta + index: 0 + delta: + message: + content: + text: "?" + - type: content-end + index: 0 + - event_type: message-end + delta: + finish_reason: complete + usage: + api_version: + version: '2' + billed_units: + input_tokens: 3 + output_tokens: 9 + tokens: + input_tokens: 69 + output_tokens: 9 - code-samples: - sdk: typescript name: Tools @@ -6248,14 +6892,76 @@ paths: }) ], messages=[ - cohere.v2.ChatMessage2_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?" - ) + { + "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?" + } ] ) print(response) + request: + model: "command-r" + messages: + - role: "user" + content: "Tell me about LLMs" + tools: + - 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: + type: object + properties: + day: + description: Retrieves sales data for this day, formatted as YYYY-MM-DD. + type: str + required: + - day + - 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: + type: object + properties: + category: + description: Retrieves product information data for all products in this + category. + type: str + required: + - category + stream: false + response: + body: + id: 9e5f00aa-bf1e-481a-abe3-0eceac18c3ec + message: + role: "assistant" + tool_plan: "I will first find the sales summary for 29th September 2023. Then, I + wil" + find the details of the products in the 'Electronics' category." tool_calls: + - id: query_daily_sales_report_hgxxmkby3wta + type: function + function: + name: query_daily_sales_report + arguments: "{\"day\": \"2023-09-29\"}" + - id: query_product_catalog_rpg0z5h8yyz2 + type: function + function: + name: query_product_catalog + arguments: "{\"category\": \"Electronics\"}" + finish_reason: "tool_call" + usage: + billed_units: + input_tokens: 127 + output_tokens: 69 + tokens: + input_tokens: 1032 + output_tokens: 124 /v1/generate: post: x-fern-audiences: @@ -15804,6 +16510,57 @@ components: tool-calls-generation: "#/components/schemas/ChatToolCallsGenerationEvent" stream-end: "#/components/schemas/ChatStreamEndEvent" tool-calls-chunk: "#/components/schemas/ChatToolCallsChunkEvent" + TextContent: + x-fern-sdk-group-name: v2 + type: object + description: Text content of the message. + required: + - type + - text + properties: + type: + type: string + enum: + - text + text: + type: string + Content: + x-fern-sdk-group-name: v2 + description: A Content block which contains information about the content type + and the content itself. + oneOf: + - $ref: "#/components/schemas/TextContent" + discriminator: + propertyName: type + mapping: + text: "#/components/schemas/TextContent" + UserMessage: + x-fern-sdk-group-name: v2 + type: object + description: A message from the user. + required: + - role + - content + properties: + role: + type: string + 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 + items: + $ref: "#/components/schemas/Content" + documents: + type: array + minItems: 0 + description: Documents seen by the model when generating the reply. + items: + $ref: "#/components/schemas/ChatDocument" ToolCall-2: x-fern-sdk-group-name: v2 description: A array of tool calls to be made. @@ -15822,20 +16579,6 @@ components: type: string arguments: type: string - TextContent: - x-fern-sdk-group-name: v2 - type: object - description: Text content of the message. - required: - - type - - text - properties: - type: - type: string - enum: - - text - text: - type: string ToolSource: x-fern-sdk-group-name: v2 type: object @@ -15904,9 +16647,16 @@ components: tool_plan: type: string content: - type: array - items: - $ref: "#/components/schemas/TextContent" + oneOf: + - type: string + - type: array + items: + oneOf: + - $ref: "#/components/schemas/TextContent" + discriminator: + propertyName: type + mapping: + text: "#/components/schemas/TextContent" citations: type: array items: @@ -15934,45 +16684,6 @@ components: propertyName: type mapping: text: "#/components/schemas/TextContent" - Content: - x-fern-sdk-group-name: v2 - description: A Content block which contains information about the content type - and the content itself. - oneOf: - - $ref: "#/components/schemas/TextContent" - discriminator: - propertyName: type - mapping: - text: "#/components/schemas/TextContent" - UserMessage: - x-fern-sdk-group-name: v2 - type: object - description: A message from the user. - required: - - role - - content - properties: - role: - type: string - 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 - items: - $ref: "#/components/schemas/Content" - documents: - type: array - x-fern-audiences: - - public - minItems: 0 - description: Documents seen by the model when generating the reply. - items: - $ref: "#/components/schemas/ChatDocument" ToolContent: x-fern-sdk-group-name: v2 type: object @@ -16016,21 +16727,24 @@ components: x-fern-sdk-group-name: v2 description: Represents a single message in the chat history from a given role. oneOf: - - $ref: "#/components/schemas/SystemMessage" - $ref: "#/components/schemas/UserMessage" - $ref: "#/components/schemas/AssistantMessage" + - $ref: "#/components/schemas/SystemMessage" - $ref: "#/components/schemas/ToolMessage-2" discriminator: propertyName: role mapping: + user: "#/components/schemas/UserMessage" assistant: "#/components/schemas/AssistantMessage" system: "#/components/schemas/SystemMessage" - user: "#/components/schemas/UserMessage" tool: "#/components/schemas/ToolMessage-2" ChatMessages: x-fern-sdk-group-name: v2 type: array - description: A list of chat messages representing the list chat message turns. + description: | + A list of chat messages in chronological order, representing a conversation between the user and the model. + + Messages can be from `User`, `Assistant`, `Tool` and `System` roles. Learn more about messages and roles in [the Chat API guide](https://docs.cohere.com/docs/chat-api). items: $ref: "#/components/schemas/ChatMessage-2" Tool-2: @@ -16054,6 +16768,50 @@ components: parameters: type: object description: The parameters of the function as a JSON schema. + JSONResponseFormat-2: + x-fern-audiences: + - public + type: object + properties: + type: + $ref: "#/components/schemas/ResponseFormatType" + json_schema: + description: | + [BETA] A JSON schema object that the output will adhere to. There are some restrictions we have on the schema, refer to [our guide](/docs/structured-outputs-json#schema-constraints) for more information. + Example (required name and age object): + ```json + { + "type": "object", + "properties": { + "name": {"type": "string"}, + "age": {"type": "integer"} + }, + "required": ["name", "age"] + } + ``` + + **Note**: This field must not be specified when the `type` is set to `"text"`. + type: object + required: + - type + ResponseFormat-2: + description: | + Configuration for forcing the model output to adhere to the specified format. Supported on [Command R](https://docs.cohere.com/docs/command-r), [Command R+](https://docs.cohere.com/docs/command-r-plus) and newer models. + + The model can be forced into outputting JSON objects (with up to 5 levels of nesting) by setting `{ "type": "json_object" }`. + + A [JSON Schema](https://json-schema.org/) can optionally be provided, to ensure a specific structure. + + **Note**: When using `{ "type": "json_object" }` your `message` should always explicitly instruct the model to generate a JSON (eg: _"Generate a JSON ..."_) . Otherwise the model may end up getting stuck generating an infinite stream of characters and eventually run out of context length. + **Limitation**: The parameter is not supported in RAG mode (when any of `connectors`, `documents`, `tools`, `tool_results` are provided). + oneOf: + - $ref: "#/components/schemas/TextResponseFormat" + - $ref: "#/components/schemas/JSONResponseFormat-2" + discriminator: + propertyName: type + mapping: + text: "#/components/schemas/TextResponseFormat" + json_object: "#/components/schemas/JSONResponseFormat-2" ChatFinishReason: x-fern-sdk-group-name: v2 description: The reason a chat request has finished. @@ -16066,6 +16824,37 @@ components: - error - content_blocked - error_limit + AssistantMessageResponse: + x-fern-sdk-group-name: v2 + type: object + description: A message from the assistant role can contain text and tool call + information. + required: + - role + properties: + role: + type: string + enum: + - assistant + tool_calls: + type: array + items: + $ref: "#/components/schemas/ToolCall-2" + tool_plan: + type: string + content: + type: array + items: + oneOf: + - $ref: "#/components/schemas/TextContent" + discriminator: + propertyName: type + mapping: + text: "#/components/schemas/TextContent" + citations: + type: array + items: + $ref: "#/components/schemas/Citation" Usage: x-fern-sdk-group-name: v2 type: object @@ -16114,7 +16903,7 @@ components: finish_reason: $ref: "#/components/schemas/ChatFinishReason" message: - $ref: "#/components/schemas/AssistantMessage" + $ref: "#/components/schemas/AssistantMessageResponse" usage: $ref: "#/components/schemas/Usage" ChatStreamEventType: diff --git a/snippets/snippets/python/chat-v2-post/default.py b/snippets/snippets/python/chat-v2-post/default.py index fa156470..29e15f89 100644 --- a/snippets/snippets/python/chat-v2-post/default.py +++ b/snippets/snippets/python/chat-v2-post/default.py @@ -5,9 +5,10 @@ response = co.chat( model="command-r-plus", messages=[ - cohere.v2.ChatMessage2_User( - content="hello world!" - ) + { + "role": "user", + "content": "hello world!" + } ] ) diff --git a/snippets/snippets/python/chat-v2-post/documents.py b/snippets/snippets/python/chat-v2-post/documents.py index 4eee183d..e7f97724 100644 --- a/snippets/snippets/python/chat-v2-post/documents.py +++ b/snippets/snippets/python/chat-v2-post/documents.py @@ -5,12 +5,11 @@ response = co.chat( model="command-r-plus", messages=[ - cohere.v2.ChatMessage2_User( - content=[ - cohere.v2.TextContent(text="Who's the best?"), - ], - documents=[{'id': '1', 'title': 'The best', 'text': 'Cohere is the best!'}] - ) + { + "role": "user", + "content": "Who's the best?", + "documents": [{'id': '1', 'title': 'The best', 'text': 'Cohere is the best!'}] + } ] ) diff --git a/snippets/snippets/python/chat-v2-post/stream.py b/snippets/snippets/python/chat-v2-post/stream.py index 05d21cf3..8c54b29b 100644 --- a/snippets/snippets/python/chat-v2-post/stream.py +++ b/snippets/snippets/python/chat-v2-post/stream.py @@ -5,12 +5,13 @@ response = co.chat_stream( model="command-r-plus", messages=[ - cohere.v2.ChatMessage2_User( - content="hello world!" - ) + { + "role": "user", + "content": "hello world!" + } ] ) for event in response: - if event.event_type == "text-generation": - print(event.text, end='') + if event.type == "content-delta": + print(event.delta.message.content.text, end='') diff --git a/snippets/snippets/python/chat-v2-post/tools.py b/snippets/snippets/python/chat-v2-post/tools.py index 2798e18b..c67d3428 100644 --- a/snippets/snippets/python/chat-v2-post/tools.py +++ b/snippets/snippets/python/chat-v2-post/tools.py @@ -29,9 +29,10 @@ }) ], messages=[ - cohere.v2.ChatMessage2_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?" - ) + { + "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?" + } ] ) diff --git a/snippets/snippets/requests/chat-v2-post/default.yaml b/snippets/snippets/requests/chat-v2-post/default.yaml new file mode 100644 index 00000000..c9260319 --- /dev/null +++ b/snippets/snippets/requests/chat-v2-post/default.yaml @@ -0,0 +1,5 @@ +model: "command-r" +messages: + - role: "user" + content: "Tell me about LLMs" +stream: false diff --git a/snippets/snippets/requests/chat-v2-post/documents.yaml b/snippets/snippets/requests/chat-v2-post/documents.yaml new file mode 100644 index 00000000..605f9ce3 --- /dev/null +++ b/snippets/snippets/requests/chat-v2-post/documents.yaml @@ -0,0 +1,55 @@ +model: "command-r" +messages: + - role: "user" + content: "Who is more popular: Nsync or Backstreet Boys?" + documents: + - title: "CSPC: Backstreet Boys Popularity Analysis - ChartMasters" + snippet: >- + ↓ Skip to Main Content + + + Music industry – One step closer to being accurate + + + CSPC: Backstreet Boys Popularity Analysis + + + Hernán Lopez Posted on February 9, 2017 Posted in CSPC 72 Comments Tagged with Backstreet Boys, Boy band + + + 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. + + + 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. + - title: "CSPC: NSYNC Popularity Analysis - ChartMasters" + snippet: >- + ↓ Skip to Main Content + + + Music industry – One step closer to being accurate + + + CSPC: NSYNC Popularity Analysis + + + MJD Posted on February 9, 2018 Posted in CSPC 27 Comments Tagged with Boy band, N'Sync + + + 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. + + + 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. + - title: "CSPC: Backstreet Boys Popularity Analysis - ChartMasters" + snippet: >-2 + 1997, 1998, 2000 and 2001 also rank amongst some of the very best years. + + 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. + + + We will try to analyze the extent of that hegemony with this new article with final results which will more than surprise many readers. + - title: "CSPC: NSYNC Popularity Analysis - ChartMasters" + snippet: >-2 + 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? + + 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. +stream: false diff --git a/snippets/snippets/requests/chat-v2-post/stream.yaml b/snippets/snippets/requests/chat-v2-post/stream.yaml new file mode 100644 index 00000000..eddd6609 --- /dev/null +++ b/snippets/snippets/requests/chat-v2-post/stream.yaml @@ -0,0 +1,5 @@ +model: "command-r" +messages: + - role: "user" + content: "Hello!" +stream: true diff --git a/snippets/snippets/requests/chat-v2-post/tools.yaml b/snippets/snippets/requests/chat-v2-post/tools.yaml new file mode 100644 index 00000000..0f6d95e6 --- /dev/null +++ b/snippets/snippets/requests/chat-v2-post/tools.yaml @@ -0,0 +1,32 @@ +model: "command-r" +messages: + - role: "user" + content: "Tell me about LLMs" +tools: + - 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: + type: object + properties: + day: + description: Retrieves sales data for this day, formatted as YYYY-MM-DD. + type: str + required: + - day + - 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: + type: object + properties: + category: + description: Retrieves product information data for all products in this category. + type: str + required: + - category +stream: false diff --git a/snippets/snippets/responses/chat-v2-post/default.yaml b/snippets/snippets/responses/chat-v2-post/default.yaml new file mode 100644 index 00000000..2f5932a3 --- /dev/null +++ b/snippets/snippets/responses/chat-v2-post/default.yaml @@ -0,0 +1,15 @@ +body: + id: c14c80c3-18eb-4519-9460-6c92edd8cfb4 + message: + role: "assistant" + content: + - type: "text" + text: "LLMs stand for Large Language Models, which are a type of neural network model specialized in processing and generating human language. They are designed to understand and respond to natural language input and have become increasingly popular and valuable in recent years.\n\nLLMs are trained on vast amounts of text data, enabling them to learn patterns, grammar, and semantic meanings present in the language. These models can then be used for various natural language processing tasks, such as text generation, summarization, question answering, machine translation, sentiment analysis, and even some aspects of natural language understanding.\n\nSome well-known examples of LLMs include:\n\n1. GPT-3 (Generative Pre-trained Transformer 3) — An open-source LLM developed by OpenAI, capable of generating human-like text and performing various language tasks.\n\n2. BERT (Bidirectional Encoder Representations from Transformers) — A Google-developed LLM that is particularly good at understanding contextual relationships in text, and is widely used for natural language understanding tasks like sentiment analysis and named entity recognition.\n\n3. T5 (Text-to-Text Transfer Transformer) — Also from Google, T5 is a flexible LLM that frames all language tasks as text-to-text problems, where the model learns to generate output text based on input text prompts.\n\n4. RoBERTa (Robustly Optimized BERT Approach) — A variant of BERT that uses additional training techniques to improve performance.\n\n5. DeBERTa (Decoding-enhanced BERT with disentangled attention) — Another variant of BERT that introduces a new attention mechanism.\n\nLLMs have become increasingly powerful and larger in scale, improving the accuracy and sophistication of language tasks. They are also being used as a foundation for developing various applications, including chatbots, content recommendation systems, language translation services, and more. \n\nThe future of LLMs holds the potential for even more sophisticated language technologies, with ongoing research and development focused on enhancing their capabilities, improving efficiency, and exploring their applications in various domains." + finish_reason: complete + usage: + billed_units: + input_tokens: 5 + output_tokens: 418 + tokens: + input_tokens: 71 + output_tokens: 418 diff --git a/snippets/snippets/responses/chat-v2-post/documents.yaml b/snippets/snippets/responses/chat-v2-post/documents.yaml new file mode 100644 index 00000000..8dd33536 --- /dev/null +++ b/snippets/snippets/responses/chat-v2-post/documents.yaml @@ -0,0 +1,267 @@ +body: + id: c14c80c3-18eb-4519-9460-6c92edd8cfb4 + message: + role: "assistant" + content: + - type: "text" + text: >- + Both NSync and Backstreet Boys were extremely popular at the turn of the + millennium. Backstreet Boys had massive album sales across the globe, + great singles sales, plenty of chart-topping releases, hyped tours, and + tremendous media coverage. NSync also had huge sales, with their album No + Strings Attached selling 2.4 million units in its first week. They also + had the second fastest-selling album of the Soundscan era before 2015, + with Celebrity debuting at 1.88 million units sold. + + + While it is difficult to say for sure which of the two bands was more popular, Backstreet Boys did have success in some countries that were traditionally hard to penetrate for Western artists. + citations: + - start: 36 + end: 84 + text: extremely popular at the turn of the millennium. + sources: + - type: document + id: doc_1 + document: + snippet: >- + ↓ Skip to Main Content + + + Music industry – One step closer to being accurate + + + CSPC: NSYNC Popularity Analysis + + + MJD Posted on February 9, 2018 Posted in CSPC 27 Comments Tagged with Boy band, N'Sync + + + 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. + + + 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. + title: "CSPC: NSYNC Popularity Analysis - ChartMasters" + - start: 105 + end: 141 + text: massive album sales across the globe + sources: + - type: document + id: doc_0 + document: + snippet: >- + ↓ Skip to Main Content + + + Music industry – One step closer to being accurate + + + CSPC: Backstreet Boys Popularity Analysis + + + Hernán Lopez Posted on February 9, 2017 Posted in CSPC 72 Comments Tagged with Backstreet Boys, Boy band + + + 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. + + + 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. + title: "CSPC: Backstreet Boys Popularity Analysis - ChartMasters" + - start: 143 + end: 162 + text: great singles sales + sources: + - type: document + id: doc_0 + document: + snippet: >- + ↓ Skip to Main Content + + + Music industry – One step closer to being accurate + + + CSPC: Backstreet Boys Popularity Analysis + + + Hernán Lopez Posted on February 9, 2017 Posted in CSPC 72 Comments Tagged with Backstreet Boys, Boy band + + + 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. + + + 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. + title: "CSPC: Backstreet Boys Popularity Analysis - ChartMasters" + - start: 164 + end: 196 + text: plenty of chart-topping releases + sources: + - type: document + id: doc_0 + document: + snippet: >- + ↓ Skip to Main Content + + + Music industry – One step closer to being accurate + + + CSPC: Backstreet Boys Popularity Analysis + + + Hernán Lopez Posted on February 9, 2017 Posted in CSPC 72 Comments Tagged with Backstreet Boys, Boy band + + + 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. + + + 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. + title: "CSPC: Backstreet Boys Popularity Analysis - ChartMasters" + - start: 198 + end: 209 + text: hyped tours + sources: + - type: document + id: doc_0 + document: + snippet: >- + ↓ Skip to Main Content + + + Music industry – One step closer to being accurate + + + CSPC: Backstreet Boys Popularity Analysis + + + Hernán Lopez Posted on February 9, 2017 Posted in CSPC 72 Comments Tagged with Backstreet Boys, Boy band + + + 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. + + + 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. + title: "CSPC: Backstreet Boys Popularity Analysis - ChartMasters" + - start: 215 + end: 241 + text: tremendous media coverage. + sources: + - type: document + id: doc_0 + document: + snippet: >- + ↓ Skip to Main Content + + + Music industry – One step closer to being accurate + + + CSPC: Backstreet Boys Popularity Analysis + + + Hernán Lopez Posted on February 9, 2017 Posted in CSPC 72 Comments Tagged with Backstreet Boys, Boy band + + + 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. + + + 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. + title: "CSPC: Backstreet Boys Popularity Analysis - ChartMasters" + - start: 280 + end: 350 + text: album No Strings Attached selling 2.4 million units in its first week. + sources: + - type: document + id: doc_1 + document: + snippet: >- + ↓ Skip to Main Content + + + Music industry – One step closer to being accurate + + + CSPC: NSYNC Popularity Analysis + + + MJD Posted on February 9, 2018 Posted in CSPC 27 Comments Tagged with Boy band, N'Sync + + + 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. + + + 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. + title: "CSPC: NSYNC Popularity Analysis - ChartMasters" + - start: 369 + end: 430 + text: second fastest-selling album of the Soundscan era before 2015 + sources: + - type: document + id: doc_1 + document: + snippet: >- + ↓ Skip to Main Content + + + Music industry – One step closer to being accurate + + + CSPC: NSYNC Popularity Analysis + + + MJD Posted on February 9, 2018 Posted in CSPC 27 Comments Tagged with Boy band, N'Sync + + + 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. + + + 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. + title: "CSPC: NSYNC Popularity Analysis - ChartMasters" + - start: 437 + end: 483 + text: Celebrity debuting at 1.88 million units sold. + sources: + - type: document + id: doc_1 + document: + snippet: >- + ↓ Skip to Main Content + + + Music industry – One step closer to being accurate + + + CSPC: NSYNC Popularity Analysis + + + MJD Posted on February 9, 2018 Posted in CSPC 27 Comments Tagged with Boy band, N'Sync + + + 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. + + + 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. + title: "CSPC: NSYNC Popularity Analysis - ChartMasters" + - start: 589 + end: 677 + text: success in some countries that were traditionally hard to penetrate for + Western artists. + sources: + - type: document + id: doc_2 + document: + snippet: >-2 + 1997, 1998, 2000 and 2001 also rank amongst some of the very best years. + + 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. + + + We will try to analyze the extent of that hegemony with this new article with final results which will more than surprise many readers. + title: "CSPC: Backstreet Boys Popularity Analysis - ChartMasters" + finish_reason: complete + usage: + billed_units: + input_tokens: 682 + output_tokens: 143 + tokens: + input_tokens: 1380 + output_tokens: 434 diff --git a/snippets/snippets/responses/chat-v2-post/stream.yaml b/snippets/snippets/responses/chat-v2-post/stream.yaml new file mode 100644 index 00000000..18b43d1f --- /dev/null +++ b/snippets/snippets/responses/chat-v2-post/stream.yaml @@ -0,0 +1,86 @@ +--- +stream: +- type: message-start + id: 29f14a5a-11de-4cae-9800-25e4747408ea + delta: + message: + role: "assistant" + content: [] + tool_plan: "" + tool_calls: [] + citations: [] +- type: content-start + index: 0 + delta: + message: + content: + type: "text" + text: "" +- type: content-delta + index: 0 + delta: + message: + content: + text: "Hello" +- type: content-delta + index: 0 + delta: + message: + content: + text: "!" +- type: content-delta + index: 0 + delta: + message: + content: + text: " How" +- type: content-delta + index: 0 + delta: + message: + content: + text: " can" +- type: content-delta + index: 0 + delta: + message: + content: + text: " I" +- type: content-delta + index: 0 + delta: + message: + content: + text: " help" +- type: content-delta + index: 0 + delta: + message: + content: + text: " you" +- type: content-delta + index: 0 + delta: + message: + content: + text: " today" +- type: content-delta + index: 0 + delta: + message: + content: + text: "?" +- type: content-end + index: 0 +- event_type: message-end + delta: + finish_reason: complete + usage: + api_version: + version: '2' + billed_units: + input_tokens: 3 + output_tokens: 9 + tokens: + input_tokens: 69 + output_tokens: 9 diff --git a/snippets/snippets/responses/chat-v2-post/tools.yaml b/snippets/snippets/responses/chat-v2-post/tools.yaml new file mode 100644 index 00000000..1bc93d7e --- /dev/null +++ b/snippets/snippets/responses/chat-v2-post/tools.yaml @@ -0,0 +1,25 @@ +body: + id: 9e5f00aa-bf1e-481a-abe3-0eceac18c3ec + message: + role: "assistant" + tool_plan: "I will first find the sales summary for 29th September 2023. Then, I will +find the details of the products in the 'Electronics' category." + tool_calls: + - id: query_daily_sales_report_hgxxmkby3wta + type: function + function: + name: query_daily_sales_report + arguments: "{\"day\": \"2023-09-29\"}" + - id: query_product_catalog_rpg0z5h8yyz2 + type: function + function: + name: query_product_catalog + arguments: "{\"category\": \"Electronics\"}" + finish_reason: "tool_call" + usage: + billed_units: + input_tokens: 127 + output_tokens: 69 + tokens: + input_tokens: 1032 + output_tokens: 124