48 lines
986 B
Plaintext
48 lines
986 B
Plaintext
// This file is autogenerated, DO NOT EDIT
|
|
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
|
|
|
[source, js]
|
|
----
|
|
const response = await client.transport.request({
|
|
method: "POST",
|
|
path: "/_inference/chat_completion/openai-completion/_stream",
|
|
body: {
|
|
messages: [
|
|
{
|
|
role: "user",
|
|
content: [
|
|
{
|
|
type: "text",
|
|
text: "What's the price of a scarf?",
|
|
},
|
|
],
|
|
},
|
|
],
|
|
tools: [
|
|
{
|
|
type: "function",
|
|
function: {
|
|
name: "get_current_price",
|
|
description: "Get the current price of a item",
|
|
parameters: {
|
|
type: "object",
|
|
properties: {
|
|
item: {
|
|
id: "123",
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
],
|
|
tool_choice: {
|
|
type: "function",
|
|
function: {
|
|
name: "get_current_price",
|
|
},
|
|
},
|
|
},
|
|
});
|
|
console.log(response);
|
|
----
|