curl --location --request POST https://api.writer.com/v1/chat \ --header "Authorization: Bearer <token>" \ --header "Content-Type: application/json" \--data-raw '{"model":"palmyra-x5","messages":[{"content":"Write a memo summarizing this earnings report.","role":"user"}]}'
import os
from writerai import Writer
client = Writer(
# This is the default and can be omitted
api_key=os.environ.get("WRITER_API_KEY"),
)
chat = client.chat.chat(
messages=[{
"content": "Write a memo summarizing this earnings report.",
"role": "user",
}],
model="palmyra-x5",
)
print(chat.id)
import Writer from 'writer-sdk';
const client = new Writer({
apiKey: process.env['WRITER_API_KEY'], // This is the default and can be omitted
});
async function main() {
const chat = await client.chat.chat({
messages: [{ content: 'Write a memo summarizing this earnings report.', role: 'user' }],
model: 'palmyra-x5',
});
console.log(chat.id);
}
main();
Generate a chat completion based on the provided messages. The response shown below is for non-streaming. To learn about streaming responses, see the chat completion guide.
POST
/
v1
/
chat
cURL
curl --location --request POST https://api.writer.com/v1/chat \ --header "Authorization: Bearer <token>" \ --header "Content-Type: application/json" \--data-raw '{"model":"palmyra-x5","messages":[{"content":"Write a memo summarizing this earnings report.","role":"user"}]}'
import os
from writerai import Writer
client = Writer(
# This is the default and can be omitted
api_key=os.environ.get("WRITER_API_KEY"),
)
chat = client.chat.chat(
messages=[{
"content": "Write a memo summarizing this earnings report.",
"role": "user",
}],
model="palmyra-x5",
)
print(chat.id)
import Writer from 'writer-sdk';
const client = new Writer({
apiKey: process.env['WRITER_API_KEY'], // This is the default and can be omitted
});
async function main() {
const chat = await client.chat.chat({
messages: [{ content: 'Write a memo summarizing this earnings report.', role: 'user' }],
model: 'palmyra-x5',
});
console.log(chat.id);
}
main();
Deprecation notice: Palmyra X4 (palmyra-x4) and Palmyra X5 (palmyra-x5) will be deprecated on December 14, 2026.Migration path: Use Palmyra X6 (palmyra-x6) instead. Palmyra X6 has a 1M token context window (Palmyra X4 is 128k). See pricing for cost details and the deprecation policy for more information.
The ID of the model to use for creating the chat completion. This can be a Palmyra model such as palmyra-x5 or palmyra-x4, or the ID of an external model configured for your organization.
Defines the maximum number of tokens (words and characters) that the model can generate in the response. This can be adjusted to allow for longer or shorter responses as needed. The maximum value varies by model. See the models overview for more information about the maximum number of tokens for each model.
Controls the randomness or creativity of the model's responses. A higher temperature results in more varied and less predictable text, while a lower temperature produces more deterministic and conservative outputs.
Sets the threshold for "nucleus sampling," a technique to focus the model's token generation on the most likely subset of tokens. Only tokens with cumulative probability above this threshold are considered, controlling the trade-off between creativity and coherence.
Specifies the number of completions (responses) to generate from the model in a single request. This parameter allows for generating multiple responses, offering a variety of potential replies from which to choose.
A token or sequence of tokens that, when generated, will cause the model to stop producing further content. This can be a single token or an array of tokens, acting as a signal to end the output.
Indicates whether the response should be streamed incrementally as it is generated or only returned once fully complete. Streaming can be useful for providing real-time feedback in interactive applications.
An array containing tool definitions for tools that the model can use to generate responses. The tool definitions use JSON schema. You can define your own functions or use one of the built-in graph, llm, translation, or vision tools. Note that you can only use one built-in tool type in the array (only one of graph, llm, translation, or vision). You can pass multiple custom tools of type function in the same request.
auto: allows the model to automatically choose the tool to use, or not call a tool
none: disables tool calling; the model will instead generate a message
required: requires the model to call one or more tools
You can also use a JSON object to force the model to call a specific tool. For example, {"type": "function", "function": {"name": "get_current_weather"}} requires the model to call the get_current_weather function, regardless of the prompt.
The response format to use for the chat completion, available with palmyra-x4 and palmyra-x5.
text is the default response format. JSON Schema is supported for structured responses. If you specify json_schema, you must also provide a json_schema object.
A globally unique identifier (UUID) for the response generated by the API. This ID can be used to reference the specific operation or transaction within the system for tracking or debugging purposes.
The Unix timestamp (in seconds) when the response was created. This timestamp can be used to verify the timing of the response relative to other events or operations.
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Writer AI Studio","colors":{"primary":"#BFCBFF","light":"#6985FF","dark":"#5551ff"},"logo":{"light":"https://mintcdn.com/writer/YZ72OUP7BQyK8p2G/logo/writer_logo_light.svg?fit=max\u0026auto=format\u0026n=YZ72OUP7BQyK8p2G\u0026q=85\u0026s=c9a784871f9b98724bb1eae947e745ed","dark":"https://mintcdn.com/writer/YZ72OUP7BQyK8p2G/logo/writer_logo_dark.svg?fit=max\u0026auto=format\u0026n=YZ72OUP7BQyK8p2G\u0026q=85\u0026s=9e22a34b91e20df881d68634a0042c1d"},"favicon":"https://mintcdn.com/writer/z-qGRP1BKyHYhEJN/images/icons/favicon.svg?fit=max\u0026auto=format\u0026n=z-qGRP1BKyHYhEJN\u0026q=85\u0026s=33356fdc372b2640b92c5546da07c9e0","api":{"playground":{"display":"interactive"},"examples":{"languages":["curl","python","javascript"]}},"navbar":{"primary":{"type":"button","label":"Sign in","href":"https://app.writer.com/login"}},"footer":{"socials":{"x":"https://x.com/Get_Writer","github":"https://github.com/writer","linkedin":"https://www.linkedin.com/company/getwriter"}},"seo":{"metatags":{"description":"Writer AI Studio developer documentation - Build AI agents with APIs, SDKs, Agent Builder, and no-code tools. Integrate generative AI into your applications.","og:site_name":"Writer AI Studio Documentation","og:type":"website","twitter:card":"summary_large_image","twitter:site":"@Get_Writer"},"indexing":"all"},"integrations":{"gtm":{"tagId":"GTM-NXVXDK"},"segment":{"key":"o2ZzfP0pJxH4cihXBPrF4IlbGqmG34BA"}},"contextual":{"options":["copy","view","cursor","vscode"],"display":"header"},"styling":{"latex":false},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"writer","hasAudioNarration":false,"actualSubdomain":"writer","customDomains":["dev.writer.com"],"gitSource":{"type":"github","owner":"writerinternal","repo":"docs","deployBranch":"main","contentDirectory":"docs","isPrivate":true,"mountPath":"","label":""},"chroma":{"liveDeploymentHistoryId":"6ae0ecd7a842d0026c9c76c2","collectionId":"0bf36e05-d989-4ca8-af5c-53694bbe9ac2","schemaVersion":"v3","latestBuiltDeploymentHistoryId":"6ae0ecd7a842d0026c9c76c2"},"feedback":{"thumbs":true,"issues":true},"entitlements":{"AI_CHAT":{"status":"ENABLED"},"REMOVE_BRANDING":{"status":"ENABLED"},"CONTEXTUAL_FEEDBACK":{"status":"ENABLED"},"CODE_SNIPPET_FEEDBACK":{"status":"ENABLED"},"WEB_MCP":{"status":"ENABLED"},"NARRATION":{"status":"ENABLED"}},"buildId":"6ae0ecd7a842d0026c9c76c2","clientVersion":"0.0.3990","searchFilterCounts":[{"language":"default","tag":"Home","count":99},{"language":"default","tag":"Writer Framework","count":71},{"language":"default","tag":"Component reference","count":45},{"language":"default","tag":"API Reference","count":35},{"language":"default","tag":"Connect to your data","count":31},{"language":"default","tag":"Available prebuilt connectors","count":27},{"language":"default","tag":"Content","count":17},{"language":"default","tag":"Legacy API Reference","count":16},{"language":"default","tag":"Getting started","count":14},{"language":"default","tag":"Input","count":13}]},"assistantConfig":{},"basePath":"","hasChatPermissions":true,"hasWebMcpPermissions":true,"toggles":[],"isAtlas":false,"googleFontsInlined":false},"customCss":[{"filePath":"styles.css","content":"/* devanagari */\n@font-face {\n font-family: 'Poppins';\n font-style: normal;\n font-weight: 500;\n font-display: swap;\n src: url(/_mintlify/assets/fonts/google/s/poppins/v24/pxiByp8kv8JHgFVrLGT9Z11lFc-K.woff2) format('woff2');\n unicode-range: U+0900-097F, U+1CD0-1CF4, U+1CF7-1CF9, U+200C-200D, U+20A8, U+20B9, U+20F0, U+25CC, U+A830-A839, U+A8E0-A8FF, U+11B00-11B0A;\n}\n/* latin-ext */\n@font-face {\n font-family: 'Poppins';\n font-style: normal;\n font-weight: 500;\n font-display: swap;\n src: url(/_mintlify/assets/fonts/google/s/poppins/v24/pxiByp8kv8JHgFVrLGT9Z1JlFc-K.woff2) format('woff2');\n unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;\n}\n/* latin */\n@font-face {\n font-family: 'Poppins';\n font-style: normal;\n font-weight: 500;\n font-display: swap;\n src: url(/_mintlify/assets/fonts/google/s/poppins/v24/pxiByp8kv8JHgFVrLGT9Z1xlFQ.woff2) format('woff2');\n unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;\n}\n/* devanagari */\n@font-face {\n font-family: 'Poppins';\n font-style: normal;\n font-weight: 600;\n font-display: swap;\n src: url(/_mintlify/assets/fonts/google/s/poppins/v24/pxiByp8kv8JHgFVrLEj6Z11lFc-K.woff2) format('woff2');\n unicode-range: U+0900-097F, U+1CD0-1CF4, U+1CF7-1CF9, U+200C-200D, U+20A8, U+20B9, U+20F0, U+25CC, U+A830-A839, U+A8E0-A8FF, U+11B00-11B0A;\n}\n/* latin-ext */\n@font-face {\n font-family: 'Poppins';\n font-style: normal;\n font-weight: 600;\n font-display: swap;\n src: url(/_mintlify/assets/fonts/google/s/poppins/v24/pxiByp8kv8JHgFVrLEj6Z1JlFc-K.woff2) format('woff2');\n unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;\n}\n/* latin */\n@font-face {\n font-family: 'Poppins';\n font-style: normal;\n font-weight: 600;\n font-display: swap;\n src: url(/_mintlify/assets/fonts/google/s/poppins/v24/pxiByp8kv8JHgFVrLEj6Z1xlFQ.woff2) format('woff2');\n unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;\n}\n:root{--purple-1:#5551FF;--purple-2:#4A46DA;--black:#000;--gray-1:#333}body{font-family:\"Graphik\",sans-serif;font-weight:400}body.bold{font-weight:600}h1,h2,h3{font-family:\"Poppins\",sans-serif}h1{font-weight:600!important}h2,h3{font-weight:500}img[src$=no-code],img[src$=quickstart]{border:1px solid #e4e7ed}img[src$=auth]{min-width:25%;width:35%;margin:auto}img[src$=auth-table]{min-width:25px;width:25px}.imageBorder,img[src$=framework]{border:1px solid #e4e7ed}.flex-none.min-w-full.text-sm.overflow-x-auto{background-color:#171b1a}.no-bullet li{list-style-type:none;font-size:small}.large-icon{width:60px;height:100%}.bg-primary\\/10{background-color:#bfcbff}.text-primary{color:#000}.dark .prompts{color:#828282}.dark .prompts,.papers,.prompts{font-family:'Roboto Mono',monospace}.prompts{color:#000}.papers{font-size:small;padding-left:20px;padding-right:20px;text-align:justify}td,th{padding:10px;text-align:left}.update table td,.update table th{word-break:break-word}.expandedImageContainer{padding:16px;border-radius:16px;background:#e9eef1;overflow:hidden;display:flex;justify-content:center}.expandedImageContainerInner{display:flex;align-items:flex-start;max-width:300px;max-height:210px}.expandedImageContainer img{max-height:210px}.components__table{table-layout:fixed;width:300px}.button-wrapper{margin-top:30px}.button{border:0;cursor:pointer;font-size:14px;font-weight:600;padding:8px 20px;position:relative;outline:0;transition:background-color .1s ease-in}.primary-button{background-color:var(--purple-1);border-radius:40px;color:#fff;display:inline-flex;align-items:center}.secondary-button{background-color:var(--black);border-radius:30px;color:#fff}.button--arrow{padding-right:40px}.componentFields td,.componentFields th{padding:8px;border:1px solid rgb(var(--gray-200))}.componentFields .desc{width:50ch}:is(.dark .componentFields td, .dark .componentFields th, .dark .blueprintFields td, .dark .blueprintFields th){border:1px solid rgb(var(--gray-800))}.blueprintFields td,.blueprintFields th{padding:8px;border:1px solid rgb(var(--gray-200));vertical-align:top}#topbar-cta-button{margin:0}#topbar-cta-button a,li[id=\"https://app.writer.com/login\"] a{display:inline-flex;align-items:center;background-color:var(--purple-1)!important;border-radius:9999px;padding:4px 14px;font-weight:600;font-size:14px;text-decoration:none;transition:background-color .2s ease;line-height:24px}#topbar-cta-button a span,li[id=\"https://app.writer.com/login\"] a div,li[id=\"https://app.writer.com/login\"] a span{color:#fff!important}#topbar-cta-button a:hover,li[id=\"https://app.writer.com/login\"] a:hover{background-color:var(--purple-2)!important}#topbar-cta-button svg{margin-left:4px;height:16px;width:16px}li[id=\"https://app.writer.com/login\"]{margin:0;max-width:100%;box-sizing:border-box}li[id=\"https://app.writer.com/login\"] a{display:inline-flex!important;align-items:center!important;border-radius:9999px!important;padding:4px 8px 4px 14px!important;font-weight:600!important;font-size:14px!important;text-decoration:none!important;transition:background-color .2s ease!important;line-height:24px!important;max-width:100%!important;box-sizing:border-box!important;white-space:nowrap!important;overflow:hidden!important}li[id=\"https://app.writer.com/login\"] svg{margin-left:0!important;height:16px!important;width:16px!important}#topbar-cta-button svg path,li[id=\"https://app.writer.com/login\"] svg path{stroke:#fff!important;stroke-width:1.5!important;stroke-linecap:round!important;fill:none!important}div[id=sidebar-content],div[id=sidebar],ul[class*=\"bg-zinc-950/5\"]{overflow-x:hidden;box-sizing:border-box}ul[class*=\"bg-zinc-950/5\"]{max-width:100%}#content-area.max-w-5xl{max-width:80rem}#content-area.max-w-xl{max-width:60rem!important}img.max-height-800{max-height:800px!important}img.max-width-80{max-width:80%!important}#navbar .nav-tabs{flex:1 1 auto!important;width:100%!important;justify-content:center!important}"}],"page":{"pagePath":"api-reference/completion-api/chat-completion","slug":"/api-reference/completion-api/chat-completion","pageMetadata":{"openapi":"post /v1/chat","title":"Chat completion","description":"Generate a chat completion based on the provided messages. The response shown below is for non-streaming. To learn about streaming responses, see the [chat completion guide](https://dev.writer.com/home/chat-completion).","href":"/api-reference/completion-api/chat-completion"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx, jsxs: _jsxs} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n a: \"a\",\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsxs(_components.p, {\n children: [\"Generate a chat completion based on the provided messages. The response shown below is for non-streaming. To learn about streaming responses, see the \", _jsx(_components.a, {\n href: \"https://dev.writer.com/home/chat-completion\",\n children: \"chat completion guide\"\n }), \".\"]\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,p:`p`,strong:`strong`,..._provideComponents(),...props.components},{Warning}=_components;if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(Warning,{children:[_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Deprecation notice`}),`: Palmyra X4 (`,_jsx(_components.code,{children:`palmyra-x4`}),`) and Palmyra X5 (`,_jsx(_components.code,{children:`palmyra-x5`}),`) will be deprecated on `,_jsx(_components.strong,{children:`December 14, 2026`}),`.`]}),_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Migration path`}),`: Use `,_jsx(_components.a,{href:`/home/models#palmyra-x6`,children:`Palmyra X6`}),` (`,_jsx(_components.code,{children:`palmyra-x6`}),`) instead. Palmyra X6 has a 1M token context window (Palmyra X4 is 128k). See `,_jsx(_components.a,{href:`/home/pricing`,children:`pricing`}),` for cost details and the `,_jsx(_components.a,{href:`/home/models#deprecation-policy`,children:`deprecation policy`}),` for more information.`]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"openapi":"post /v1/chat","title":"Chat completion","description":"Generate a chat completion based on the provided messages. The response shown below is for non-streaming. To learn about streaming responses, see the [chat completion guide](https://dev.writer.com/home/chat-completion).","href":"/api-reference/completion-api/chat-completion"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[],"codeExamples":{}},"jsLinks":[],"openApiReferenceData":{"operation":{"security":["262a07cf-e2f3-4ecf-9add-3f0bd8874fc1"],"tags":["Generation API"],"summary":"Chat completion","description":"Generate a chat completion based on the provided messages. The response shown below is for non-streaming. To learn about streaming responses, see the [chat completion guide](https://dev.writer.com/home/chat-completion).","operationId":"chat","requestBody":"c5ab0087-abdc-4b0e-85b6-721b4467eb8a","responses":{"200":"f44df85f-1713-49b0-a621-04afb3cd27eb"},"x-codeSamples":[{"lang":"cURL","source":"curl --location --request POST https://api.writer.com/v1/chat \\\n --header \"Authorization: Bearer \u003ctoken>\" \\\n --header \"Content-Type: application/json\" \\\n--data-raw '{\"model\":\"palmyra-x5\",\"messages\":[{\"content\":\"Write a memo summarizing this earnings report.\",\"role\":\"user\"}]}'"},{"lang":"JavaScript","source":"import Writer from 'writer-sdk';\n\nconst client = new Writer({\n apiKey: process.env['WRITER_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const chat = await client.chat.chat({\n messages: [{ content: 'Write a memo summarizing this earnings report.', role: 'user' }],\n model: 'palmyra-x5',\n });\n\n console.log(chat.id);\n}\n\nmain();"},{"lang":"Python","source":"import os\nfrom writerai import Writer\n\nclient = Writer(\n # This is the default and can be omitted\n api_key=os.environ.get(\"WRITER_API_KEY\"),\n)\nchat = client.chat.chat(\n messages=[{\n \"content\": \"Write a memo summarizing this earnings report.\",\n \"role\": \"user\",\n }],\n model=\"palmyra-x5\",\n)\nprint(chat.id)"}],"method":"post","type":"path","servers":["b8cc5dfc-266d-497e-a683-385c75b5033f"],"path":"/v1/chat","baseUrlOptions":["https://api.writer.com"],"title":"Chat completion","codeSamples":[{"lang":"cURL","source":"curl --location --request POST https://api.writer.com/v1/chat \\\n --header \"Authorization: Bearer \u003ctoken>\" \\\n --header \"Content-Type: application/json\" \\\n--data-raw '{\"model\":\"palmyra-x5\",\"messages\":[{\"content\":\"Write a memo summarizing this earnings report.\",\"role\":\"user\"}]}'"},{"lang":"JavaScript","source":"import Writer from 'writer-sdk';\n\nconst client = new Writer({\n apiKey: process.env['WRITER_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const chat = await client.chat.chat({\n messages: [{ content: 'Write a memo summarizing this earnings report.', role: 'user' }],\n model: 'palmyra-x5',\n });\n\n console.log(chat.id);\n}\n\nmain();"},{"lang":"Python","source":"import os\nfrom writerai import Writer\n\nclient = Writer(\n # This is the default and can be omitted\n api_key=os.environ.get(\"WRITER_API_KEY\"),\n)\nchat = client.chat.chat(\n messages=[{\n \"content\": \"Write a memo summarizing this earnings report.\",\n \"role\": \"user\",\n }],\n model=\"palmyra-x5\",\n)\nprint(chat.id)"}],"requestExampleLanguages":["bash","python","javascript"],"requiredOnlyExamples":false,"requestExampleType":"codeSamples","responseExampleType":"generated"},"dependencies":{"parameters":{},"requestBody":{"content":{"application/json":{"schema":{"required":["model","messages"],"type":"object","properties":{"model":{"type":"string","description":"The [ID of the model](https://dev.writer.com/home/models) to use for creating the chat completion. This can be a Palmyra model such as `palmyra-x5` or `palmyra-x4`, or the ID of an [external model](https://dev.writer.com/home/external-models) configured for your organization.","isRequired":true,"uniqueKey":"model","typeLabel":"string"},"messages":{"type":"array","items":{"title":"chat_message","required":["role"],"type":"object","properties":{"role":{"type":"string","description":"The role of the chat message. You can provide a system prompt by setting the role to `system`, or specify that a message is the result of a [tool call](https://dev.writer.com/home/tool-calling) by setting the role to `tool`.","enum":["user","assistant","system","tool"],"isRequired":true,"uniqueKey":"messages.items.[INDEX].role","typeLabel":"enum\u003cstring>"},"content":{"oneOf":[{"type":"string","title":"TextContent","description":"The content of the message. Can be either a string (for text-only messages) or an array of content fragments (for mixed text and image messages).","uniqueKey":"messages.items.[INDEX].content.oneOf.0","typeLabel":"string"},{"type":"array","items":{"oneOf":[{"type":"object","title":"Text","description":"Represents a text content fragment within a chat message.","required":["type","text"],"properties":{"type":{"type":"string","description":"The type of content fragment. Must be `text` for text fragments.","enum":["text"],"isRequired":true,"uniqueKey":"messages.items.[INDEX].content.oneOf.1.items.[INDEX].oneOf.0.type","typeLabel":"enum\u003cstring>"},"text":{"type":"string","description":"The actual text content of the message fragment.","isRequired":true,"uniqueKey":"messages.items.[INDEX].content.oneOf.1.items.[INDEX].oneOf.0.text","typeLabel":"string"}},"uniqueKey":"messages.items.[INDEX].content.oneOf.1.items.[INDEX].oneOf.0","typeLabel":"Text · object"},{"type":"object","title":"Image","description":"Represents an image content fragment within a chat message. Note: This content type is only supported with the Palmyra X5 model.","required":["type","image_url"],"properties":{"type":{"type":"string","description":"The type of content fragment. Must be `image_url` for image fragments.","enum":["image_url"],"isRequired":true,"uniqueKey":"messages.items.[INDEX].content.oneOf.1.items.[INDEX].oneOf.1.type","typeLabel":"enum\u003cstring>"},"image_url":{"type":"object","description":"The image URL object containing the location of the image.","required":["url"],"properties":{"url":{"type":"string","description":"The URL pointing to the image file. Supports common image formats like JPEG, PNG, GIF, etc.","isRequired":true,"uniqueKey":"messages.items.[INDEX].content.oneOf.1.items.[INDEX].oneOf.1.image_url.url","typeLabel":"string"}},"isRequired":true,"uniqueKey":"messages.items.[INDEX].content.oneOf.1.items.[INDEX].oneOf.1.image_url","typeLabel":"object"}},"uniqueKey":"messages.items.[INDEX].content.oneOf.1.items.[INDEX].oneOf.1","typeLabel":"Image · object"}],"uniqueKey":"messages.items.[INDEX].content.oneOf.1.items.[INDEX]","typeLabel":"Text · object | Image · object"},"title":"MixedContent","description":"The content of the message. Can be either a string (for text-only messages) or an array of content fragments (for mixed text and image messages).","minItems":1,"uniqueKey":"messages.items.[INDEX].content.oneOf.1","typeLabel":"(Text · object | Image · object)[]"},{"type":"null","uniqueKey":"messages.items.[INDEX].content.oneOf.2","typeLabel":"null"}],"uniqueKey":"messages.items.[INDEX].content","typeLabel":"string | (Text · object | Image · object)[] | null"},"name":{"oneOf":[{"type":"string","description":"An optional name for the message sender. Useful for identifying different users, personas, or tools in multi-participant conversations.","uniqueKey":"messages.items.[INDEX].name.oneOf.0","typeLabel":"string"},{"type":"null","description":"An optional name for the message sender. Useful for identifying different users, personas, or tools in multi-participant conversations.","uniqueKey":"messages.items.[INDEX].name.oneOf.1","typeLabel":"null"}],"uniqueKey":"messages.items.[INDEX].name","typeLabel":"string | null"},"tool_call_id":{"oneOf":[{"type":"string","uniqueKey":"messages.items.[INDEX].tool_call_id.oneOf.0","typeLabel":"string"},{"type":"null","uniqueKey":"messages.items.[INDEX].tool_call_id.oneOf.1","typeLabel":"null"}],"uniqueKey":"messages.items.[INDEX].tool_call_id","typeLabel":"string | null"},"tool_calls":{"oneOf":[{"type":"array","items":{"title":"tool_call","type":"object","required":["id","type","function"],"properties":{"id":{"type":"string","isRequired":true,"uniqueKey":"messages.items.[INDEX].tool_calls.oneOf.0.items.[INDEX].id","typeLabel":"string"},"type":{"type":"string","enum":["function"],"isRequired":true,"uniqueKey":"messages.items.[INDEX].tool_calls.oneOf.0.items.[INDEX].type","typeLabel":"enum\u003cstring>"},"function":{"title":"function","type":"object","required":["name","arguments"],"properties":{"name":{"type":"string","isRequired":true,"uniqueKey":"messages.items.[INDEX].tool_calls.oneOf.0.items.[INDEX].function.name","typeLabel":"string"},"arguments":{"type":"string","isRequired":true,"uniqueKey":"messages.items.[INDEX].tool_calls.oneOf.0.items.[INDEX].function.arguments","typeLabel":"string"}},"isRequired":true,"uniqueKey":"messages.items.[INDEX].tool_calls.oneOf.0.items.[INDEX].function","typeLabel":"function · object"},"index":{"type":"integer","format":"int32","uniqueKey":"messages.items.[INDEX].tool_calls.oneOf.0.items.[INDEX].index","typeLabel":"integer\u003cint32>"}},"uniqueKey":"messages.items.[INDEX].tool_calls.oneOf.0.items.[INDEX]","typeLabel":"tool_call · object"},"minItems":1,"uniqueKey":"messages.items.[INDEX].tool_calls.oneOf.0","typeLabel":"tool_call · object[]"},{"type":"null","items":{"title":"tool_call","type":"object","required":["id","type","function"],"properties":{"index":{"type":"integer","format":"int32"},"id":{"type":"string"},"type":{"type":"string","enum":["function"]},"function":{"title":"function","type":"object","required":["name","arguments"],"properties":{"name":{"type":"string"},"arguments":{"type":"string"}}}}},"minItems":1,"uniqueKey":"messages.items.[INDEX].tool_calls.oneOf.1","typeLabel":"null"}],"uniqueKey":"messages.items.[INDEX].tool_calls","typeLabel":"tool_call · object[] | null"},"graph_data":{"oneOf":[{"title":"graph_data","type":"object","properties":{"sources":{"type":"array","items":{"oneOf":[{"title":"source","description":"A source snippet containing text and fileId from Knowledge Graph content.","required":["file_id","snippet"],"type":"object","properties":{"file_id":{"type":"string","description":"The unique identifier of the file in your Writer account.","isRequired":true,"uniqueKey":"messages.items.[INDEX].graph_data.oneOf.0.sources.items.[INDEX].oneOf.0.file_id","typeLabel":"string"},"snippet":{"type":"string","description":"The exact text snippet from the source document that was used to support the response.","isRequired":true,"uniqueKey":"messages.items.[INDEX].graph_data.oneOf.0.sources.items.[INDEX].oneOf.0.snippet","typeLabel":"string"}},"uniqueKey":"messages.items.[INDEX].graph_data.oneOf.0.sources.items.[INDEX].oneOf.0","typeLabel":"source · object"},{"title":"source","description":"A source snippet containing text and fileId from Knowledge Graph content.","required":["file_id","snippet"],"type":"null","properties":{"file_id":{"type":"string","description":"The unique identifier of the file in your Writer account."},"snippet":{"type":"string","description":"The exact text snippet from the source document that was used to support the response."}},"uniqueKey":"messages.items.[INDEX].graph_data.oneOf.0.sources.items.[INDEX].oneOf.1","typeLabel":"null"}],"uniqueKey":"messages.items.[INDEX].graph_data.oneOf.0.sources.items.[INDEX]","typeLabel":"source · object | null"},"uniqueKey":"messages.items.[INDEX].graph_data.oneOf.0.sources","typeLabel":"(source · object | null)[]"},"status":{"oneOf":[{"title":"graph_stage_status","type":"string","enum":["processing","finished"],"uniqueKey":"messages.items.[INDEX].graph_data.oneOf.0.status.oneOf.0","typeLabel":"enum\u003cstring>"},{"title":"graph_stage_status","type":"null","enum":["processing","finished"],"uniqueKey":"messages.items.[INDEX].graph_data.oneOf.0.status.oneOf.1","typeLabel":"null"}],"uniqueKey":"messages.items.[INDEX].graph_data.oneOf.0.status","typeLabel":"enum\u003cstring> | null"},"subqueries":{"type":"array","items":{"oneOf":[{"title":"sub_query","description":"A sub-question generated to break down complex queries into more manageable parts, along with its answer and supporting sources.","required":["query","answer","sources"],"type":"object","properties":{"query":{"type":"string","description":"The subquery that was generated to help answer the main question.","isRequired":true,"uniqueKey":"messages.items.[INDEX].graph_data.oneOf.0.subqueries.items.[INDEX].oneOf.0.query","typeLabel":"string"},"answer":{"type":"string","description":"The answer to the subquery based on Knowledge Graph content.","isRequired":true,"uniqueKey":"messages.items.[INDEX].graph_data.oneOf.0.subqueries.items.[INDEX].oneOf.0.answer","typeLabel":"string"},"sources":{"type":"array","description":"Array of source snippets that were used to answer this subquery.","items":{"oneOf":[{"title":"source","description":"A source snippet containing text and fileId from Knowledge Graph content.","required":["file_id","snippet"],"type":"object","properties":{"file_id":{"type":"string","description":"The unique identifier of the file in your Writer account.","isRequired":true,"uniqueKey":"messages.items.[INDEX].graph_data.oneOf.0.subqueries.items.[INDEX].oneOf.0.sources.items.[INDEX].oneOf.0.file_id","typeLabel":"string"},"snippet":{"type":"string","description":"The exact text snippet from the source document that was used to support the response.","isRequired":true,"uniqueKey":"messages.items.[INDEX].graph_data.oneOf.0.subqueries.items.[INDEX].oneOf.0.sources.items.[INDEX].oneOf.0.snippet","typeLabel":"string"}},"uniqueKey":"messages.items.[INDEX].graph_data.oneOf.0.subqueries.items.[INDEX].oneOf.0.sources.items.[INDEX].oneOf.0","typeLabel":"source · object"},{"title":"source","description":"A source snippet containing text and fileId from Knowledge Graph content.","required":["file_id","snippet"],"type":"null","properties":{"file_id":{"type":"string","description":"The unique identifier of the file in your Writer account."},"snippet":{"type":"string","description":"The exact text snippet from the source document that was used to support the response."}},"uniqueKey":"messages.items.[INDEX].graph_data.oneOf.0.subqueries.items.[INDEX].oneOf.0.sources.items.[INDEX].oneOf.1","typeLabel":"null"}],"uniqueKey":"messages.items.[INDEX].graph_data.oneOf.0.subqueries.items.[INDEX].oneOf.0.sources.items.[INDEX]","typeLabel":"source · object | null"},"isRequired":true,"uniqueKey":"messages.items.[INDEX].graph_data.oneOf.0.subqueries.items.[INDEX].oneOf.0.sources","typeLabel":"(source · object | null)[]"}},"uniqueKey":"messages.items.[INDEX].graph_data.oneOf.0.subqueries.items.[INDEX].oneOf.0","typeLabel":"sub_query · object"},{"title":"sub_query","description":"A sub-question generated to break down complex queries into more manageable parts, along with its answer and supporting sources.","required":["query","answer","sources"],"type":"null","properties":{"query":{"type":"string","description":"The subquery that was generated to help answer the main question."},"answer":{"type":"string","description":"The answer to the subquery based on Knowledge Graph content."},"sources":{"type":"array","description":"Array of source snippets that were used to answer this subquery.","items":{"oneOf":[{"title":"source","description":"A source snippet containing text and fileId from Knowledge Graph content.","required":["file_id","snippet"],"type":"object","properties":{"file_id":{"type":"string","description":"The unique identifier of the file in your Writer account."},"snippet":{"type":"string","description":"The exact text snippet from the source document that was used to support the response."}}},{"title":"source","description":"A source snippet containing text and fileId from Knowledge Graph content.","required":["file_id","snippet"],"type":"null","properties":{"file_id":{"type":"string","description":"The unique identifier of the file in your Writer account."},"snippet":{"type":"string","description":"The exact text snippet from the source document that was used to support the response."}}}]}}},"uniqueKey":"messages.items.[INDEX].graph_data.oneOf.0.subqueries.items.[INDEX].oneOf.1","typeLabel":"null"}],"uniqueKey":"messages.items.[INDEX].graph_data.oneOf.0.subqueries.items.[INDEX]","typeLabel":"sub_query · object | null"},"uniqueKey":"messages.items.[INDEX].graph_data.oneOf.0.subqueries","typeLabel":"(sub_query · object | null)[]"},"references":{"title":"references","description":"Detailed source information organized by reference type, providing comprehensive metadata about the sources used to generate the response.","type":"object","properties":{"files":{"type":"array","description":"Array of file-based references from uploaded documents in the Knowledge Graph.","items":{"title":"file","description":"A file-based reference containing text snippets from uploaded documents in the Knowledge Graph.","required":["text","fileId","score"],"type":"object","properties":{"text":{"type":"string","description":"The exact text snippet from the source document that was used to support the response.","isRequired":true,"uniqueKey":"messages.items.[INDEX].graph_data.oneOf.0.references.files.items.[INDEX].text","typeLabel":"string"},"fileId":{"type":"string","description":"The unique identifier of the file in your Writer account.","isRequired":true,"uniqueKey":"messages.items.[INDEX].graph_data.oneOf.0.references.files.items.[INDEX].fileId","typeLabel":"string"},"score":{"type":"number","description":"Internal score used during the retrieval process for ranking and selecting relevant snippets.","isRequired":true,"uniqueKey":"messages.items.[INDEX].graph_data.oneOf.0.references.files.items.[INDEX].score","typeLabel":"number"},"page":{"type":"integer","format":"int32","description":"Page number where this snippet was found in the source document.","uniqueKey":"messages.items.[INDEX].graph_data.oneOf.0.references.files.items.[INDEX].page","typeLabel":"integer\u003cint32>"},"cite":{"type":"string","description":"Unique citation ID that appears in inline citations within the response text (null if not cited).","uniqueKey":"messages.items.[INDEX].graph_data.oneOf.0.references.files.items.[INDEX].cite","typeLabel":"string"}},"uniqueKey":"messages.items.[INDEX].graph_data.oneOf.0.references.files.items.[INDEX]","typeLabel":"file · object"},"minItems":1,"uniqueKey":"messages.items.[INDEX].graph_data.oneOf.0.references.files","typeLabel":"file · object[]"},"web":{"type":"array","description":"Array of web-based references from online sources accessed during the query.","items":{"title":"web","description":"A web-based reference containing text snippets from online sources accessed during the query.","required":["text","url","title","score"],"type":"object","properties":{"text":{"type":"string","description":"The exact text snippet from the web source that was used to support the response.","isRequired":true,"uniqueKey":"messages.items.[INDEX].graph_data.oneOf.0.references.web.items.[INDEX].text","typeLabel":"string"},"url":{"type":"string","description":"The URL of the web page where this content was found.","format":"uri","isRequired":true,"uniqueKey":"messages.items.[INDEX].graph_data.oneOf.0.references.web.items.[INDEX].url","typeLabel":"string\u003curi>"},"title":{"type":"string","description":"The title of the web page where this content was found.","isRequired":true,"uniqueKey":"messages.items.[INDEX].graph_data.oneOf.0.references.web.items.[INDEX].title","typeLabel":"string"},"score":{"type":"number","description":"Internal score used during the retrieval process for ranking and selecting relevant snippets.","isRequired":true,"uniqueKey":"messages.items.[INDEX].graph_data.oneOf.0.references.web.items.[INDEX].score","typeLabel":"number"}},"uniqueKey":"messages.items.[INDEX].graph_data.oneOf.0.references.web.items.[INDEX]","typeLabel":"web · object"},"minItems":1,"uniqueKey":"messages.items.[INDEX].graph_data.oneOf.0.references.web","typeLabel":"web · object[]"}},"uniqueKey":"messages.items.[INDEX].graph_data.oneOf.0.references","typeLabel":"references · object"}},"uniqueKey":"messages.items.[INDEX].graph_data.oneOf.0","typeLabel":"graph_data · object"},{"title":"graph_data","type":"null","properties":{"sources":{"type":"array","items":{"oneOf":[{"title":"source","description":"A source snippet containing text and fileId from Knowledge Graph content.","required":["file_id","snippet"],"type":"object","properties":{"file_id":{"type":"string","description":"The unique identifier of the file in your Writer account."},"snippet":{"type":"string","description":"The exact text snippet from the source document that was used to support the response."}}},{"title":"source","description":"A source snippet containing text and fileId from Knowledge Graph content.","required":["file_id","snippet"],"type":"null","properties":{"file_id":{"type":"string","description":"The unique identifier of the file in your Writer account."},"snippet":{"type":"string","description":"The exact text snippet from the source document that was used to support the response."}}}]}},"status":{"oneOf":[{"title":"graph_stage_status","type":"string","enum":["processing","finished"]},{"title":"graph_stage_status","type":"null","enum":["processing","finished"]}]},"subqueries":{"type":"array","items":{"oneOf":[{"title":"sub_query","description":"A sub-question generated to break down complex queries into more manageable parts, along with its answer and supporting sources.","required":["query","answer","sources"],"type":"object","properties":{"query":{"type":"string","description":"The subquery that was generated to help answer the main question."},"answer":{"type":"string","description":"The answer to the subquery based on Knowledge Graph content."},"sources":{"type":"array","description":"Array of source snippets that were used to answer this subquery.","items":{"oneOf":[{"title":"source","description":"A source snippet containing text and fileId from Knowledge Graph content.","required":["file_id","snippet"],"type":"object","properties":{"file_id":{"type":"string","description":"The unique identifier of the file in your Writer account."},"snippet":{"type":"string","description":"The exact text snippet from the source document that was used to support the response."}}},{"title":"source","description":"A source snippet containing text and fileId from Knowledge Graph content.","required":["file_id","snippet"],"type":"null","properties":{"file_id":{"type":"string","description":"The unique identifier of the file in your Writer account."},"snippet":{"type":"string","description":"The exact text snippet from the source document that was used to support the response."}}}]}}}},{"title":"sub_query","description":"A sub-question generated to break down complex queries into more manageable parts, along with its answer and supporting sources.","required":["query","answer","sources"],"type":"null","properties":{"query":{"type":"string","description":"The subquery that was generated to help answer the main question."},"answer":{"type":"string","description":"The answer to the subquery based on Knowledge Graph content."},"sources":{"type":"array","description":"Array of source snippets that were used to answer this subquery.","items":{"oneOf":[{"title":"source","description":"A source snippet containing text and fileId from Knowledge Graph content.","required":["file_id","snippet"],"type":"object","properties":{"file_id":{"type":"string","description":"The unique identifier of the file in your Writer account."},"snippet":{"type":"string","description":"The exact text snippet from the source document that was used to support the response."}}},{"title":"source","description":"A source snippet containing text and fileId from Knowledge Graph content.","required":["file_id","snippet"],"type":"null","properties":{"file_id":{"type":"string","description":"The unique identifier of the file in your Writer account."},"snippet":{"type":"string","description":"The exact text snippet from the source document that was used to support the response."}}}]}}}}]}},"references":{"title":"references","description":"Detailed source information organized by reference type, providing comprehensive metadata about the sources used to generate the response.","type":"object","properties":{"files":{"type":"array","description":"Array of file-based references from uploaded documents in the Knowledge Graph.","items":{"title":"file","description":"A file-based reference containing text snippets from uploaded documents in the Knowledge Graph.","required":["text","fileId","score"],"type":"object","properties":{"text":{"type":"string","description":"The exact text snippet from the source document that was used to support the response."},"fileId":{"type":"string","description":"The unique identifier of the file in your Writer account."},"score":{"type":"number","description":"Internal score used during the retrieval process for ranking and selecting relevant snippets."},"page":{"type":"integer","format":"int32","description":"Page number where this snippet was found in the source document."},"cite":{"type":"string","description":"Unique citation ID that appears in inline citations within the response text (null if not cited)."}}},"minItems":1},"web":{"type":"array","description":"Array of web-based references from online sources accessed during the query.","items":{"title":"web","description":"A web-based reference containing text snippets from online sources accessed during the query.","required":["text","url","title","score"],"type":"object","properties":{"text":{"type":"string","description":"The exact text snippet from the web source that was used to support the response."},"url":{"type":"string","description":"The URL of the web page where this content was found.","format":"uri"},"title":{"type":"string","description":"The title of the web page where this content was found."},"score":{"type":"number","description":"Internal score used during the retrieval process for ranking and selecting relevant snippets."}}},"minItems":1}}}},"uniqueKey":"messages.items.[INDEX].graph_data.oneOf.1","typeLabel":"null"}],"uniqueKey":"messages.items.[INDEX].graph_data","typeLabel":"graph_data · object | null"},"refusal":{"oneOf":[{"type":"string","uniqueKey":"messages.items.[INDEX].refusal.oneOf.0","typeLabel":"string"},{"type":"null","uniqueKey":"messages.items.[INDEX].refusal.oneOf.1","typeLabel":"null"}],"uniqueKey":"messages.items.[INDEX].refusal","typeLabel":"string | null"}},"uniqueKey":"messages.items.[INDEX]","typeLabel":"chat_message · object"},"minItems":1,"description":"An array of message objects that form the conversation history or context for the model to respond to. The array must contain at least one message.","isRequired":true,"uniqueKey":"messages","typeLabel":"chat_message · object[]"},"max_tokens":{"type":"integer","format":"int32","description":"Defines the maximum number of tokens (words and characters) that the model can generate in the response. This can be adjusted to allow for longer or shorter responses as needed. The maximum value varies by model. See the [models overview](/home/models) for more information about the maximum number of tokens for each model.","uniqueKey":"max_tokens","typeLabel":"integer\u003cint32>"},"temperature":{"type":"number","format":"double","default":1,"description":"Controls the randomness or creativity of the model's responses. A higher temperature results in more varied and less predictable text, while a lower temperature produces more deterministic and conservative outputs.","uniqueKey":"temperature","typeLabel":"number\u003cdouble>"},"top_p":{"type":"number","format":"double","description":"Sets the threshold for \"nucleus sampling,\" a technique to focus the model's token generation on the most likely subset of tokens. Only tokens with cumulative probability above this threshold are considered, controlling the trade-off between creativity and coherence.","uniqueKey":"top_p","typeLabel":"number\u003cdouble>"},"n":{"type":"integer","format":"int32","description":"Specifies the number of completions (responses) to generate from the model in a single request. This parameter allows for generating multiple responses, offering a variety of potential replies from which to choose.","uniqueKey":"n","typeLabel":"integer\u003cint32>"},"stop":{"oneOf":[{"type":"array","items":{"type":"string","uniqueKey":"stop.oneOf.0.items.[INDEX]","typeLabel":"string"},"description":"A token or sequence of tokens that, when generated, will cause the model to stop producing further content. This can be a single token or an array of tokens, acting as a signal to end the output.","uniqueKey":"stop.oneOf.0","typeLabel":"string[]"},{"type":"string","description":"A token or sequence of tokens that, when generated, will cause the model to stop producing further content. This can be a single token or an array of tokens, acting as a signal to end the output.","uniqueKey":"stop.oneOf.1","typeLabel":"string"}],"uniqueKey":"stop","typeLabel":"string[] | string"},"logprobs":{"type":"boolean","default":"false","description":"Specifies whether to return log probabilities of the output tokens.","uniqueKey":"logprobs","typeLabel":"boolean"},"stream":{"type":"boolean","description":"Indicates whether the response should be streamed incrementally as it is generated or only returned once fully complete. Streaming can be useful for providing real-time feedback in interactive applications.","default":false,"uniqueKey":"stream","typeLabel":"boolean"},"tools":{"type":"array","description":"An array containing tool definitions for tools that the model can use to generate responses. The tool definitions use JSON schema. You can define your own functions or use one of the built-in `graph`, `llm`, `translation`, or `vision` tools. Note that you can only use one built-in tool type in the array (only one of `graph`, `llm`, `translation`, or `vision`). You can pass multiple [custom tools](https://dev.writer.com/home/tool-calling) of type `function` in the same request.","items":{"oneOf":[{"type":"object","title":"Function tool","minItems":1,"required":["function","type"],"properties":{"type":{"type":"string","description":"The type of tool.","enum":["function"],"isRequired":true,"uniqueKey":"tools.items.[INDEX].oneOf.0.type","typeLabel":"enum\u003cstring>"},"function":{"title":"tool_function","description":"A tool that uses a custom function.","required":["name"],"type":"object","properties":{"name":{"type":"string","description":"Name of the function.","isRequired":true,"uniqueKey":"tools.items.[INDEX].oneOf.0.function.name","typeLabel":"string"},"description":{"type":"string","description":"Description of the function.","uniqueKey":"tools.items.[INDEX].oneOf.0.function.description","typeLabel":"string"},"parameters":{"type":"object","additionalProperties":true,"description":"The parameters of the function.","uniqueKey":"tools.items.[INDEX].oneOf.0.function.parameters","typeLabel":"object"}},"isRequired":true,"uniqueKey":"tools.items.[INDEX].oneOf.0.function","typeLabel":"tool_function · object"}},"uniqueKey":"tools.items.[INDEX].oneOf.0","typeLabel":"Function tool · object"},{"type":"object","title":"Graph tool","minItems":1,"required":["function","type"],"properties":{"type":{"type":"string","description":"The type of tool.","enum":["graph"],"isRequired":true,"uniqueKey":"tools.items.[INDEX].oneOf.1.type","typeLabel":"enum\u003cstring>"},"function":{"title":"graph_function","description":"A tool that uses Knowledge Graphs as context for responses.","required":["graph_ids","subqueries"],"type":"object","properties":{"graph_ids":{"type":"array","description":"An array of graph IDs to use in the tool.","items":{"type":"string","format":"uuid","uniqueKey":"tools.items.[INDEX].oneOf.1.function.graph_ids.items.[INDEX]","typeLabel":"string\u003cuuid>"},"minItems":1,"isRequired":true,"uniqueKey":"tools.items.[INDEX].oneOf.1.function.graph_ids","typeLabel":"string\u003cuuid>[]"},"subqueries":{"type":"boolean","description":"Boolean to indicate whether to include subqueries in the response.","isRequired":true,"uniqueKey":"tools.items.[INDEX].oneOf.1.function.subqueries","typeLabel":"boolean"},"description":{"type":"string","description":"A description of the graph content.","uniqueKey":"tools.items.[INDEX].oneOf.1.function.description","typeLabel":"string"},"query_config":{"title":"graph_query_config","description":"Configuration options for Knowledge Graph queries, including search parameters and citation settings.","type":"object","properties":{"max_subquestions":{"type":"integer","format":"int32","minimum":1,"maximum":10,"default":6,"description":"Maximum number of subquestions to generate when processing complex queries. Set higher to improve detail, set lower to reduce response time. Range: 1-10, Default: 6.","uniqueKey":"tools.items.[INDEX].oneOf.1.function.query_config.max_subquestions","typeLabel":"integer\u003cint32>"},"search_weight":{"type":"integer","format":"int32","minimum":0,"maximum":100,"default":50,"description":"Weight given to search results when ranking and selecting relevant information. Higher values (closer to 100) prioritize keyword-based matching, while lower values (closer to 0) prioritize semantic similarity matching. Use higher values for exact keyword searches, lower values for conceptual similarity searches. Range: 0-100, Default: 50.","uniqueKey":"tools.items.[INDEX].oneOf.1.function.query_config.search_weight","typeLabel":"integer\u003cint32>"},"grounding_level":{"type":"number","format":"double","minimum":0,"maximum":1,"default":0,"description":"Level of grounding required for responses, controlling how closely answers must be tied to source material. Set lower for grounded outputs, higher for creativity. Higher values (closer to 1.0) allow more creative interpretation, while lower values (closer to 0.0) stick more closely to source material. Range: 0.0-1.0, Default: 0.0.","uniqueKey":"tools.items.[INDEX].oneOf.1.function.query_config.grounding_level","typeLabel":"number\u003cdouble>"},"max_snippets":{"type":"integer","format":"int32","minimum":1,"maximum":60,"default":30,"description":"Maximum number of text snippets to retrieve from the Knowledge Graph for context. Works in concert with `search_weight` to control best matches vs broader coverage. While technically supports 1-60, values below 5 may return no results due to RAG implementation. Recommended range: 5-25. Due to RAG system behavior, you may see more snippets than requested. Range: 1-60, Default: 30.","uniqueKey":"tools.items.[INDEX].oneOf.1.function.query_config.max_snippets","typeLabel":"integer\u003cint32>"},"max_tokens":{"type":"integer","format":"int32","minimum":100,"maximum":8000,"default":4000,"description":"Maximum number of tokens the model can generate in the response. This controls the length of the AI's answer. Set higher for longer answers, set lower for shorter, faster answers. Range: 100-8000, Default: 4000.","uniqueKey":"tools.items.[INDEX].oneOf.1.function.query_config.max_tokens","typeLabel":"integer\u003cint32>"},"keyword_threshold":{"type":"number","format":"double","minimum":0,"maximum":1,"default":0.7,"description":"Threshold for keyword-based matching when searching Knowledge Graph content. Set higher for stricter relevance, lower for broader range. Higher values (closer to 1.0) require stronger keyword matches, while lower values (closer to 0.0) allow more lenient matching. Range: 0.0-1.0, Default: 0.7.","uniqueKey":"tools.items.[INDEX].oneOf.1.function.query_config.keyword_threshold","typeLabel":"number\u003cdouble>"},"semantic_threshold":{"type":"number","format":"double","minimum":0,"maximum":1,"default":0.7,"description":"Threshold for semantic similarity matching when searching Knowledge Graph content. Set higher for stricter relevance, lower for broader range. Higher values (closer to 1.0) require stronger semantic similarity, while lower values (closer to 0.0) allow more lenient semantic matching. Range: 0.0-1.0, Default: 0.7.","uniqueKey":"tools.items.[INDEX].oneOf.1.function.query_config.semantic_threshold","typeLabel":"number\u003cdouble>"},"inline_citations":{"type":"boolean","default":false,"description":"Whether to include inline citations in the response, showing which Knowledge Graph sources were used. Default: false.","uniqueKey":"tools.items.[INDEX].oneOf.1.function.query_config.inline_citations","typeLabel":"boolean"}},"uniqueKey":"tools.items.[INDEX].oneOf.1.function.query_config","typeLabel":"graph_query_config · object"}},"isRequired":true,"uniqueKey":"tools.items.[INDEX].oneOf.1.function","typeLabel":"graph_function · object"}},"uniqueKey":"tools.items.[INDEX].oneOf.1","typeLabel":"Graph tool · object"},{"type":"object","title":"LLM tool","minItems":1,"required":["function","type"],"properties":{"type":{"type":"string","description":"The type of tool.","enum":["llm"],"isRequired":true,"uniqueKey":"tools.items.[INDEX].oneOf.2.type","typeLabel":"enum\u003cstring>"},"function":{"title":"LLM function","description":"A tool that uses another model to generate a response.","required":["description","model"],"type":"object","properties":{"description":{"type":"string","description":"A description of the model to use.","isRequired":true,"uniqueKey":"tools.items.[INDEX].oneOf.2.function.description","typeLabel":"string"},"model":{"type":"string","description":"The model to use.","isRequired":true,"uniqueKey":"tools.items.[INDEX].oneOf.2.function.model","typeLabel":"string"}},"isRequired":true,"uniqueKey":"tools.items.[INDEX].oneOf.2.function","typeLabel":"LLM function · object"}},"uniqueKey":"tools.items.[INDEX].oneOf.2","typeLabel":"LLM tool · object"},{"type":"object","title":"Translation tool","description":"A tool that uses Palmyra Translate to translate text. Note that this tool does not stream results. The response is returned after the translation is complete.","minItems":1,"required":["function","type"],"properties":{"type":{"type":"string","description":"The type of tool.","enum":["translation"],"isRequired":true,"uniqueKey":"tools.items.[INDEX].oneOf.3.type","typeLabel":"enum\u003cstring>"},"function":{"title":"Translation function","description":"A tool that uses Palmyra Translate to translate text.","required":["model","formality","length_control","mask_profanity"],"type":"object","properties":{"model":{"type":"string","description":"The model to use for translation.","enum":["palmyra-translate"],"isRequired":true,"uniqueKey":"tools.items.[INDEX].oneOf.3.function.model","typeLabel":"enum\u003cstring>"},"formality":{"type":"boolean","description":"Whether to use formal or informal language in the translation. See the [list of languages that support formality](https://dev.writer.com/api-reference/translation-api/language-support#formality). If the language does not support formality, this parameter is ignored.","isRequired":true,"uniqueKey":"tools.items.[INDEX].oneOf.3.function.formality","typeLabel":"boolean"},"length_control":{"type":"boolean","description":"Whether to control the length of the translated text. See the [list of languages that support length control](https://dev.writer.com/api-reference/translation-api/language-support#length-control). If the language does not support length control, this parameter is ignored.","isRequired":true,"uniqueKey":"tools.items.[INDEX].oneOf.3.function.length_control","typeLabel":"boolean"},"mask_profanity":{"type":"boolean","description":"Whether to mask profane words in the translated text. See the [list of languages that do not support profanity masking](https://dev.writer.com/api-reference/translation-api/language-support#profanity-masking). If the language does not support profanity masking, this parameter is ignored.","isRequired":true,"uniqueKey":"tools.items.[INDEX].oneOf.3.function.mask_profanity","typeLabel":"boolean"},"source_language_code":{"type":"string","description":"Optional. The [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639_language_codes) language code of the original text to translate. For example, `en` for English, `zh` for Chinese, `fr` for French, `es` for Spanish. If the language has a variant, the code appends the two-digit [ISO-3166 country code](https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes). If you do not provide a language code, the LLM detects the language of the text.","uniqueKey":"tools.items.[INDEX].oneOf.3.function.source_language_code","typeLabel":"string"},"target_language_code":{"type":"string","description":"Optional. The [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639_language_codes) language code of the target language for the translation. For example, `en` for English, `zh` for Chinese, `fr` for French, `es` for Spanish. If the language has a variant, the code appends the two-digit [ISO-3166 country code](https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes). If you do not provide a language code, the LLM uses the content of the chat message to determine the target language.","uniqueKey":"tools.items.[INDEX].oneOf.3.function.target_language_code","typeLabel":"string"}},"isRequired":true,"uniqueKey":"tools.items.[INDEX].oneOf.3.function","typeLabel":"Translation function · object"}},"uniqueKey":"tools.items.[INDEX].oneOf.3","typeLabel":"Translation tool · object"},{"type":"object","title":"Vision tool","minItems":1,"required":["function","type"],"properties":{"type":{"type":"string","description":"The type of tool.","enum":["vision"],"isRequired":true,"uniqueKey":"tools.items.[INDEX].oneOf.4.type","typeLabel":"enum\u003cstring>"},"function":{"title":"Vision function","description":"A tool that uses Palmyra Vision to analyze images and documents. Supports JPG, PNG, PDF, and TXT files up to 7MB each.","required":["model","variables"],"type":"object","properties":{"variables":{"type":"array","items":{"title":"Vision Tool Request File Variable","required":["name","file_id"],"type":"object","properties":{"name":{"type":"string","description":"The name of the file variable. You must reference this name in the `message.content` field of the request to the chat completions endpoint. Use double curly braces (`{{}}`) to reference the file. For example, `Describe the difference between the image {{image_1}} and the image {{image_2}}`.","isRequired":true,"uniqueKey":"tools.items.[INDEX].oneOf.4.function.variables.items.[INDEX].name","typeLabel":"string"},"file_id":{"type":"string","description":"The File ID of the file to analyze. The file must be uploaded to the Writer platform before you use it with the Vision tool. Supported file types: JPG, PNG, PDF, TXT. The maximum allowed file size is 7MB.","isRequired":true,"uniqueKey":"tools.items.[INDEX].oneOf.4.function.variables.items.[INDEX].file_id","typeLabel":"string"}},"uniqueKey":"tools.items.[INDEX].oneOf.4.function.variables.items.[INDEX]","typeLabel":"Vision Tool Request File Variable · object"},"isRequired":true,"uniqueKey":"tools.items.[INDEX].oneOf.4.function.variables","typeLabel":"Vision Tool Request File Variable · object[]"},"model":{"type":"string","description":"The model to use for image analysis.","enum":["palmyra-vision"],"isRequired":true,"uniqueKey":"tools.items.[INDEX].oneOf.4.function.model","typeLabel":"enum\u003cstring>"}},"isRequired":true,"uniqueKey":"tools.items.[INDEX].oneOf.4.function","typeLabel":"Vision function · object"}},"uniqueKey":"tools.items.[INDEX].oneOf.4","typeLabel":"Vision tool · object"},{"type":"object","title":"Web search tool","minItems":1,"required":["function","type"],"properties":{"type":{"type":"string","description":"The type of tool.","enum":["web_search"],"isRequired":true,"uniqueKey":"tools.items.[INDEX].oneOf.5.type","typeLabel":"enum\u003cstring>"},"function":{"title":"web_search_function","description":"A tool that uses web search to find information.","required":["exclude_domains","include_domains"],"type":"object","properties":{"exclude_domains":{"type":"array","description":"An array of domains to exclude from the search results.","items":{"type":"string","uniqueKey":"tools.items.[INDEX].oneOf.5.function.exclude_domains.items.[INDEX]","typeLabel":"string"},"isRequired":true,"uniqueKey":"tools.items.[INDEX].oneOf.5.function.exclude_domains","typeLabel":"string[]"},"include_domains":{"type":"array","description":"An array of domains to include in the search results.","items":{"type":"string","uniqueKey":"tools.items.[INDEX].oneOf.5.function.include_domains.items.[INDEX]","typeLabel":"string"},"isRequired":true,"uniqueKey":"tools.items.[INDEX].oneOf.5.function.include_domains","typeLabel":"string[]"}},"isRequired":true,"uniqueKey":"tools.items.[INDEX].oneOf.5.function","typeLabel":"web_search_function · object"}},"uniqueKey":"tools.items.[INDEX].oneOf.5","typeLabel":"Web search tool · object"}],"uniqueKey":"tools.items.[INDEX]","typeLabel":"Function tool · object | Graph tool · object | LLM tool · object | Translation tool · object | Vision tool · object | Web search tool · object"},"uniqueKey":"tools","typeLabel":"(Function tool · object | Graph tool · object | LLM tool · object | Translation tool · object | Vision tool · object | Web search tool · object)[]"},"tool_choice":{"oneOf":[{"type":"object","title":"String","description":"Configure how the model will call functions:\n- `auto`: allows the model to automatically choose the tool to use, or not call a tool\n- `none`: disables tool calling; the model will instead generate a message\n- `required`: requires the model to call one or more tools\n\nYou can also use a JSON object to force the model to call a specific tool. For example, `{\"type\": \"function\", \"function\": {\"name\": \"get_current_weather\"}}` requires the model to call the `get_current_weather` function, regardless of the prompt.","required":["value"],"properties":{"value":{"title":"string_tool_choice_options","type":"string","enum":["none","auto","required"],"isRequired":true,"uniqueKey":"tool_choice.oneOf.0.value","typeLabel":"enum\u003cstring>"}},"uniqueKey":"tool_choice.oneOf.0","typeLabel":"String · object"},{"type":"object","title":"JSON object","description":"Configure how the model will call functions:\n- `auto`: allows the model to automatically choose the tool to use, or not call a tool\n- `none`: disables tool calling; the model will instead generate a message\n- `required`: requires the model to call one or more tools\n\nYou can also use a JSON object to force the model to call a specific tool. For example, `{\"type\": \"function\", \"function\": {\"name\": \"get_current_weather\"}}` requires the model to call the `get_current_weather` function, regardless of the prompt.","required":["value"],"properties":{"value":{"type":"object","description":"A JSON object that specifies the tool to call. For example, `{\"type\": \"function\", \"function\": {\"name\": \"get_current_weather\"}}`","additionalProperties":true,"isRequired":true,"uniqueKey":"tool_choice.oneOf.1.value","typeLabel":"object"}},"uniqueKey":"tool_choice.oneOf.1","typeLabel":"JSON object · object"}],"uniqueKey":"tool_choice","typeLabel":"String · object | JSON object · object"},"stream_options":{"title":"stream_options","description":"Additional options for streaming.","required":["include_usage"],"type":"object","properties":{"include_usage":{"type":"boolean","description":"Indicate whether to include usage information.","isRequired":true,"uniqueKey":"stream_options.include_usage","typeLabel":"boolean"}},"uniqueKey":"stream_options","typeLabel":"stream_options · object"},"response_format":{"title":"response_format","description":"The response format to use for the chat completion, available with `palmyra-x4` and `palmyra-x5`.\n\n`text` is the default response format. [JSON Schema](https://json-schema.org/) is supported for structured responses. If you specify `json_schema`, you must also provide a `json_schema` object.","required":["type"],"type":"object","properties":{"type":{"type":"string","description":"The type of response format to use.","enum":["text","json_schema"],"isRequired":true,"uniqueKey":"response_format.type","typeLabel":"enum\u003cstring>"},"json_schema":{"type":"object","description":"The JSON schema to use for the response format.","uniqueKey":"response_format.json_schema","typeLabel":"object"}},"uniqueKey":"response_format","typeLabel":"response_format · object"}},"example":{"model":"palmyra-x5","messages":[{"content":"Write a memo summarizing this earnings report.","role":"user"}]},"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"model":"palmyra-x5","messages":[{"content":"Write a memo summarizing this earnings report.","role":"user"}]}}},"exampleType":"generated"}},"required":true,"exampleType":"generated"},"responses":{"f44df85f-1713-49b0-a621-04afb3cd27eb":{"description":"Successful response","content":{"application/json":{"schema":{"required":["id","object","choices","created","model"],"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"A globally unique identifier (UUID) for the response generated by the API. This ID can be used to reference the specific operation or transaction within the system for tracking or debugging purposes.","isRequired":true,"uniqueKey":"id","typeLabel":"string\u003cuuid>"},"object":{"type":"string","description":"The type of object returned, which is always `chat.completion` for chat responses.","enum":["chat.completion"],"isRequired":true,"uniqueKey":"object","typeLabel":"enum\u003cstring>"},"choices":{"type":"array","items":{"required":["index","finish_reason","message"],"type":"object","properties":{"index":{"type":"integer","format":"int32","description":"The index of the choice in the list of completions generated by the model.","isRequired":true,"uniqueKey":"choices.items.[INDEX].index","typeLabel":"integer\u003cint32>"},"finish_reason":{"type":"string","enum":["stop","length","content_filter","tool_calls"],"description":"Describes the condition under which the model ceased generating content. Common reasons include 'length' (reached the maximum output size), 'stop' (encountered a stop sequence), 'content_filter' (harmful content filtered out), or 'tool_calls' (encountered tool calls).","isRequired":true,"uniqueKey":"choices.items.[INDEX].finish_reason","typeLabel":"enum\u003cstring>"},"message":{"required":["content","role","refusal"],"type":"object","description":"The chat completion message from the model. Note: this field is deprecated for streaming. Use `delta` instead.","properties":{"content":{"type":"string","description":"The text content produced by the model. This field contains the actual output generated, reflecting the model's response to the input query or command.","isRequired":true,"uniqueKey":"choices.items.[INDEX].message.content","typeLabel":"string"},"role":{"type":"string","enum":["assistant"],"description":"Specifies the role associated with the content.","isRequired":true,"uniqueKey":"choices.items.[INDEX].message.role","typeLabel":"enum\u003cstring>"},"refusal":{"oneOf":[{"type":"string","isRequired":true,"uniqueKey":"choices.items.[INDEX].message.refusal.oneOf.0","typeLabel":"string"},{"type":"null","isRequired":true,"uniqueKey":"choices.items.[INDEX].message.refusal.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"choices.items.[INDEX].message.refusal","typeLabel":"string | null"},"tool_calls":{"type":"array","items":{"title":"tool_call","type":"object","required":["id","type","function"],"properties":{"id":{"type":"string","isRequired":true,"uniqueKey":"choices.items.[INDEX].message.tool_calls.items.[INDEX].id","typeLabel":"string"},"type":{"type":"string","enum":["function"],"isRequired":true,"uniqueKey":"choices.items.[INDEX].message.tool_calls.items.[INDEX].type","typeLabel":"enum\u003cstring>"},"function":{"title":"function","type":"object","required":["name","arguments"],"properties":{"name":{"type":"string","isRequired":true,"uniqueKey":"choices.items.[INDEX].message.tool_calls.items.[INDEX].function.name","typeLabel":"string"},"arguments":{"type":"string","isRequired":true,"uniqueKey":"choices.items.[INDEX].message.tool_calls.items.[INDEX].function.arguments","typeLabel":"string"}},"isRequired":true,"uniqueKey":"choices.items.[INDEX].message.tool_calls.items.[INDEX].function","typeLabel":"function · object"},"index":{"type":"integer","format":"int32","uniqueKey":"choices.items.[INDEX].message.tool_calls.items.[INDEX].index","typeLabel":"integer\u003cint32>"}},"uniqueKey":"choices.items.[INDEX].message.tool_calls.items.[INDEX]","typeLabel":"tool_call · object"},"minItems":1,"uniqueKey":"choices.items.[INDEX].message.tool_calls","typeLabel":"tool_call · object[]"},"graph_data":{"title":"graph_data","type":"object","properties":{"sources":{"type":"array","items":{"oneOf":[{"title":"source","description":"A source snippet containing text and fileId from Knowledge Graph content.","required":["file_id","snippet"],"type":"object","properties":{"file_id":{"type":"string","description":"The unique identifier of the file in your Writer account.","isRequired":true,"uniqueKey":"choices.items.[INDEX].message.graph_data.sources.items.[INDEX].oneOf.0.file_id","typeLabel":"string"},"snippet":{"type":"string","description":"The exact text snippet from the source document that was used to support the response.","isRequired":true,"uniqueKey":"choices.items.[INDEX].message.graph_data.sources.items.[INDEX].oneOf.0.snippet","typeLabel":"string"}},"uniqueKey":"choices.items.[INDEX].message.graph_data.sources.items.[INDEX].oneOf.0","typeLabel":"source · object"},{"title":"source","description":"A source snippet containing text and fileId from Knowledge Graph content.","required":["file_id","snippet"],"type":"null","properties":{"file_id":{"type":"string","description":"The unique identifier of the file in your Writer account."},"snippet":{"type":"string","description":"The exact text snippet from the source document that was used to support the response."}},"uniqueKey":"choices.items.[INDEX].message.graph_data.sources.items.[INDEX].oneOf.1","typeLabel":"null"}],"uniqueKey":"choices.items.[INDEX].message.graph_data.sources.items.[INDEX]","typeLabel":"source · object | null"},"uniqueKey":"choices.items.[INDEX].message.graph_data.sources","typeLabel":"(source · object | null)[]"},"status":{"oneOf":[{"title":"graph_stage_status","type":"string","enum":["processing","finished"],"uniqueKey":"choices.items.[INDEX].message.graph_data.status.oneOf.0","typeLabel":"enum\u003cstring>"},{"title":"graph_stage_status","type":"null","enum":["processing","finished"],"uniqueKey":"choices.items.[INDEX].message.graph_data.status.oneOf.1","typeLabel":"null"}],"uniqueKey":"choices.items.[INDEX].message.graph_data.status","typeLabel":"enum\u003cstring> | null"},"subqueries":{"type":"array","items":{"oneOf":[{"title":"sub_query","description":"A sub-question generated to break down complex queries into more manageable parts, along with its answer and supporting sources.","required":["query","answer","sources"],"type":"object","properties":{"query":{"type":"string","description":"The subquery that was generated to help answer the main question.","isRequired":true,"uniqueKey":"choices.items.[INDEX].message.graph_data.subqueries.items.[INDEX].oneOf.0.query","typeLabel":"string"},"answer":{"type":"string","description":"The answer to the subquery based on Knowledge Graph content.","isRequired":true,"uniqueKey":"choices.items.[INDEX].message.graph_data.subqueries.items.[INDEX].oneOf.0.answer","typeLabel":"string"},"sources":{"type":"array","description":"Array of source snippets that were used to answer this subquery.","items":{"oneOf":[{"title":"source","description":"A source snippet containing text and fileId from Knowledge Graph content.","required":["file_id","snippet"],"type":"object","properties":{"file_id":{"type":"string","description":"The unique identifier of the file in your Writer account.","isRequired":true,"uniqueKey":"choices.items.[INDEX].message.graph_data.subqueries.items.[INDEX].oneOf.0.sources.items.[INDEX].oneOf.0.file_id","typeLabel":"string"},"snippet":{"type":"string","description":"The exact text snippet from the source document that was used to support the response.","isRequired":true,"uniqueKey":"choices.items.[INDEX].message.graph_data.subqueries.items.[INDEX].oneOf.0.sources.items.[INDEX].oneOf.0.snippet","typeLabel":"string"}},"uniqueKey":"choices.items.[INDEX].message.graph_data.subqueries.items.[INDEX].oneOf.0.sources.items.[INDEX].oneOf.0","typeLabel":"source · object"},{"title":"source","description":"A source snippet containing text and fileId from Knowledge Graph content.","required":["file_id","snippet"],"type":"null","properties":{"file_id":{"type":"string","description":"The unique identifier of the file in your Writer account."},"snippet":{"type":"string","description":"The exact text snippet from the source document that was used to support the response."}},"uniqueKey":"choices.items.[INDEX].message.graph_data.subqueries.items.[INDEX].oneOf.0.sources.items.[INDEX].oneOf.1","typeLabel":"null"}],"uniqueKey":"choices.items.[INDEX].message.graph_data.subqueries.items.[INDEX].oneOf.0.sources.items.[INDEX]","typeLabel":"source · object | null"},"isRequired":true,"uniqueKey":"choices.items.[INDEX].message.graph_data.subqueries.items.[INDEX].oneOf.0.sources","typeLabel":"(source · object | null)[]"}},"uniqueKey":"choices.items.[INDEX].message.graph_data.subqueries.items.[INDEX].oneOf.0","typeLabel":"sub_query · object"},{"title":"sub_query","description":"A sub-question generated to break down complex queries into more manageable parts, along with its answer and supporting sources.","required":["query","answer","sources"],"type":"null","properties":{"query":{"type":"string","description":"The subquery that was generated to help answer the main question."},"answer":{"type":"string","description":"The answer to the subquery based on Knowledge Graph content."},"sources":{"type":"array","description":"Array of source snippets that were used to answer this subquery.","items":{"oneOf":[{"title":"source","description":"A source snippet containing text and fileId from Knowledge Graph content.","required":["file_id","snippet"],"type":"object","properties":{"file_id":{"type":"string","description":"The unique identifier of the file in your Writer account."},"snippet":{"type":"string","description":"The exact text snippet from the source document that was used to support the response."}}},{"title":"source","description":"A source snippet containing text and fileId from Knowledge Graph content.","required":["file_id","snippet"],"type":"null","properties":{"file_id":{"type":"string","description":"The unique identifier of the file in your Writer account."},"snippet":{"type":"string","description":"The exact text snippet from the source document that was used to support the response."}}}]}}},"uniqueKey":"choices.items.[INDEX].message.graph_data.subqueries.items.[INDEX].oneOf.1","typeLabel":"null"}],"uniqueKey":"choices.items.[INDEX].message.graph_data.subqueries.items.[INDEX]","typeLabel":"sub_query · object | null"},"uniqueKey":"choices.items.[INDEX].message.graph_data.subqueries","typeLabel":"(sub_query · object | null)[]"},"references":{"title":"references","description":"Detailed source information organized by reference type, providing comprehensive metadata about the sources used to generate the response.","type":"object","properties":{"files":{"type":"array","description":"Array of file-based references from uploaded documents in the Knowledge Graph.","items":{"title":"file","description":"A file-based reference containing text snippets from uploaded documents in the Knowledge Graph.","required":["text","fileId","score"],"type":"object","properties":{"text":{"type":"string","description":"The exact text snippet from the source document that was used to support the response.","isRequired":true,"uniqueKey":"choices.items.[INDEX].message.graph_data.references.files.items.[INDEX].text","typeLabel":"string"},"fileId":{"type":"string","description":"The unique identifier of the file in your Writer account.","isRequired":true,"uniqueKey":"choices.items.[INDEX].message.graph_data.references.files.items.[INDEX].fileId","typeLabel":"string"},"score":{"type":"number","description":"Internal score used during the retrieval process for ranking and selecting relevant snippets.","isRequired":true,"uniqueKey":"choices.items.[INDEX].message.graph_data.references.files.items.[INDEX].score","typeLabel":"number"},"page":{"type":"integer","format":"int32","description":"Page number where this snippet was found in the source document.","uniqueKey":"choices.items.[INDEX].message.graph_data.references.files.items.[INDEX].page","typeLabel":"integer\u003cint32>"},"cite":{"type":"string","description":"Unique citation ID that appears in inline citations within the response text (null if not cited).","uniqueKey":"choices.items.[INDEX].message.graph_data.references.files.items.[INDEX].cite","typeLabel":"string"}},"uniqueKey":"choices.items.[INDEX].message.graph_data.references.files.items.[INDEX]","typeLabel":"file · object"},"minItems":1,"uniqueKey":"choices.items.[INDEX].message.graph_data.references.files","typeLabel":"file · object[]"},"web":{"type":"array","description":"Array of web-based references from online sources accessed during the query.","items":{"title":"web","description":"A web-based reference containing text snippets from online sources accessed during the query.","required":["text","url","title","score"],"type":"object","properties":{"text":{"type":"string","description":"The exact text snippet from the web source that was used to support the response.","isRequired":true,"uniqueKey":"choices.items.[INDEX].message.graph_data.references.web.items.[INDEX].text","typeLabel":"string"},"url":{"type":"string","description":"The URL of the web page where this content was found.","format":"uri","isRequired":true,"uniqueKey":"choices.items.[INDEX].message.graph_data.references.web.items.[INDEX].url","typeLabel":"string\u003curi>"},"title":{"type":"string","description":"The title of the web page where this content was found.","isRequired":true,"uniqueKey":"choices.items.[INDEX].message.graph_data.references.web.items.[INDEX].title","typeLabel":"string"},"score":{"type":"number","description":"Internal score used during the retrieval process for ranking and selecting relevant snippets.","isRequired":true,"uniqueKey":"choices.items.[INDEX].message.graph_data.references.web.items.[INDEX].score","typeLabel":"number"}},"uniqueKey":"choices.items.[INDEX].message.graph_data.references.web.items.[INDEX]","typeLabel":"web · object"},"minItems":1,"uniqueKey":"choices.items.[INDEX].message.graph_data.references.web","typeLabel":"web · object[]"}},"uniqueKey":"choices.items.[INDEX].message.graph_data.references","typeLabel":"references · object"}},"uniqueKey":"choices.items.[INDEX].message.graph_data","typeLabel":"graph_data · object"},"llm_data":{"oneOf":[{"title":"llm_data","required":["prompt","model"],"type":"object","properties":{"prompt":{"type":"string","description":"The prompt processed by the model.","isRequired":true,"uniqueKey":"choices.items.[INDEX].message.llm_data.oneOf.0.prompt","typeLabel":"string"},"model":{"type":"string","description":"The model used by the tool.","isRequired":true,"uniqueKey":"choices.items.[INDEX].message.llm_data.oneOf.0.model","typeLabel":"string"}},"uniqueKey":"choices.items.[INDEX].message.llm_data.oneOf.0","typeLabel":"llm_data · object"},{"title":"llm_data","required":["prompt","model"],"type":"null","properties":{"prompt":{"type":"string","description":"The prompt processed by the model."},"model":{"type":"string","description":"The model used by the tool."}},"uniqueKey":"choices.items.[INDEX].message.llm_data.oneOf.1","typeLabel":"null"}],"uniqueKey":"choices.items.[INDEX].message.llm_data","typeLabel":"llm_data · object | null"},"translation_data":{"title":"translation_data","required":["source_text","source_language_code","target_language_code"],"type":"object","properties":{"source_text":{"type":"string","description":"The text the tool translated.","isRequired":true,"uniqueKey":"choices.items.[INDEX].message.translation_data.source_text","typeLabel":"string"},"source_language_code":{"type":"string","description":"The language code of the source text.","isRequired":true,"uniqueKey":"choices.items.[INDEX].message.translation_data.source_language_code","typeLabel":"string"},"target_language_code":{"type":"string","description":"The language code of the target text.","isRequired":true,"uniqueKey":"choices.items.[INDEX].message.translation_data.target_language_code","typeLabel":"string"}},"uniqueKey":"choices.items.[INDEX].message.translation_data","typeLabel":"translation_data · object"},"web_search_data":{"title":"web_search_data","required":["sources"],"type":"object","properties":{"sources":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string","uniqueKey":"choices.items.[INDEX].message.web_search_data.sources.items.[INDEX].url","typeLabel":"string"},"raw_content":{"type":"string","uniqueKey":"choices.items.[INDEX].message.web_search_data.sources.items.[INDEX].raw_content","typeLabel":"string"}},"uniqueKey":"choices.items.[INDEX].message.web_search_data.sources.items.[INDEX]","typeLabel":"object"},"isRequired":true,"uniqueKey":"choices.items.[INDEX].message.web_search_data.sources","typeLabel":"object[]"}},"uniqueKey":"choices.items.[INDEX].message.web_search_data","typeLabel":"web_search_data · object"}},"isRequired":true,"uniqueKey":"choices.items.[INDEX].message","typeLabel":"object"},"logprobs":{"oneOf":[{"type":"object","required":["content","refusal"],"properties":{"content":{"oneOf":[{"type":"array","items":{"title":"logprobs_token","required":["token","logprob","top_logprobs"],"type":"object","properties":{"token":{"type":"string","isRequired":true,"uniqueKey":"choices.items.[INDEX].logprobs.oneOf.0.content.oneOf.0.items.[INDEX].token","typeLabel":"string"},"logprob":{"type":"number","format":"double","isRequired":true,"uniqueKey":"choices.items.[INDEX].logprobs.oneOf.0.content.oneOf.0.items.[INDEX].logprob","typeLabel":"number\u003cdouble>"},"top_logprobs":{"type":"array","items":{"title":"top_log_prob","description":"An array of mappings for each token to its top log probabilities, showing detailed prediction probabilities.","required":["token","logprob"],"type":"object","properties":{"token":{"type":"string","isRequired":true,"uniqueKey":"choices.items.[INDEX].logprobs.oneOf.0.content.oneOf.0.items.[INDEX].top_logprobs.items.[INDEX].token","typeLabel":"string"},"logprob":{"type":"number","format":"double","isRequired":true,"uniqueKey":"choices.items.[INDEX].logprobs.oneOf.0.content.oneOf.0.items.[INDEX].top_logprobs.items.[INDEX].logprob","typeLabel":"number\u003cdouble>"},"bytes":{"type":"array","items":{"type":"integer","format":"int32","uniqueKey":"choices.items.[INDEX].logprobs.oneOf.0.content.oneOf.0.items.[INDEX].top_logprobs.items.[INDEX].bytes.items.[INDEX]","typeLabel":"integer\u003cint32>"},"uniqueKey":"choices.items.[INDEX].logprobs.oneOf.0.content.oneOf.0.items.[INDEX].top_logprobs.items.[INDEX].bytes","typeLabel":"integer\u003cint32>[]"}},"uniqueKey":"choices.items.[INDEX].logprobs.oneOf.0.content.oneOf.0.items.[INDEX].top_logprobs.items.[INDEX]","typeLabel":"top_log_prob · object"},"isRequired":true,"uniqueKey":"choices.items.[INDEX].logprobs.oneOf.0.content.oneOf.0.items.[INDEX].top_logprobs","typeLabel":"top_log_prob · object[]"},"bytes":{"type":"array","items":{"type":"integer","format":"int32","uniqueKey":"choices.items.[INDEX].logprobs.oneOf.0.content.oneOf.0.items.[INDEX].bytes.items.[INDEX]","typeLabel":"integer\u003cint32>"},"uniqueKey":"choices.items.[INDEX].logprobs.oneOf.0.content.oneOf.0.items.[INDEX].bytes","typeLabel":"integer\u003cint32>[]"}},"uniqueKey":"choices.items.[INDEX].logprobs.oneOf.0.content.oneOf.0.items.[INDEX]","typeLabel":"logprobs_token · object"},"isRequired":true,"uniqueKey":"choices.items.[INDEX].logprobs.oneOf.0.content.oneOf.0","typeLabel":"logprobs_token · object[]"},{"type":"null","items":{"title":"logprobs_token","required":["token","logprob","top_logprobs"],"type":"object","properties":{"token":{"type":"string"},"logprob":{"type":"number","format":"double"},"bytes":{"type":"array","items":{"type":"integer","format":"int32"}},"top_logprobs":{"type":"array","items":{"title":"top_log_prob","description":"An array of mappings for each token to its top log probabilities, showing detailed prediction probabilities.","required":["token","logprob"],"type":"object","properties":{"token":{"type":"string"},"logprob":{"type":"number","format":"double"},"bytes":{"type":"array","items":{"type":"integer","format":"int32"}}}}}}},"isRequired":true,"uniqueKey":"choices.items.[INDEX].logprobs.oneOf.0.content.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"choices.items.[INDEX].logprobs.oneOf.0.content","typeLabel":"logprobs_token · object[] | null"},"refusal":{"oneOf":[{"type":"array","items":{"title":"logprobs_token","required":["token","logprob","top_logprobs"],"type":"object","properties":{"token":{"type":"string","isRequired":true,"uniqueKey":"choices.items.[INDEX].logprobs.oneOf.0.refusal.oneOf.0.items.[INDEX].token","typeLabel":"string"},"logprob":{"type":"number","format":"double","isRequired":true,"uniqueKey":"choices.items.[INDEX].logprobs.oneOf.0.refusal.oneOf.0.items.[INDEX].logprob","typeLabel":"number\u003cdouble>"},"top_logprobs":{"type":"array","items":{"title":"top_log_prob","description":"An array of mappings for each token to its top log probabilities, showing detailed prediction probabilities.","required":["token","logprob"],"type":"object","properties":{"token":{"type":"string","isRequired":true,"uniqueKey":"choices.items.[INDEX].logprobs.oneOf.0.refusal.oneOf.0.items.[INDEX].top_logprobs.items.[INDEX].token","typeLabel":"string"},"logprob":{"type":"number","format":"double","isRequired":true,"uniqueKey":"choices.items.[INDEX].logprobs.oneOf.0.refusal.oneOf.0.items.[INDEX].top_logprobs.items.[INDEX].logprob","typeLabel":"number\u003cdouble>"},"bytes":{"type":"array","items":{"type":"integer","format":"int32","uniqueKey":"choices.items.[INDEX].logprobs.oneOf.0.refusal.oneOf.0.items.[INDEX].top_logprobs.items.[INDEX].bytes.items.[INDEX]","typeLabel":"integer\u003cint32>"},"uniqueKey":"choices.items.[INDEX].logprobs.oneOf.0.refusal.oneOf.0.items.[INDEX].top_logprobs.items.[INDEX].bytes","typeLabel":"integer\u003cint32>[]"}},"uniqueKey":"choices.items.[INDEX].logprobs.oneOf.0.refusal.oneOf.0.items.[INDEX].top_logprobs.items.[INDEX]","typeLabel":"top_log_prob · object"},"isRequired":true,"uniqueKey":"choices.items.[INDEX].logprobs.oneOf.0.refusal.oneOf.0.items.[INDEX].top_logprobs","typeLabel":"top_log_prob · object[]"},"bytes":{"type":"array","items":{"type":"integer","format":"int32","uniqueKey":"choices.items.[INDEX].logprobs.oneOf.0.refusal.oneOf.0.items.[INDEX].bytes.items.[INDEX]","typeLabel":"integer\u003cint32>"},"uniqueKey":"choices.items.[INDEX].logprobs.oneOf.0.refusal.oneOf.0.items.[INDEX].bytes","typeLabel":"integer\u003cint32>[]"}},"uniqueKey":"choices.items.[INDEX].logprobs.oneOf.0.refusal.oneOf.0.items.[INDEX]","typeLabel":"logprobs_token · object"},"isRequired":true,"uniqueKey":"choices.items.[INDEX].logprobs.oneOf.0.refusal.oneOf.0","typeLabel":"logprobs_token · object[]"},{"type":"null","items":{"title":"logprobs_token","required":["token","logprob","top_logprobs"],"type":"object","properties":{"token":{"type":"string"},"logprob":{"type":"number","format":"double"},"bytes":{"type":"array","items":{"type":"integer","format":"int32"}},"top_logprobs":{"type":"array","items":{"title":"top_log_prob","description":"An array of mappings for each token to its top log probabilities, showing detailed prediction probabilities.","required":["token","logprob"],"type":"object","properties":{"token":{"type":"string"},"logprob":{"type":"number","format":"double"},"bytes":{"type":"array","items":{"type":"integer","format":"int32"}}}}}}},"isRequired":true,"uniqueKey":"choices.items.[INDEX].logprobs.oneOf.0.refusal.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"choices.items.[INDEX].logprobs.oneOf.0.refusal","typeLabel":"logprobs_token · object[] | null"}},"description":"Log probability information for the choice.","uniqueKey":"choices.items.[INDEX].logprobs.oneOf.0","typeLabel":"object"},{"type":"null","required":["content","refusal"],"properties":{"content":{"oneOf":[{"type":"array","items":{"title":"logprobs_token","required":["token","logprob","top_logprobs"],"type":"object","properties":{"token":{"type":"string"},"logprob":{"type":"number","format":"double"},"bytes":{"type":"array","items":{"type":"integer","format":"int32"}},"top_logprobs":{"type":"array","items":{"title":"top_log_prob","description":"An array of mappings for each token to its top log probabilities, showing detailed prediction probabilities.","required":["token","logprob"],"type":"object","properties":{"token":{"type":"string"},"logprob":{"type":"number","format":"double"},"bytes":{"type":"array","items":{"type":"integer","format":"int32"}}}}}}}},{"type":"null","items":{"title":"logprobs_token","required":["token","logprob","top_logprobs"],"type":"object","properties":{"token":{"type":"string"},"logprob":{"type":"number","format":"double"},"bytes":{"type":"array","items":{"type":"integer","format":"int32"}},"top_logprobs":{"type":"array","items":{"title":"top_log_prob","description":"An array of mappings for each token to its top log probabilities, showing detailed prediction probabilities.","required":["token","logprob"],"type":"object","properties":{"token":{"type":"string"},"logprob":{"type":"number","format":"double"},"bytes":{"type":"array","items":{"type":"integer","format":"int32"}}}}}}}}]},"refusal":{"oneOf":[{"type":"array","items":{"title":"logprobs_token","required":["token","logprob","top_logprobs"],"type":"object","properties":{"token":{"type":"string"},"logprob":{"type":"number","format":"double"},"bytes":{"type":"array","items":{"type":"integer","format":"int32"}},"top_logprobs":{"type":"array","items":{"title":"top_log_prob","description":"An array of mappings for each token to its top log probabilities, showing detailed prediction probabilities.","required":["token","logprob"],"type":"object","properties":{"token":{"type":"string"},"logprob":{"type":"number","format":"double"},"bytes":{"type":"array","items":{"type":"integer","format":"int32"}}}}}}}},{"type":"null","items":{"title":"logprobs_token","required":["token","logprob","top_logprobs"],"type":"object","properties":{"token":{"type":"string"},"logprob":{"type":"number","format":"double"},"bytes":{"type":"array","items":{"type":"integer","format":"int32"}},"top_logprobs":{"type":"array","items":{"title":"top_log_prob","description":"An array of mappings for each token to its top log probabilities, showing detailed prediction probabilities.","required":["token","logprob"],"type":"object","properties":{"token":{"type":"string"},"logprob":{"type":"number","format":"double"},"bytes":{"type":"array","items":{"type":"integer","format":"int32"}}}}}}}}]}},"description":"Log probability information for the choice.","uniqueKey":"choices.items.[INDEX].logprobs.oneOf.1","typeLabel":"null"}],"uniqueKey":"choices.items.[INDEX].logprobs","typeLabel":"object | null"}},"uniqueKey":"choices.items.[INDEX]","typeLabel":"object"},"minItems":1,"description":"An array of objects representing the different outcomes or results produced by the model based on the input provided.","isRequired":true,"uniqueKey":"choices","typeLabel":"object[]"},"created":{"type":"integer","format":"int64","description":"The Unix timestamp (in seconds) when the response was created. This timestamp can be used to verify the timing of the response relative to other events or operations.","isRequired":true,"uniqueKey":"created","typeLabel":"integer\u003cint64>"},"model":{"type":"string","description":"Identifies the specific model used to generate the response.","isRequired":true,"uniqueKey":"model","typeLabel":"string"},"usage":{"title":"chat_completion_usage","description":"Usage information for the chat completion response. Please note that at this time Knowledge Graph tool usage is not included in this object.","required":["prompt_tokens","total_tokens","completion_tokens"],"type":"object","properties":{"prompt_tokens":{"type":"integer","format":"int32","isRequired":true,"uniqueKey":"usage.prompt_tokens","typeLabel":"integer\u003cint32>"},"total_tokens":{"type":"integer","format":"int32","isRequired":true,"uniqueKey":"usage.total_tokens","typeLabel":"integer\u003cint32>"},"completion_tokens":{"type":"integer","format":"int32","isRequired":true,"uniqueKey":"usage.completion_tokens","typeLabel":"integer\u003cint32>"},"prompt_token_details":{"title":"prompt_token_details","required":["cached_tokens"],"type":"object","properties":{"cached_tokens":{"type":"integer","format":"int32","isRequired":true,"uniqueKey":"usage.prompt_token_details.cached_tokens","typeLabel":"integer\u003cint32>"}},"uniqueKey":"usage.prompt_token_details","typeLabel":"prompt_token_details · object"},"completion_tokens_details":{"title":"completion_token_details","required":["reasoning_tokens"],"type":"object","properties":{"reasoning_tokens":{"type":"integer","format":"int32","isRequired":true,"uniqueKey":"usage.completion_tokens_details.reasoning_tokens","typeLabel":"integer\u003cint32>"}},"uniqueKey":"usage.completion_tokens_details","typeLabel":"completion_token_details · object"}},"uniqueKey":"usage","typeLabel":"chat_completion_usage · object"},"system_fingerprint":{"type":"string","description":"A string representing the backend configuration that the model runs with.","uniqueKey":"system_fingerprint","typeLabel":"string"},"service_tier":{"type":"string","description":"The service tier used for processing the request.","uniqueKey":"service_tier","typeLabel":"string"}},"example":{"id":"57e4f58f-f7b1-41d8-be17-a6279c073aad","object":"chat.completion","choices":[{"index":0,"finish_reason":"stop","message":{"content":"The earnings report shows...","role":"assistant","refusal":null,"tool_calls":[],"graph_data":{"sources":[],"status":"finished","subqueries":[]},"llm_data":{"prompt":"Write a memo summarizing this earnings report.","model":"palmyra-x5"},"translation_data":null,"web_search_data":null}}],"created":1715361795,"model":"palmyra-x5","usage":{"prompt_tokens":40,"total_tokens":340,"completion_tokens":300,"prompt_token_details":{"cached_tokens":0},"completion_token_details":{"reasoning_tokens":0}},"system_fingerprint":"v1","service_tier":"standard"},"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"id":"57e4f58f-f7b1-41d8-be17-a6279c073aad","object":"chat.completion","choices":[{"index":0,"finish_reason":"stop","message":{"content":"The earnings report shows...","role":"assistant","refusal":null,"tool_calls":[],"graph_data":{"sources":[],"status":"finished","subqueries":[]},"llm_data":{"prompt":"Write a memo summarizing this earnings report.","model":"palmyra-x5"},"translation_data":null,"web_search_data":null}}],"created":1715361795,"model":"palmyra-x5","usage":{"prompt_tokens":40,"total_tokens":340,"completion_tokens":300,"prompt_token_details":{"cached_tokens":0},"completion_token_details":{"reasoning_tokens":0}},"system_fingerprint":"v1","service_tier":"standard"}}},"exampleType":"generated"},"text/event-stream":{"schema":{"type":"array","items":{"required":["id","object","created","choices","model"],"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"A globally unique identifier (UUID) for the response generated by the API. This ID can be used to reference the specific operation or transaction within the system for tracking or debugging purposes.","isRequired":true,"uniqueKey":"items.[INDEX].id","typeLabel":"string\u003cuuid>"},"object":{"type":"string","description":"The type of object returned, which is always `chat.completion.chunk` for streaming chat responses.","enum":["chat.completion.chunk"],"isRequired":true,"uniqueKey":"items.[INDEX].object","typeLabel":"enum\u003cstring>"},"choices":{"type":"array","items":{"required":["index","finish_reason","delta"],"type":"object","properties":{"index":{"type":"integer","format":"int32","description":"The index of the choice in the list of completions generated by the model.","isRequired":true,"uniqueKey":"items.[INDEX].choices.items.[INDEX].index","typeLabel":"integer\u003cint32>"},"finish_reason":{"oneOf":[{"type":"string","enum":["stop","length","content_filter","tool_calls"],"description":"Describes the condition under which the model ceased generating content. Common reasons include 'length' (reached the maximum output size), 'stop' (encountered a stop sequence), 'content_filter' (harmful content filtered out), or 'tool_calls' (encountered tool calls).","isRequired":true,"uniqueKey":"items.[INDEX].choices.items.[INDEX].finish_reason.oneOf.0","typeLabel":"enum\u003cstring>"},{"type":"null","enum":["stop","length","content_filter","tool_calls"],"description":"Describes the condition under which the model ceased generating content. Common reasons include 'length' (reached the maximum output size), 'stop' (encountered a stop sequence), 'content_filter' (harmful content filtered out), or 'tool_calls' (encountered tool calls).","isRequired":true,"uniqueKey":"items.[INDEX].choices.items.[INDEX].finish_reason.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"items.[INDEX].choices.items.[INDEX].finish_reason","typeLabel":"enum\u003cstring> | null"},"delta":{"type":"object","description":"A chat completion delta generated by streamed model responses.","properties":{"content":{"type":"string","description":"The text content produced by the model. This field contains the actual output generated, reflecting the model's response to the input query or command.","uniqueKey":"items.[INDEX].choices.items.[INDEX].delta.content","typeLabel":"string"},"role":{"type":"string","enum":["user","assistant","system"],"description":"Specifies the role associated with the content, indicating whether the message is from the 'assistant' or another defined role, helping to contextualize the output within the interaction flow.","uniqueKey":"items.[INDEX].choices.items.[INDEX].delta.role","typeLabel":"enum\u003cstring>"},"tool_calls":{"type":"array","items":{"title":"tool_call","type":"object","required":["index"],"properties":{"index":{"type":"integer","format":"int32","isRequired":true,"uniqueKey":"items.[INDEX].choices.items.[INDEX].delta.tool_calls.items.[INDEX].index","typeLabel":"integer\u003cint32>"},"id":{"type":"string","uniqueKey":"items.[INDEX].choices.items.[INDEX].delta.tool_calls.items.[INDEX].id","typeLabel":"string"},"type":{"type":"string","enum":["function"],"uniqueKey":"items.[INDEX].choices.items.[INDEX].delta.tool_calls.items.[INDEX].type","typeLabel":"enum\u003cstring>"},"function":{"title":"function","type":"object","required":["name","arguments"],"properties":{"name":{"type":"string","isRequired":true,"uniqueKey":"items.[INDEX].choices.items.[INDEX].delta.tool_calls.items.[INDEX].function.name","typeLabel":"string"},"arguments":{"type":"string","isRequired":true,"uniqueKey":"items.[INDEX].choices.items.[INDEX].delta.tool_calls.items.[INDEX].function.arguments","typeLabel":"string"}},"uniqueKey":"items.[INDEX].choices.items.[INDEX].delta.tool_calls.items.[INDEX].function","typeLabel":"function · object"}},"uniqueKey":"items.[INDEX].choices.items.[INDEX].delta.tool_calls.items.[INDEX]","typeLabel":"tool_call · object"},"minItems":1,"uniqueKey":"items.[INDEX].choices.items.[INDEX].delta.tool_calls","typeLabel":"tool_call · object[]"},"graph_data":{"title":"graph_data","type":"object","properties":{"sources":{"type":"array","items":{"oneOf":[{"title":"source","description":"A source snippet containing text and fileId from Knowledge Graph content.","required":["file_id","snippet"],"type":"object","properties":{"file_id":{"type":"string","description":"The unique identifier of the file in your Writer account.","isRequired":true,"uniqueKey":"items.[INDEX].choices.items.[INDEX].delta.graph_data.sources.items.[INDEX].oneOf.0.file_id","typeLabel":"string"},"snippet":{"type":"string","description":"The exact text snippet from the source document that was used to support the response.","isRequired":true,"uniqueKey":"items.[INDEX].choices.items.[INDEX].delta.graph_data.sources.items.[INDEX].oneOf.0.snippet","typeLabel":"string"}},"uniqueKey":"items.[INDEX].choices.items.[INDEX].delta.graph_data.sources.items.[INDEX].oneOf.0","typeLabel":"source · object"},{"title":"source","description":"A source snippet containing text and fileId from Knowledge Graph content.","required":["file_id","snippet"],"type":"null","properties":{"file_id":{"type":"string","description":"The unique identifier of the file in your Writer account."},"snippet":{"type":"string","description":"The exact text snippet from the source document that was used to support the response."}},"uniqueKey":"items.[INDEX].choices.items.[INDEX].delta.graph_data.sources.items.[INDEX].oneOf.1","typeLabel":"null"}],"uniqueKey":"items.[INDEX].choices.items.[INDEX].delta.graph_data.sources.items.[INDEX]","typeLabel":"source · object | null"},"uniqueKey":"items.[INDEX].choices.items.[INDEX].delta.graph_data.sources","typeLabel":"(source · object | null)[]"},"status":{"oneOf":[{"title":"graph_stage_status","type":"string","enum":["processing","finished"],"uniqueKey":"items.[INDEX].choices.items.[INDEX].delta.graph_data.status.oneOf.0","typeLabel":"enum\u003cstring>"},{"title":"graph_stage_status","type":"null","enum":["processing","finished"],"uniqueKey":"items.[INDEX].choices.items.[INDEX].delta.graph_data.status.oneOf.1","typeLabel":"null"}],"uniqueKey":"items.[INDEX].choices.items.[INDEX].delta.graph_data.status","typeLabel":"enum\u003cstring> | null"},"subqueries":{"type":"array","items":{"oneOf":[{"title":"sub_query","description":"A sub-question generated to break down complex queries into more manageable parts, along with its answer and supporting sources.","required":["query","answer","sources"],"type":"object","properties":{"query":{"type":"string","description":"The subquery that was generated to help answer the main question.","isRequired":true,"uniqueKey":"items.[INDEX].choices.items.[INDEX].delta.graph_data.subqueries.items.[INDEX].oneOf.0.query","typeLabel":"string"},"answer":{"type":"string","description":"The answer to the subquery based on Knowledge Graph content.","isRequired":true,"uniqueKey":"items.[INDEX].choices.items.[INDEX].delta.graph_data.subqueries.items.[INDEX].oneOf.0.answer","typeLabel":"string"},"sources":{"type":"array","description":"Array of source snippets that were used to answer this subquery.","items":{"oneOf":[{"title":"source","description":"A source snippet containing text and fileId from Knowledge Graph content.","required":["file_id","snippet"],"type":"object","properties":{"file_id":{"type":"string","description":"The unique identifier of the file in your Writer account.","isRequired":true,"uniqueKey":"items.[INDEX].choices.items.[INDEX].delta.graph_data.subqueries.items.[INDEX].oneOf.0.sources.items.[INDEX].oneOf.0.file_id","typeLabel":"string"},"snippet":{"type":"string","description":"The exact text snippet from the source document that was used to support the response.","isRequired":true,"uniqueKey":"items.[INDEX].choices.items.[INDEX].delta.graph_data.subqueries.items.[INDEX].oneOf.0.sources.items.[INDEX].oneOf.0.snippet","typeLabel":"string"}},"uniqueKey":"items.[INDEX].choices.items.[INDEX].delta.graph_data.subqueries.items.[INDEX].oneOf.0.sources.items.[INDEX].oneOf.0","typeLabel":"source · object"},{"title":"source","description":"A source snippet containing text and fileId from Knowledge Graph content.","required":["file_id","snippet"],"type":"null","properties":{"file_id":{"type":"string","description":"The unique identifier of the file in your Writer account."},"snippet":{"type":"string","description":"The exact text snippet from the source document that was used to support the response."}},"uniqueKey":"items.[INDEX].choices.items.[INDEX].delta.graph_data.subqueries.items.[INDEX].oneOf.0.sources.items.[INDEX].oneOf.1","typeLabel":"null"}],"uniqueKey":"items.[INDEX].choices.items.[INDEX].delta.graph_data.subqueries.items.[INDEX].oneOf.0.sources.items.[INDEX]","typeLabel":"source · object | null"},"isRequired":true,"uniqueKey":"items.[INDEX].choices.items.[INDEX].delta.graph_data.subqueries.items.[INDEX].oneOf.0.sources","typeLabel":"(source · object | null)[]"}},"uniqueKey":"items.[INDEX].choices.items.[INDEX].delta.graph_data.subqueries.items.[INDEX].oneOf.0","typeLabel":"sub_query · object"},{"title":"sub_query","description":"A sub-question generated to break down complex queries into more manageable parts, along with its answer and supporting sources.","required":["query","answer","sources"],"type":"null","properties":{"query":{"type":"string","description":"The subquery that was generated to help answer the main question."},"answer":{"type":"string","description":"The answer to the subquery based on Knowledge Graph content."},"sources":{"type":"array","description":"Array of source snippets that were used to answer this subquery.","items":{"oneOf":[{"title":"source","description":"A source snippet containing text and fileId from Knowledge Graph content.","required":["file_id","snippet"],"type":"object","properties":{"file_id":{"type":"string","description":"The unique identifier of the file in your Writer account."},"snippet":{"type":"string","description":"The exact text snippet from the source document that was used to support the response."}}},{"title":"source","description":"A source snippet containing text and fileId from Knowledge Graph content.","required":["file_id","snippet"],"type":"null","properties":{"file_id":{"type":"string","description":"The unique identifier of the file in your Writer account."},"snippet":{"type":"string","description":"The exact text snippet from the source document that was used to support the response."}}}]}}},"uniqueKey":"items.[INDEX].choices.items.[INDEX].delta.graph_data.subqueries.items.[INDEX].oneOf.1","typeLabel":"null"}],"uniqueKey":"items.[INDEX].choices.items.[INDEX].delta.graph_data.subqueries.items.[INDEX]","typeLabel":"sub_query · object | null"},"uniqueKey":"items.[INDEX].choices.items.[INDEX].delta.graph_data.subqueries","typeLabel":"(sub_query · object | null)[]"},"references":{"title":"references","description":"Detailed source information organized by reference type, providing comprehensive metadata about the sources used to generate the response.","type":"object","properties":{"files":{"type":"array","description":"Array of file-based references from uploaded documents in the Knowledge Graph.","items":{"title":"file","description":"A file-based reference containing text snippets from uploaded documents in the Knowledge Graph.","required":["text","fileId","score"],"type":"object","properties":{"text":{"type":"string","description":"The exact text snippet from the source document that was used to support the response.","isRequired":true,"uniqueKey":"items.[INDEX].choices.items.[INDEX].delta.graph_data.references.files.items.[INDEX].text","typeLabel":"string"},"fileId":{"type":"string","description":"The unique identifier of the file in your Writer account.","isRequired":true,"uniqueKey":"items.[INDEX].choices.items.[INDEX].delta.graph_data.references.files.items.[INDEX].fileId","typeLabel":"string"},"score":{"type":"number","description":"Internal score used during the retrieval process for ranking and selecting relevant snippets.","isRequired":true,"uniqueKey":"items.[INDEX].choices.items.[INDEX].delta.graph_data.references.files.items.[INDEX].score","typeLabel":"number"},"page":{"type":"integer","format":"int32","description":"Page number where this snippet was found in the source document.","uniqueKey":"items.[INDEX].choices.items.[INDEX].delta.graph_data.references.files.items.[INDEX].page","typeLabel":"integer\u003cint32>"},"cite":{"type":"string","description":"Unique citation ID that appears in inline citations within the response text (null if not cited).","uniqueKey":"items.[INDEX].choices.items.[INDEX].delta.graph_data.references.files.items.[INDEX].cite","typeLabel":"string"}},"uniqueKey":"items.[INDEX].choices.items.[INDEX].delta.graph_data.references.files.items.[INDEX]","typeLabel":"file · object"},"minItems":1,"uniqueKey":"items.[INDEX].choices.items.[INDEX].delta.graph_data.references.files","typeLabel":"file · object[]"},"web":{"type":"array","description":"Array of web-based references from online sources accessed during the query.","items":{"title":"web","description":"A web-based reference containing text snippets from online sources accessed during the query.","required":["text","url","title","score"],"type":"object","properties":{"text":{"type":"string","description":"The exact text snippet from the web source that was used to support the response.","isRequired":true,"uniqueKey":"items.[INDEX].choices.items.[INDEX].delta.graph_data.references.web.items.[INDEX].text","typeLabel":"string"},"url":{"type":"string","description":"The URL of the web page where this content was found.","format":"uri","isRequired":true,"uniqueKey":"items.[INDEX].choices.items.[INDEX].delta.graph_data.references.web.items.[INDEX].url","typeLabel":"string\u003curi>"},"title":{"type":"string","description":"The title of the web page where this content was found.","isRequired":true,"uniqueKey":"items.[INDEX].choices.items.[INDEX].delta.graph_data.references.web.items.[INDEX].title","typeLabel":"string"},"score":{"type":"number","description":"Internal score used during the retrieval process for ranking and selecting relevant snippets.","isRequired":true,"uniqueKey":"items.[INDEX].choices.items.[INDEX].delta.graph_data.references.web.items.[INDEX].score","typeLabel":"number"}},"uniqueKey":"items.[INDEX].choices.items.[INDEX].delta.graph_data.references.web.items.[INDEX]","typeLabel":"web · object"},"minItems":1,"uniqueKey":"items.[INDEX].choices.items.[INDEX].delta.graph_data.references.web","typeLabel":"web · object[]"}},"uniqueKey":"items.[INDEX].choices.items.[INDEX].delta.graph_data.references","typeLabel":"references · object"}},"uniqueKey":"items.[INDEX].choices.items.[INDEX].delta.graph_data","typeLabel":"graph_data · object"},"llm_data":{"oneOf":[{"title":"llm_data","required":["prompt","model"],"type":"object","properties":{"prompt":{"type":"string","description":"The prompt processed by the model.","isRequired":true,"uniqueKey":"items.[INDEX].choices.items.[INDEX].delta.llm_data.oneOf.0.prompt","typeLabel":"string"},"model":{"type":"string","description":"The model used by the tool.","isRequired":true,"uniqueKey":"items.[INDEX].choices.items.[INDEX].delta.llm_data.oneOf.0.model","typeLabel":"string"}},"uniqueKey":"items.[INDEX].choices.items.[INDEX].delta.llm_data.oneOf.0","typeLabel":"llm_data · object"},{"title":"llm_data","required":["prompt","model"],"type":"null","properties":{"prompt":{"type":"string","description":"The prompt processed by the model."},"model":{"type":"string","description":"The model used by the tool."}},"uniqueKey":"items.[INDEX].choices.items.[INDEX].delta.llm_data.oneOf.1","typeLabel":"null"}],"uniqueKey":"items.[INDEX].choices.items.[INDEX].delta.llm_data","typeLabel":"llm_data · object | null"},"translation_data":{"title":"translation_data","required":["source_text","source_language_code","target_language_code"],"type":"object","properties":{"source_text":{"type":"string","description":"The text the tool translated.","isRequired":true,"uniqueKey":"items.[INDEX].choices.items.[INDEX].delta.translation_data.source_text","typeLabel":"string"},"source_language_code":{"type":"string","description":"The language code of the source text.","isRequired":true,"uniqueKey":"items.[INDEX].choices.items.[INDEX].delta.translation_data.source_language_code","typeLabel":"string"},"target_language_code":{"type":"string","description":"The language code of the target text.","isRequired":true,"uniqueKey":"items.[INDEX].choices.items.[INDEX].delta.translation_data.target_language_code","typeLabel":"string"}},"uniqueKey":"items.[INDEX].choices.items.[INDEX].delta.translation_data","typeLabel":"translation_data · object"},"refusal":{"oneOf":[{"type":"string","uniqueKey":"items.[INDEX].choices.items.[INDEX].delta.refusal.oneOf.0","typeLabel":"string"},{"type":"null","uniqueKey":"items.[INDEX].choices.items.[INDEX].delta.refusal.oneOf.1","typeLabel":"null"}],"uniqueKey":"items.[INDEX].choices.items.[INDEX].delta.refusal","typeLabel":"string | null"}},"isRequired":true,"uniqueKey":"items.[INDEX].choices.items.[INDEX].delta","typeLabel":"object"},"message":{"required":["content","role","refusal"],"type":"object","description":"The chat completion message from the model. Note: this field is deprecated for streaming. Use `delta` instead.","properties":{"content":{"type":"string","description":"The text content produced by the model. This field contains the actual output generated, reflecting the model's response to the input query or command.","isRequired":true,"uniqueKey":"items.[INDEX].choices.items.[INDEX].message.content","typeLabel":"string"},"role":{"type":"string","enum":["assistant"],"description":"Specifies the role associated with the content.","isRequired":true,"uniqueKey":"items.[INDEX].choices.items.[INDEX].message.role","typeLabel":"enum\u003cstring>"},"refusal":{"oneOf":[{"type":"string","isRequired":true,"uniqueKey":"items.[INDEX].choices.items.[INDEX].message.refusal.oneOf.0","typeLabel":"string"},{"type":"null","isRequired":true,"uniqueKey":"items.[INDEX].choices.items.[INDEX].message.refusal.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"items.[INDEX].choices.items.[INDEX].message.refusal","typeLabel":"string | null"},"tool_calls":{"type":"array","items":{"title":"tool_call","type":"object","required":["id","type","function"],"properties":{"id":{"type":"string","isRequired":true,"uniqueKey":"items.[INDEX].choices.items.[INDEX].message.tool_calls.items.[INDEX].id","typeLabel":"string"},"type":{"type":"string","enum":["function"],"isRequired":true,"uniqueKey":"items.[INDEX].choices.items.[INDEX].message.tool_calls.items.[INDEX].type","typeLabel":"enum\u003cstring>"},"function":{"title":"function","type":"object","required":["name","arguments"],"properties":{"name":{"type":"string","isRequired":true,"uniqueKey":"items.[INDEX].choices.items.[INDEX].message.tool_calls.items.[INDEX].function.name","typeLabel":"string"},"arguments":{"type":"string","isRequired":true,"uniqueKey":"items.[INDEX].choices.items.[INDEX].message.tool_calls.items.[INDEX].function.arguments","typeLabel":"string"}},"isRequired":true,"uniqueKey":"items.[INDEX].choices.items.[INDEX].message.tool_calls.items.[INDEX].function","typeLabel":"function · object"},"index":{"type":"integer","format":"int32","uniqueKey":"items.[INDEX].choices.items.[INDEX].message.tool_calls.items.[INDEX].index","typeLabel":"integer\u003cint32>"}},"uniqueKey":"items.[INDEX].choices.items.[INDEX].message.tool_calls.items.[INDEX]","typeLabel":"tool_call · object"},"minItems":1,"uniqueKey":"items.[INDEX].choices.items.[INDEX].message.tool_calls","typeLabel":"tool_call · object[]"},"graph_data":{"title":"graph_data","type":"object","properties":{"sources":{"type":"array","items":{"oneOf":[{"title":"source","description":"A source snippet containing text and fileId from Knowledge Graph content.","required":["file_id","snippet"],"type":"object","properties":{"file_id":{"type":"string","description":"The unique identifier of the file in your Writer account.","isRequired":true,"uniqueKey":"items.[INDEX].choices.items.[INDEX].message.graph_data.sources.items.[INDEX].oneOf.0.file_id","typeLabel":"string"},"snippet":{"type":"string","description":"The exact text snippet from the source document that was used to support the response.","isRequired":true,"uniqueKey":"items.[INDEX].choices.items.[INDEX].message.graph_data.sources.items.[INDEX].oneOf.0.snippet","typeLabel":"string"}},"uniqueKey":"items.[INDEX].choices.items.[INDEX].message.graph_data.sources.items.[INDEX].oneOf.0","typeLabel":"source · object"},{"title":"source","description":"A source snippet containing text and fileId from Knowledge Graph content.","required":["file_id","snippet"],"type":"null","properties":{"file_id":{"type":"string","description":"The unique identifier of the file in your Writer account."},"snippet":{"type":"string","description":"The exact text snippet from the source document that was used to support the response."}},"uniqueKey":"items.[INDEX].choices.items.[INDEX].message.graph_data.sources.items.[INDEX].oneOf.1","typeLabel":"null"}],"uniqueKey":"items.[INDEX].choices.items.[INDEX].message.graph_data.sources.items.[INDEX]","typeLabel":"source · object | null"},"uniqueKey":"items.[INDEX].choices.items.[INDEX].message.graph_data.sources","typeLabel":"(source · object | null)[]"},"status":{"oneOf":[{"title":"graph_stage_status","type":"string","enum":["processing","finished"],"uniqueKey":"items.[INDEX].choices.items.[INDEX].message.graph_data.status.oneOf.0","typeLabel":"enum\u003cstring>"},{"title":"graph_stage_status","type":"null","enum":["processing","finished"],"uniqueKey":"items.[INDEX].choices.items.[INDEX].message.graph_data.status.oneOf.1","typeLabel":"null"}],"uniqueKey":"items.[INDEX].choices.items.[INDEX].message.graph_data.status","typeLabel":"enum\u003cstring> | null"},"subqueries":{"type":"array","items":{"oneOf":[{"title":"sub_query","description":"A sub-question generated to break down complex queries into more manageable parts, along with its answer and supporting sources.","required":["query","answer","sources"],"type":"object","properties":{"query":{"type":"string","description":"The subquery that was generated to help answer the main question.","isRequired":true,"uniqueKey":"items.[INDEX].choices.items.[INDEX].message.graph_data.subqueries.items.[INDEX].oneOf.0.query","typeLabel":"string"},"answer":{"type":"string","description":"The answer to the subquery based on Knowledge Graph content.","isRequired":true,"uniqueKey":"items.[INDEX].choices.items.[INDEX].message.graph_data.subqueries.items.[INDEX].oneOf.0.answer","typeLabel":"string"},"sources":{"type":"array","description":"Array of source snippets that were used to answer this subquery.","items":{"oneOf":[{"title":"source","description":"A source snippet containing text and fileId from Knowledge Graph content.","required":["file_id","snippet"],"type":"object","properties":{"file_id":{"type":"string","description":"The unique identifier of the file in your Writer account.","isRequired":true,"uniqueKey":"items.[INDEX].choices.items.[INDEX].message.graph_data.subqueries.items.[INDEX].oneOf.0.sources.items.[INDEX].oneOf.0.file_id","typeLabel":"string"},"snippet":{"type":"string","description":"The exact text snippet from the source document that was used to support the response.","isRequired":true,"uniqueKey":"items.[INDEX].choices.items.[INDEX].message.graph_data.subqueries.items.[INDEX].oneOf.0.sources.items.[INDEX].oneOf.0.snippet","typeLabel":"string"}},"uniqueKey":"items.[INDEX].choices.items.[INDEX].message.graph_data.subqueries.items.[INDEX].oneOf.0.sources.items.[INDEX].oneOf.0","typeLabel":"source · object"},{"title":"source","description":"A source snippet containing text and fileId from Knowledge Graph content.","required":["file_id","snippet"],"type":"null","properties":{"file_id":{"type":"string","description":"The unique identifier of the file in your Writer account."},"snippet":{"type":"string","description":"The exact text snippet from the source document that was used to support the response."}},"uniqueKey":"items.[INDEX].choices.items.[INDEX].message.graph_data.subqueries.items.[INDEX].oneOf.0.sources.items.[INDEX].oneOf.1","typeLabel":"null"}],"uniqueKey":"items.[INDEX].choices.items.[INDEX].message.graph_data.subqueries.items.[INDEX].oneOf.0.sources.items.[INDEX]","typeLabel":"source · object | null"},"isRequired":true,"uniqueKey":"items.[INDEX].choices.items.[INDEX].message.graph_data.subqueries.items.[INDEX].oneOf.0.sources","typeLabel":"(source · object | null)[]"}},"uniqueKey":"items.[INDEX].choices.items.[INDEX].message.graph_data.subqueries.items.[INDEX].oneOf.0","typeLabel":"sub_query · object"},{"title":"sub_query","description":"A sub-question generated to break down complex queries into more manageable parts, along with its answer and supporting sources.","required":["query","answer","sources"],"type":"null","properties":{"query":{"type":"string","description":"The subquery that was generated to help answer the main question."},"answer":{"type":"string","description":"The answer to the subquery based on Knowledge Graph content."},"sources":{"type":"array","description":"Array of source snippets that were used to answer this subquery.","items":{"oneOf":[{"title":"source","description":"A source snippet containing text and fileId from Knowledge Graph content.","required":["file_id","snippet"],"type":"object","properties":{"file_id":{"type":"string","description":"The unique identifier of the file in your Writer account."},"snippet":{"type":"string","description":"The exact text snippet from the source document that was used to support the response."}}},{"title":"source","description":"A source snippet containing text and fileId from Knowledge Graph content.","required":["file_id","snippet"],"type":"null","properties":{"file_id":{"type":"string","description":"The unique identifier of the file in your Writer account."},"snippet":{"type":"string","description":"The exact text snippet from the source document that was used to support the response."}}}]}}},"uniqueKey":"items.[INDEX].choices.items.[INDEX].message.graph_data.subqueries.items.[INDEX].oneOf.1","typeLabel":"null"}],"uniqueKey":"items.[INDEX].choices.items.[INDEX].message.graph_data.subqueries.items.[INDEX]","typeLabel":"sub_query · object | null"},"uniqueKey":"items.[INDEX].choices.items.[INDEX].message.graph_data.subqueries","typeLabel":"(sub_query · object | null)[]"},"references":{"title":"references","description":"Detailed source information organized by reference type, providing comprehensive metadata about the sources used to generate the response.","type":"object","properties":{"files":{"type":"array","description":"Array of file-based references from uploaded documents in the Knowledge Graph.","items":{"title":"file","description":"A file-based reference containing text snippets from uploaded documents in the Knowledge Graph.","required":["text","fileId","score"],"type":"object","properties":{"text":{"type":"string","description":"The exact text snippet from the source document that was used to support the response.","isRequired":true,"uniqueKey":"items.[INDEX].choices.items.[INDEX].message.graph_data.references.files.items.[INDEX].text","typeLabel":"string"},"fileId":{"type":"string","description":"The unique identifier of the file in your Writer account.","isRequired":true,"uniqueKey":"items.[INDEX].choices.items.[INDEX].message.graph_data.references.files.items.[INDEX].fileId","typeLabel":"string"},"score":{"type":"number","description":"Internal score used during the retrieval process for ranking and selecting relevant snippets.","isRequired":true,"uniqueKey":"items.[INDEX].choices.items.[INDEX].message.graph_data.references.files.items.[INDEX].score","typeLabel":"number"},"page":{"type":"integer","format":"int32","description":"Page number where this snippet was found in the source document.","uniqueKey":"items.[INDEX].choices.items.[INDEX].message.graph_data.references.files.items.[INDEX].page","typeLabel":"integer\u003cint32>"},"cite":{"type":"string","description":"Unique citation ID that appears in inline citations within the response text (null if not cited).","uniqueKey":"items.[INDEX].choices.items.[INDEX].message.graph_data.references.files.items.[INDEX].cite","typeLabel":"string"}},"uniqueKey":"items.[INDEX].choices.items.[INDEX].message.graph_data.references.files.items.[INDEX]","typeLabel":"file · object"},"minItems":1,"uniqueKey":"items.[INDEX].choices.items.[INDEX].message.graph_data.references.files","typeLabel":"file · object[]"},"web":{"type":"array","description":"Array of web-based references from online sources accessed during the query.","items":{"title":"web","description":"A web-based reference containing text snippets from online sources accessed during the query.","required":["text","url","title","score"],"type":"object","properties":{"text":{"type":"string","description":"The exact text snippet from the web source that was used to support the response.","isRequired":true,"uniqueKey":"items.[INDEX].choices.items.[INDEX].message.graph_data.references.web.items.[INDEX].text","typeLabel":"string"},"url":{"type":"string","description":"The URL of the web page where this content was found.","format":"uri","isRequired":true,"uniqueKey":"items.[INDEX].choices.items.[INDEX].message.graph_data.references.web.items.[INDEX].url","typeLabel":"string\u003curi>"},"title":{"type":"string","description":"The title of the web page where this content was found.","isRequired":true,"uniqueKey":"items.[INDEX].choices.items.[INDEX].message.graph_data.references.web.items.[INDEX].title","typeLabel":"string"},"score":{"type":"number","description":"Internal score used during the retrieval process for ranking and selecting relevant snippets.","isRequired":true,"uniqueKey":"items.[INDEX].choices.items.[INDEX].message.graph_data.references.web.items.[INDEX].score","typeLabel":"number"}},"uniqueKey":"items.[INDEX].choices.items.[INDEX].message.graph_data.references.web.items.[INDEX]","typeLabel":"web · object"},"minItems":1,"uniqueKey":"items.[INDEX].choices.items.[INDEX].message.graph_data.references.web","typeLabel":"web · object[]"}},"uniqueKey":"items.[INDEX].choices.items.[INDEX].message.graph_data.references","typeLabel":"references · object"}},"uniqueKey":"items.[INDEX].choices.items.[INDEX].message.graph_data","typeLabel":"graph_data · object"},"llm_data":{"oneOf":[{"title":"llm_data","required":["prompt","model"],"type":"object","properties":{"prompt":{"type":"string","description":"The prompt processed by the model.","isRequired":true,"uniqueKey":"items.[INDEX].choices.items.[INDEX].message.llm_data.oneOf.0.prompt","typeLabel":"string"},"model":{"type":"string","description":"The model used by the tool.","isRequired":true,"uniqueKey":"items.[INDEX].choices.items.[INDEX].message.llm_data.oneOf.0.model","typeLabel":"string"}},"uniqueKey":"items.[INDEX].choices.items.[INDEX].message.llm_data.oneOf.0","typeLabel":"llm_data · object"},{"title":"llm_data","required":["prompt","model"],"type":"null","properties":{"prompt":{"type":"string","description":"The prompt processed by the model."},"model":{"type":"string","description":"The model used by the tool."}},"uniqueKey":"items.[INDEX].choices.items.[INDEX].message.llm_data.oneOf.1","typeLabel":"null"}],"uniqueKey":"items.[INDEX].choices.items.[INDEX].message.llm_data","typeLabel":"llm_data · object | null"},"translation_data":{"title":"translation_data","required":["source_text","source_language_code","target_language_code"],"type":"object","properties":{"source_text":{"type":"string","description":"The text the tool translated.","isRequired":true,"uniqueKey":"items.[INDEX].choices.items.[INDEX].message.translation_data.source_text","typeLabel":"string"},"source_language_code":{"type":"string","description":"The language code of the source text.","isRequired":true,"uniqueKey":"items.[INDEX].choices.items.[INDEX].message.translation_data.source_language_code","typeLabel":"string"},"target_language_code":{"type":"string","description":"The language code of the target text.","isRequired":true,"uniqueKey":"items.[INDEX].choices.items.[INDEX].message.translation_data.target_language_code","typeLabel":"string"}},"uniqueKey":"items.[INDEX].choices.items.[INDEX].message.translation_data","typeLabel":"translation_data · object"},"web_search_data":{"title":"web_search_data","required":["sources"],"type":"object","properties":{"sources":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string","uniqueKey":"items.[INDEX].choices.items.[INDEX].message.web_search_data.sources.items.[INDEX].url","typeLabel":"string"},"raw_content":{"type":"string","uniqueKey":"items.[INDEX].choices.items.[INDEX].message.web_search_data.sources.items.[INDEX].raw_content","typeLabel":"string"}},"uniqueKey":"items.[INDEX].choices.items.[INDEX].message.web_search_data.sources.items.[INDEX]","typeLabel":"object"},"isRequired":true,"uniqueKey":"items.[INDEX].choices.items.[INDEX].message.web_search_data.sources","typeLabel":"object[]"}},"uniqueKey":"items.[INDEX].choices.items.[INDEX].message.web_search_data","typeLabel":"web_search_data · object"}},"uniqueKey":"items.[INDEX].choices.items.[INDEX].message","typeLabel":"object"},"logprobs":{"oneOf":[{"type":"object","required":["content","refusal"],"properties":{"content":{"oneOf":[{"type":"array","items":{"title":"logprobs_token","required":["token","logprob","top_logprobs"],"type":"object","properties":{"token":{"type":"string","isRequired":true,"uniqueKey":"items.[INDEX].choices.items.[INDEX].logprobs.oneOf.0.content.oneOf.0.items.[INDEX].token","typeLabel":"string"},"logprob":{"type":"number","format":"double","isRequired":true,"uniqueKey":"items.[INDEX].choices.items.[INDEX].logprobs.oneOf.0.content.oneOf.0.items.[INDEX].logprob","typeLabel":"number\u003cdouble>"},"top_logprobs":{"type":"array","items":{"title":"top_log_prob","description":"An array of mappings for each token to its top log probabilities, showing detailed prediction probabilities.","required":["token","logprob"],"type":"object","properties":{"token":{"type":"string","isRequired":true,"uniqueKey":"items.[INDEX].choices.items.[INDEX].logprobs.oneOf.0.content.oneOf.0.items.[INDEX].top_logprobs.items.[INDEX].token","typeLabel":"string"},"logprob":{"type":"number","format":"double","isRequired":true,"uniqueKey":"items.[INDEX].choices.items.[INDEX].logprobs.oneOf.0.content.oneOf.0.items.[INDEX].top_logprobs.items.[INDEX].logprob","typeLabel":"number\u003cdouble>"},"bytes":{"type":"array","items":{"type":"integer","format":"int32","uniqueKey":"items.[INDEX].choices.items.[INDEX].logprobs.oneOf.0.content.oneOf.0.items.[INDEX].top_logprobs.items.[INDEX].bytes.items.[INDEX]","typeLabel":"integer\u003cint32>"},"uniqueKey":"items.[INDEX].choices.items.[INDEX].logprobs.oneOf.0.content.oneOf.0.items.[INDEX].top_logprobs.items.[INDEX].bytes","typeLabel":"integer\u003cint32>[]"}},"uniqueKey":"items.[INDEX].choices.items.[INDEX].logprobs.oneOf.0.content.oneOf.0.items.[INDEX].top_logprobs.items.[INDEX]","typeLabel":"top_log_prob · object"},"isRequired":true,"uniqueKey":"items.[INDEX].choices.items.[INDEX].logprobs.oneOf.0.content.oneOf.0.items.[INDEX].top_logprobs","typeLabel":"top_log_prob · object[]"},"bytes":{"type":"array","items":{"type":"integer","format":"int32","uniqueKey":"items.[INDEX].choices.items.[INDEX].logprobs.oneOf.0.content.oneOf.0.items.[INDEX].bytes.items.[INDEX]","typeLabel":"integer\u003cint32>"},"uniqueKey":"items.[INDEX].choices.items.[INDEX].logprobs.oneOf.0.content.oneOf.0.items.[INDEX].bytes","typeLabel":"integer\u003cint32>[]"}},"uniqueKey":"items.[INDEX].choices.items.[INDEX].logprobs.oneOf.0.content.oneOf.0.items.[INDEX]","typeLabel":"logprobs_token · object"},"isRequired":true,"uniqueKey":"items.[INDEX].choices.items.[INDEX].logprobs.oneOf.0.content.oneOf.0","typeLabel":"logprobs_token · object[]"},{"type":"null","items":{"title":"logprobs_token","required":["token","logprob","top_logprobs"],"type":"object","properties":{"token":{"type":"string"},"logprob":{"type":"number","format":"double"},"bytes":{"type":"array","items":{"type":"integer","format":"int32"}},"top_logprobs":{"type":"array","items":{"title":"top_log_prob","description":"An array of mappings for each token to its top log probabilities, showing detailed prediction probabilities.","required":["token","logprob"],"type":"object","properties":{"token":{"type":"string"},"logprob":{"type":"number","format":"double"},"bytes":{"type":"array","items":{"type":"integer","format":"int32"}}}}}}},"isRequired":true,"uniqueKey":"items.[INDEX].choices.items.[INDEX].logprobs.oneOf.0.content.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"items.[INDEX].choices.items.[INDEX].logprobs.oneOf.0.content","typeLabel":"logprobs_token · object[] | null"},"refusal":{"oneOf":[{"type":"array","items":{"title":"logprobs_token","required":["token","logprob","top_logprobs"],"type":"object","properties":{"token":{"type":"string","isRequired":true,"uniqueKey":"items.[INDEX].choices.items.[INDEX].logprobs.oneOf.0.refusal.oneOf.0.items.[INDEX].token","typeLabel":"string"},"logprob":{"type":"number","format":"double","isRequired":true,"uniqueKey":"items.[INDEX].choices.items.[INDEX].logprobs.oneOf.0.refusal.oneOf.0.items.[INDEX].logprob","typeLabel":"number\u003cdouble>"},"top_logprobs":{"type":"array","items":{"title":"top_log_prob","description":"An array of mappings for each token to its top log probabilities, showing detailed prediction probabilities.","required":["token","logprob"],"type":"object","properties":{"token":{"type":"string","isRequired":true,"uniqueKey":"items.[INDEX].choices.items.[INDEX].logprobs.oneOf.0.refusal.oneOf.0.items.[INDEX].top_logprobs.items.[INDEX].token","typeLabel":"string"},"logprob":{"type":"number","format":"double","isRequired":true,"uniqueKey":"items.[INDEX].choices.items.[INDEX].logprobs.oneOf.0.refusal.oneOf.0.items.[INDEX].top_logprobs.items.[INDEX].logprob","typeLabel":"number\u003cdouble>"},"bytes":{"type":"array","items":{"type":"integer","format":"int32","uniqueKey":"items.[INDEX].choices.items.[INDEX].logprobs.oneOf.0.refusal.oneOf.0.items.[INDEX].top_logprobs.items.[INDEX].bytes.items.[INDEX]","typeLabel":"integer\u003cint32>"},"uniqueKey":"items.[INDEX].choices.items.[INDEX].logprobs.oneOf.0.refusal.oneOf.0.items.[INDEX].top_logprobs.items.[INDEX].bytes","typeLabel":"integer\u003cint32>[]"}},"uniqueKey":"items.[INDEX].choices.items.[INDEX].logprobs.oneOf.0.refusal.oneOf.0.items.[INDEX].top_logprobs.items.[INDEX]","typeLabel":"top_log_prob · object"},"isRequired":true,"uniqueKey":"items.[INDEX].choices.items.[INDEX].logprobs.oneOf.0.refusal.oneOf.0.items.[INDEX].top_logprobs","typeLabel":"top_log_prob · object[]"},"bytes":{"type":"array","items":{"type":"integer","format":"int32","uniqueKey":"items.[INDEX].choices.items.[INDEX].logprobs.oneOf.0.refusal.oneOf.0.items.[INDEX].bytes.items.[INDEX]","typeLabel":"integer\u003cint32>"},"uniqueKey":"items.[INDEX].choices.items.[INDEX].logprobs.oneOf.0.refusal.oneOf.0.items.[INDEX].bytes","typeLabel":"integer\u003cint32>[]"}},"uniqueKey":"items.[INDEX].choices.items.[INDEX].logprobs.oneOf.0.refusal.oneOf.0.items.[INDEX]","typeLabel":"logprobs_token · object"},"isRequired":true,"uniqueKey":"items.[INDEX].choices.items.[INDEX].logprobs.oneOf.0.refusal.oneOf.0","typeLabel":"logprobs_token · object[]"},{"type":"null","items":{"title":"logprobs_token","required":["token","logprob","top_logprobs"],"type":"object","properties":{"token":{"type":"string"},"logprob":{"type":"number","format":"double"},"bytes":{"type":"array","items":{"type":"integer","format":"int32"}},"top_logprobs":{"type":"array","items":{"title":"top_log_prob","description":"An array of mappings for each token to its top log probabilities, showing detailed prediction probabilities.","required":["token","logprob"],"type":"object","properties":{"token":{"type":"string"},"logprob":{"type":"number","format":"double"},"bytes":{"type":"array","items":{"type":"integer","format":"int32"}}}}}}},"isRequired":true,"uniqueKey":"items.[INDEX].choices.items.[INDEX].logprobs.oneOf.0.refusal.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"items.[INDEX].choices.items.[INDEX].logprobs.oneOf.0.refusal","typeLabel":"logprobs_token · object[] | null"}},"description":"Log probability information for the choice.","uniqueKey":"items.[INDEX].choices.items.[INDEX].logprobs.oneOf.0","typeLabel":"object"},{"type":"null","required":["content","refusal"],"properties":{"content":{"oneOf":[{"type":"array","items":{"title":"logprobs_token","required":["token","logprob","top_logprobs"],"type":"object","properties":{"token":{"type":"string"},"logprob":{"type":"number","format":"double"},"bytes":{"type":"array","items":{"type":"integer","format":"int32"}},"top_logprobs":{"type":"array","items":{"title":"top_log_prob","description":"An array of mappings for each token to its top log probabilities, showing detailed prediction probabilities.","required":["token","logprob"],"type":"object","properties":{"token":{"type":"string"},"logprob":{"type":"number","format":"double"},"bytes":{"type":"array","items":{"type":"integer","format":"int32"}}}}}}}},{"type":"null","items":{"title":"logprobs_token","required":["token","logprob","top_logprobs"],"type":"object","properties":{"token":{"type":"string"},"logprob":{"type":"number","format":"double"},"bytes":{"type":"array","items":{"type":"integer","format":"int32"}},"top_logprobs":{"type":"array","items":{"title":"top_log_prob","description":"An array of mappings for each token to its top log probabilities, showing detailed prediction probabilities.","required":["token","logprob"],"type":"object","properties":{"token":{"type":"string"},"logprob":{"type":"number","format":"double"},"bytes":{"type":"array","items":{"type":"integer","format":"int32"}}}}}}}}]},"refusal":{"oneOf":[{"type":"array","items":{"title":"logprobs_token","required":["token","logprob","top_logprobs"],"type":"object","properties":{"token":{"type":"string"},"logprob":{"type":"number","format":"double"},"bytes":{"type":"array","items":{"type":"integer","format":"int32"}},"top_logprobs":{"type":"array","items":{"title":"top_log_prob","description":"An array of mappings for each token to its top log probabilities, showing detailed prediction probabilities.","required":["token","logprob"],"type":"object","properties":{"token":{"type":"string"},"logprob":{"type":"number","format":"double"},"bytes":{"type":"array","items":{"type":"integer","format":"int32"}}}}}}}},{"type":"null","items":{"title":"logprobs_token","required":["token","logprob","top_logprobs"],"type":"object","properties":{"token":{"type":"string"},"logprob":{"type":"number","format":"double"},"bytes":{"type":"array","items":{"type":"integer","format":"int32"}},"top_logprobs":{"type":"array","items":{"title":"top_log_prob","description":"An array of mappings for each token to its top log probabilities, showing detailed prediction probabilities.","required":["token","logprob"],"type":"object","properties":{"token":{"type":"string"},"logprob":{"type":"number","format":"double"},"bytes":{"type":"array","items":{"type":"integer","format":"int32"}}}}}}}}]}},"description":"Log probability information for the choice.","uniqueKey":"items.[INDEX].choices.items.[INDEX].logprobs.oneOf.1","typeLabel":"null"}],"uniqueKey":"items.[INDEX].choices.items.[INDEX].logprobs","typeLabel":"object | null"}},"uniqueKey":"items.[INDEX].choices.items.[INDEX]","typeLabel":"object"},"minItems":1,"description":"An array of objects representing the different outcomes or results produced by the model based on the input provided.","isRequired":true,"uniqueKey":"items.[INDEX].choices","typeLabel":"object[]"},"created":{"type":"integer","format":"int64","description":"The Unix timestamp (in seconds) when the response was created. This timestamp can be used to verify the timing of the response relative to other events or operations.","isRequired":true,"uniqueKey":"items.[INDEX].created","typeLabel":"integer\u003cint64>"},"model":{"type":"string","description":"Identifies the specific model used to generate the response.","isRequired":true,"uniqueKey":"items.[INDEX].model","typeLabel":"string"},"usage":{"title":"chat_completion_usage","description":"Usage information for the chat completion response. Please note that at this time Knowledge Graph tool usage is not included in this object.","required":["prompt_tokens","total_tokens","completion_tokens"],"type":"object","properties":{"prompt_tokens":{"type":"integer","format":"int32","isRequired":true,"uniqueKey":"items.[INDEX].usage.prompt_tokens","typeLabel":"integer\u003cint32>"},"total_tokens":{"type":"integer","format":"int32","isRequired":true,"uniqueKey":"items.[INDEX].usage.total_tokens","typeLabel":"integer\u003cint32>"},"completion_tokens":{"type":"integer","format":"int32","isRequired":true,"uniqueKey":"items.[INDEX].usage.completion_tokens","typeLabel":"integer\u003cint32>"},"prompt_token_details":{"title":"prompt_token_details","required":["cached_tokens"],"type":"object","properties":{"cached_tokens":{"type":"integer","format":"int32","isRequired":true,"uniqueKey":"items.[INDEX].usage.prompt_token_details.cached_tokens","typeLabel":"integer\u003cint32>"}},"uniqueKey":"items.[INDEX].usage.prompt_token_details","typeLabel":"prompt_token_details · object"},"completion_tokens_details":{"title":"completion_token_details","required":["reasoning_tokens"],"type":"object","properties":{"reasoning_tokens":{"type":"integer","format":"int32","isRequired":true,"uniqueKey":"items.[INDEX].usage.completion_tokens_details.reasoning_tokens","typeLabel":"integer\u003cint32>"}},"uniqueKey":"items.[INDEX].usage.completion_tokens_details","typeLabel":"completion_token_details · object"}},"uniqueKey":"items.[INDEX].usage","typeLabel":"chat_completion_usage · object"},"system_fingerprint":{"type":"string","uniqueKey":"items.[INDEX].system_fingerprint","typeLabel":"string"},"service_tier":{"type":"string","uniqueKey":"items.[INDEX].service_tier","typeLabel":"string"}},"example":{"id":"3c90c3cc-0d44-4b50-8888-8dd25736052a","choices":[{"finish_reason":"stop","message":{"content":"Hello! How can I assist you today?","role":"user"}}],"created":1678587532773,"model":"palmyra-x5"},"uniqueKey":"items.[INDEX]","typeLabel":"object"},"uniqueKey":"","typeLabel":"object[]"},"examples":{"200":{"title":"200","value":{"id":"57e4f58f-f7b1-41d8-be17-a6279c073aad","object":"chat.completion","choices":[{"index":0,"finish_reason":"length","message":{"content":"The earnings report shows...","role":"assistant","tool_calls":[],"refusal":null,"graph_data":{"sources":[],"status":"finished","subqueries":[]},"llm_data":{"prompt":"Write a memo summarizing this earnings report.","model":"palmyra-x5"},"translation_data":null,"web_search_data":null},"delta":{"content":"The earnings report shows...","role":"assistant","tool_calls":[],"refusal":null,"graph_data":{"sources":[],"status":"finished","subqueries":[]},"llm_data":{"prompt":"Write a memo summarizing this earnings report.","model":"palmyra-x5"},"translation_data":null,"web_search_data":null}}],"created":1715361795,"model":"palmyra-x5","usage":{"prompt_tokens":40,"total_tokens":340,"completion_tokens":300,"prompt_token_details":{"cached_tokens":0},"completion_token_details":{"reasoning_tokens":0}},"system_fingerprint":"v1","service_tier":"standard"}}},"exampleType":"examples"}},"exampleType":"examples"}},"security":{"262a07cf-e2f3-4ecf-9add-3f0bd8874fc1":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Bearer authentication header of the form `Bearer \u003ctoken>`, where `\u003ctoken>` is your [Writer API key](https://dev.writer.com/api-reference/api-keys).","scopes":[]}}},"servers":{"b8cc5dfc-266d-497e-a683-385c75b5033f":{"url":"https://api.writer.com"}},"processedSecurityOptions":[{"schemes":[{"scheme":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Bearer authentication header of the form `Bearer \u003ctoken>`, where `\u003ctoken>` is your [Writer API key](https://dev.writer.com/api-reference/api-keys).","scopes":[]},"schema":{"title":"Bearer Auth","type":"string","isRequired":true,"description":"Bearer authentication header of the form `Bearer \u003ctoken>`, where `\u003ctoken>` is your [Writer API key](https://dev.writer.com/api-reference/api-keys).","format":"bearer","typeLabel":"string\u003cbearer>","deprecated":false},"schemeName":"bearerAuth","name":"Authorization"}],"title":"bearerAuth"}]},"originalFileLocation":"api-reference/gateway-api-schema.yaml"},"subdomain":"writer","siteName":"Writer AI Studio","title":"Chat completion - Writer AI Studio","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-09-14T22:47:43.844Z","originalFileLocation":"api-reference/completion-api/chat-completion.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Generate a chat completion based on the provided messages. The response shown below is for non-streaming. To learn about streaming responses, see the chat completion guide.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Writer AI Studio\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/writer/rBMYB50U__7D_mBT/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/writer/rBMYB50U__7D_mBT/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/writer/rBMYB50U__7D_mBT/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/writer/rBMYB50U__7D_mBT/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/writer/rBMYB50U__7D_mBT/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/writer/rBMYB50U__7D_mBT/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/writer/rBMYB50U__7D_mBT/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/writer/rBMYB50U__7D_mBT/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/writer/rBMYB50U__7D_mBT/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Chat completion - Writer AI Studio\">\u003cmeta data-mint-head property=\"og:description\" content=\"Generate a chat completion based on the provided messages. The response shown below is for non-streaming. To learn about streaming responses, see the chat completion guide.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Writer AI Studio Documentation\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://dev.writer.com/api-reference/completion-api/chat-completion\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://writer.mintlify.app/_mintlify/api/og/v2?division=Completions+API\u0026amp;title=Chat+completion\u0026amp;description=Generate+a+chat+completion+based+on+the+provided+messages.+The+response+shown+below+is+for+non-streaming.+To+learn+about+streaming+responses%2C+see+the+%5Bchat+comp\u0026amp;theme=9c7f3bd87cb846f8ead27220\u0026amp;signature=50b2184febb9c139e92a582c7016f6c76cd7f3232caaad374ddb856a801159d5\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Chat completion - Writer AI Studio\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Generate a chat completion based on the provided messages. The response shown below is for non-streaming. To learn about streaming responses, see the chat completion guide.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://writer.mintlify.app/_mintlify/api/og/v2?division=Completions+API\u0026amp;title=Chat+completion\u0026amp;description=Generate+a+chat+completion+based+on+the+provided+messages.+The+response+shown+below+is+for+non-streaming.+To+learn+about+streaming+responses%2C+see+the+%5Bchat+comp\u0026amp;theme=9c7f3bd87cb846f8ead27220\u0026amp;signature=50b2184febb9c139e92a582c7016f6c76cd7f3232caaad374ddb856a801159d5\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/writer/rBMYB50U__7D_mBT/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Writer AI Studio\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#BFCBFF\">\u003clink data-mint-head rel=\"canonical\" href=\"https://dev.writer.com/api-reference/completion-api/chat-completion\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/api-reference/completion-api/chat-completion.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://dev.writer.com/#organization\",\"name\":\"Writer AI Studio\",\"url\":\"https://dev.writer.com\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/writer/YZ72OUP7BQyK8p2G/logo/writer_logo_light.svg?fit=max\u0026auto=format\u0026n=YZ72OUP7BQyK8p2G\u0026q=85\u0026s=c9a784871f9b98724bb1eae947e745ed\"}},{\"@type\":\"WebSite\",\"@id\":\"https://dev.writer.com#website\",\"name\":\"Writer AI Studio\",\"url\":\"https://dev.writer.com\",\"publisher\":{\"@id\":\"https://dev.writer.com/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://dev.writer.com/api-reference/completion-api/chat-completion#webpage\",\"url\":\"https://dev.writer.com/api-reference/completion-api/chat-completion\",\"name\":\"Chat completion\",\"description\":\"Generate a chat completion based on the provided messages. The response shown below is for non-streaming. To learn about streaming responses, see the chat completion guide.\",\"dateModified\":\"2026-09-14T22:47:43.844Z\",\"isPartOf\":{\"@id\":\"https://dev.writer.com#website\"},\"breadcrumb\":{\"@id\":\"https://dev.writer.com/api-reference/completion-api/chat-completion#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://dev.writer.com/api-reference/completion-api/chat-completion#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Completions API\",\"item\":\"https://dev.writer.com/api-reference/completion-api/list-models\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Chat completion\",\"item\":\"https://dev.writer.com/api-reference/completion-api/chat-completion\"}]},{\"@type\":[\"TechArticle\",\"APIReference\"],\"@id\":\"https://dev.writer.com/api-reference/completion-api/chat-completion#apireference\",\"headline\":\"Chat completion\",\"name\":\"Chat completion\",\"description\":\"Generate a chat completion based on the provided messages. The response shown below is for non-streaming. To learn about streaming responses, see the chat completion guide.\",\"url\":\"https://dev.writer.com/api-reference/completion-api/chat-completion\",\"mainEntityOfPage\":{\"@id\":\"https://dev.writer.com/api-reference/completion-api/chat-completion#webpage\"},\"dateModified\":\"2026-09-14T22:47:43.844Z\",\"publisher\":{\"@id\":\"https://dev.writer.com/#organization\"},\"isPartOf\":{\"@id\":\"https://dev.writer.com#website\"}}]}\u003c/script>","siteName":"Writer AI Studio","nav":{"global":null,"tabs":[{"tab":"Home","icon":"house","pages":[{"title":"Home","href":"/home/introduction"}]},{"tab":"Writer Framework","icon":"shapes","hidden":true,"pages":[{"title":"Writer Framework","href":"/framework/introduction"}]},{"tab":"API Reference","icon":"key","groups":[{"group":"General usage","pages":[{"title":"Manage API keys","sidebarTitle":"API Keys","href":"/api-reference/api-keys"},{"title":"Understand error codes","sidebarTitle":"Error codes","href":"/api-reference/error-codes"},{"title":"Understand rate limits","sidebarTitle":"Rate limits","href":"/api-reference/rate-limits"},{"title":"Paginate API results","sidebarTitle":"Pagination","href":"/api-reference/pagination"},{"title":"Secure your integration","sidebarTitle":"Integration security guide","href":"/api-reference/security"}]},{"group":"Applications API","pages":[{"openapi":"post /v1/applications/{application_id}","title":"Generate from application","href":"/api-reference/application-api/applications"},{"openapi":"get /v1/applications","title":"List applications","href":"/api-reference/application-api/list-applications"},{"openapi":"get /v1/applications/{application_id}","title":"Application details","href":"/api-reference/application-api/application-details"},{"openapi":"post /v1/applications/{application_id}/jobs","title":"Generate from application (async)","href":"/api-reference/application-api/generate-application-job"},{"openapi":"get /v1/applications/{application_id}/jobs","title":"Retrieve all jobs","href":"/api-reference/application-api/application-jobs"},{"openapi":"get /v1/applications/jobs/{job_id}","title":"Retrieve a single job","href":"/api-reference/application-api/get-single-async-job"},{"openapi":"post /v1/applications/jobs/{job_id}/retry","title":"Retry job execution","href":"/api-reference/application-api/post-retry-async-job"},{"openapi":"get /v1/applications/{application_id}/graphs","title":"Retrieve graphs","href":"/api-reference/application-api/get-application-graphs"},{"openapi":"put /v1/applications/{application_id}/graphs","title":"Associate graphs","href":"/api-reference/application-api/put-application-graphs"}]},{"group":"Completions API","pages":[{"openapi":"get /v1/models","title":"List models","href":"/api-reference/completion-api/list-models"},{"openapi":"post /v1/completions","title":"Text generation","description":"Generate text completions using the specified model and prompt. This endpoint is useful for text generation tasks that don't require conversational context.","href":"/api-reference/completion-api/text-generation"},{"openapi":"post /v1/chat","title":"Chat completion","href":"/api-reference/completion-api/chat-completion"}]},{"group":"Files API","pages":[{"openapi":"post /v1/files","title":"Upload file","description":"Upload a new file to the system. Supports various file formats including PDF, DOC, DOCX, PPT, PPTX, JPG, PNG, EML, HTML, SRT, CSV, XLS, and XLSX.\n\nFile uploads do not accept team parameters. When you attach a file to a Knowledge Graph, the file inherits the team scope of that Knowledge Graph.","href":"/api-reference/file-api/upload-files"},{"openapi":"get /v1/files/{file_id}","title":"Retrieve file","href":"/api-reference/file-api/get-file"},{"openapi":"get /v1/files","title":"List files","href":"/api-reference/file-api/get-all-files"},{"openapi":"get /v1/files/{file_id}/download","title":"Download file","href":"/api-reference/file-api/download-file"},{"openapi":"delete /v1/files/{file_id}","title":"Delete file","href":"/api-reference/file-api/delete-file"},{"openapi":"post /v1/files/retry","title":"Retry failed files","href":"/api-reference/file-api/files-retry"}]},{"group":"Knowledge Graphs API","pages":[{"openapi":"post /v1/graphs","title":"Create graph","href":"/api-reference/kg-api/create-graph"},{"openapi":"get /v1/graphs","title":"List graphs","href":"/api-reference/kg-api/list-graphs"},{"openapi":"get /v1/graphs/{graph_id}","title":"Retrieve graph","href":"/api-reference/kg-api/retrieve-graph"},{"openapi":"put /v1/graphs/{graph_id}","title":"Update graph","href":"/api-reference/kg-api/update-graph"},{"openapi":"delete /v1/graphs/{graph_id}","title":"Delete graph","href":"/api-reference/kg-api/delete-graph"},{"openapi":"post /v1/graphs/{graph_id}/file","title":"Add file to graph","href":"/api-reference/kg-api/add-file-to-graph"},{"openapi":"delete /v1/graphs/{graph_id}/file/{file_id}","title":"Remove file from graph","href":"/api-reference/kg-api/remove-file-from-graph"},{"openapi":"post /v1/graphs/question","title":"Question","href":"/api-reference/kg-api/question"}]},{"group":"Tools API","pages":[{"openapi":"post /v1/tools/pdf-parser/{file_id}","title":"Parse PDF","href":"/api-reference/tool-api/pdf-parser"},{"openapi":"post /v1/tools/web-search","title":"Web search","href":"/api-reference/tool-api/web-search"}]},{"group":"Translation","pages":[{"title":"View supported languages","sidebarTitle":"Language support","href":"/api-reference/translation-api/language-support"}]},{"group":"Migration guides","pages":[{"title":"Migrate from web search API to web search tool","href":"/api-reference/migration-guides/web-search"}]}]},{"tab":"Legacy API Reference","hidden":true,"pages":[{"title":"Legacy API Reference","href":"/api-reference-legacy/billing/get-your-organization-subscription-details"}]}]},"title":"Chat completion - Writer AI Studio","buildId":"dpl_2oYXwqkEXirXBPk8wV1FtM5USFWi","deploymentId":"dpl_2oYXwqkEXirXBPk8wV1FtM5USFWi","dynamics":["c2aa737661","2b790eda92","b0f84f53ff","a9bb46feb3"],"chunks":["OpenApiReferenceProvider-WRhTSUDL.js","utils-ChMov4Kr.js","cloneDeep-izs3Hzxb.js","_Uint8Array-BVIqJ90l.js","isObjectLike-C8vmzPEN.js","isArray-Dcu1dQ5t.js","utils-_REmC2bI.js","toString-BX-iyh8G.js","isSymbol-CSH9U2Gm.js","addUniqueKeysToSchema-Bp6nVRCu.js","snippetPresets-DZadmXoU.js","style-to-object-BY3JEAdk.js","v4-DIgz8zy6.js","ApiExamples-CY2WdoTl.js","isEqual-BfaiBbcl.js","usePlaygroundInputsStore-DwYG-Q4l.js","shallow-BXQIGwv4.js","getApiPlaygroundDisplay-CK5nK5B9.js","CodeSnippet-TH4a2aGW.js","CodeSnippets-DwsQiOFS.js","Page-R3M_BF4L.js","getPastedJson-DD7kUzi_.js","icon-holE3QoJ.js","MethodPill-DUW0T8us.js","DuplicateIcon-CI_p4be-.js","createIcon-BdbRvavb.js","DynamicMarkdown-DN96a4Ur.js","SectionHeading-SCu36A9d.js","axios-vUo_bRtp.js","Markdown-CCeGv-zI.js","clsx-BGBGWFTt.js","lib--scc4DXi.js","lib-B8HbPgcC.js","html-void-elements-mCSPHezU.js","dist-Cv_O2fky.js","katex-YMM-FMeD.js","marked.esm-CZWythHk.js","AssistantPageLink-2C5OB2eV.js"]}