mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-08-28 05:27:24 +00:00
Merge pull request #1414 from websentry-ai/pm/add-unbound-metadata
Adds Unbound metadata for non-streaming requests
This commit is contained in:
commit
c9e21eb091
2 changed files with 22 additions and 1 deletions
|
|
@ -192,6 +192,11 @@ describe("UnboundHandler", () => {
|
|||
temperature: 0,
|
||||
max_tokens: 8192,
|
||||
}),
|
||||
expect.objectContaining({
|
||||
headers: expect.objectContaining({
|
||||
"X-Unbound-Metadata": expect.stringContaining("roo-code"),
|
||||
}),
|
||||
}),
|
||||
)
|
||||
})
|
||||
|
||||
|
|
@ -233,6 +238,11 @@ describe("UnboundHandler", () => {
|
|||
messages: [{ role: "user", content: "Test prompt" }],
|
||||
temperature: 0,
|
||||
}),
|
||||
expect.objectContaining({
|
||||
headers: expect.objectContaining({
|
||||
"X-Unbound-Metadata": expect.stringContaining("roo-code"),
|
||||
}),
|
||||
}),
|
||||
)
|
||||
expect(mockCreate.mock.calls[0][0]).not.toHaveProperty("max_tokens")
|
||||
})
|
||||
|
|
|
|||
|
|
@ -157,7 +157,18 @@ export class UnboundHandler extends BaseProvider implements SingleCompletionHand
|
|||
requestOptions.max_tokens = this.getModel().info.maxTokens
|
||||
}
|
||||
|
||||
const response = await this.client.chat.completions.create(requestOptions)
|
||||
const response = await this.client.chat.completions.create(requestOptions, {
|
||||
headers: {
|
||||
"X-Unbound-Metadata": JSON.stringify({
|
||||
labels: [
|
||||
{
|
||||
key: "app",
|
||||
value: "roo-code",
|
||||
},
|
||||
],
|
||||
}),
|
||||
},
|
||||
})
|
||||
return response.choices[0]?.message.content || ""
|
||||
} catch (error) {
|
||||
if (error instanceof Error) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue