@baseai/core
Advanced tools
Comparing version 0.9.32 to 0.9.33-snapshot.0
@@ -100,2 +100,3 @@ import { ChatCompletionStream } from 'openai/lib/ChatCompletionStream'; | ||
runTools?: boolean; | ||
name?: string; | ||
} | ||
@@ -102,0 +103,0 @@ interface RunOptionsStream extends RunOptions { |
@@ -874,3 +874,3 @@ "use strict"; | ||
} | ||
async handleStreamResponse(options, response) { | ||
async handleStreamResponse(options, response, pipeName) { | ||
const endpoint = "/v1/pipes/run"; | ||
@@ -916,3 +916,4 @@ const stream = this.isStreamRequested(options); | ||
threadId: currentResponse.threadId | ||
} | ||
}, | ||
pipeName | ||
); | ||
@@ -934,2 +935,3 @@ callCount++; | ||
const hasTools = this.pipe.tools.length > 0; | ||
const pipeName = options.name || this.pipe.name; | ||
let stream = this.isStreamRequested(options); | ||
@@ -943,3 +945,3 @@ if (isAnthropic && hasTools && stream) { | ||
const body = { ...options, stream }; | ||
let response = await this.createRequest(endpoint, body); | ||
let response = await this.createRequest(endpoint, body, pipeName); | ||
if (Object.entries(response).length === 0) { | ||
@@ -957,3 +959,4 @@ return {}; | ||
options, | ||
response | ||
response, | ||
pipeName | ||
); | ||
@@ -982,3 +985,3 @@ } | ||
threadId: currentResponse.threadId | ||
}); | ||
}, pipeName); | ||
callCount++; | ||
@@ -994,3 +997,3 @@ if (this.hasNoToolCalls(currentResponse.choices[0].message)) { | ||
} | ||
async createRequest(endpoint, body) { | ||
async createRequest(endpoint, body, pipeName) { | ||
const isProdEnv = this.prod; | ||
@@ -1001,3 +1004,3 @@ const prodOptions = { | ||
...body, | ||
name: this.pipe.name | ||
name: pipeName || this.pipe.name | ||
} | ||
@@ -1017,4 +1020,2 @@ }; | ||
}; | ||
} | ||
if (!isProdEnv) { | ||
const isServerRunning = await isLocalServerRunning(); | ||
@@ -1021,0 +1022,0 @@ if (!isServerRunning) return {}; |
{ | ||
"name": "@baseai/core", | ||
"description": "The Web AI Framework's core - BaseAI.dev", | ||
"version": "0.9.32", | ||
"version": "0.9.33-snapshot.0", | ||
"license": "Apache-2.0", | ||
@@ -6,0 +6,0 @@ "sideEffects": false, |
@@ -80,2 +80,3 @@ import { ChatCompletionStream } from 'openai/lib/ChatCompletionStream'; | ||
runTools?: boolean; | ||
name?: string; | ||
} | ||
@@ -82,0 +83,0 @@ interface RunOptionsStream extends RunOptions { |
@@ -865,3 +865,3 @@ "use strict"; | ||
} | ||
async handleStreamResponse(options, response) { | ||
async handleStreamResponse(options, response, pipeName) { | ||
const endpoint = "/v1/pipes/run"; | ||
@@ -907,3 +907,4 @@ const stream = this.isStreamRequested(options); | ||
threadId: currentResponse.threadId | ||
} | ||
}, | ||
pipeName | ||
); | ||
@@ -925,2 +926,3 @@ callCount++; | ||
const hasTools = this.pipe.tools.length > 0; | ||
const pipeName = options.name || this.pipe.name; | ||
let stream = this.isStreamRequested(options); | ||
@@ -934,3 +936,3 @@ if (isAnthropic && hasTools && stream) { | ||
const body = { ...options, stream }; | ||
let response = await this.createRequest(endpoint, body); | ||
let response = await this.createRequest(endpoint, body, pipeName); | ||
if (Object.entries(response).length === 0) { | ||
@@ -948,3 +950,4 @@ return {}; | ||
options, | ||
response | ||
response, | ||
pipeName | ||
); | ||
@@ -973,3 +976,3 @@ } | ||
threadId: currentResponse.threadId | ||
}); | ||
}, pipeName); | ||
callCount++; | ||
@@ -985,3 +988,3 @@ if (this.hasNoToolCalls(currentResponse.choices[0].message)) { | ||
} | ||
async createRequest(endpoint, body) { | ||
async createRequest(endpoint, body, pipeName) { | ||
const isProdEnv = this.prod; | ||
@@ -992,3 +995,3 @@ const prodOptions = { | ||
...body, | ||
name: this.pipe.name | ||
name: pipeName || this.pipe.name | ||
} | ||
@@ -1008,4 +1011,2 @@ }; | ||
}; | ||
} | ||
if (!isProdEnv) { | ||
const isServerRunning = await isLocalServerRunning(); | ||
@@ -1012,0 +1013,0 @@ if (!isServerRunning) return {}; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
468517
5506