@jambonz/llm 0.2.3 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +5 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/dist/test-kit/index.cjs +5 -3
- package/dist/test-kit/index.cjs.map +1 -1
- package/dist/test-kit/index.js +5 -3
- package/dist/test-kit/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -73,14 +73,15 @@ async function* streamFromOpenAI(client, req, options) {
|
|
|
73
73
|
model: req.model,
|
|
74
74
|
messages,
|
|
75
75
|
stream: true,
|
|
76
|
-
stream_options: { include_usage: true }
|
|
76
|
+
...options.includeStreamOptions !== false ? { stream_options: { include_usage: true } } : {}
|
|
77
77
|
};
|
|
78
78
|
if (tools) {
|
|
79
79
|
body.tools = tools;
|
|
80
80
|
body.tool_choice = "auto";
|
|
81
81
|
}
|
|
82
82
|
if (req.temperature !== void 0) body.temperature = req.temperature;
|
|
83
|
-
|
|
83
|
+
const effectiveMaxTokens = req.maxTokens ?? options.defaultMaxTokens;
|
|
84
|
+
if (effectiveMaxTokens !== void 0) body.max_tokens = effectiveMaxTokens;
|
|
84
85
|
let stream;
|
|
85
86
|
try {
|
|
86
87
|
stream = await client.chat.completions.create(body, { signal: req.signal });
|
|
@@ -1587,7 +1588,8 @@ var VertexOpenAIAdapter = class {
|
|
|
1587
1588
|
}
|
|
1588
1589
|
stream(req) {
|
|
1589
1590
|
return streamFromOpenAI(this.ensureClient(), req, {
|
|
1590
|
-
knownModels: vertexOpenAIManifest.knownModels
|
|
1591
|
+
knownModels: vertexOpenAIManifest.knownModels,
|
|
1592
|
+
defaultMaxTokens: 4096
|
|
1591
1593
|
});
|
|
1592
1594
|
}
|
|
1593
1595
|
appendAssistantToolCall(history, toolCalls) {
|