File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
src/lib/server/textGeneration Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ import {
18
18
import { generate } from "./generate" ;
19
19
import { mergeAsyncGenerators } from "$lib/utils/mergeAsyncGenerators" ;
20
20
import type { TextGenerationContext } from "./types" ;
21
+ import type { ToolResult } from "$lib/types/Tool" ;
21
22
22
23
export async function * textGeneration ( ctx : TextGenerationContext ) {
23
24
yield * mergeAsyncGenerators ( [
@@ -56,8 +57,12 @@ async function* textGenerationWithoutTitle(
56
57
if ( messages [ 0 ] . from === "system" ) messages [ 0 ] . content = preprompt ;
57
58
}
58
59
59
- const tools = pickTools ( toolsPreference , Boolean ( assistant ) ) ;
60
- const toolResults = yield * runTools ( ctx , tools , preprompt ) ;
60
+ let toolResults : ToolResult [ ] = [ ] ;
61
+
62
+ if ( model . tools && ! conv . assistantId ) {
63
+ const tools = pickTools ( toolsPreference , Boolean ( assistant ) ) ;
64
+ toolResults = yield * runTools ( ctx , tools , preprompt ) ;
65
+ }
61
66
62
67
const processedMessages = await preprocessMessages ( messages , webSearchResult , convId ) ;
63
68
yield * generate ( { ...ctx , messages : processedMessages } , toolResults , preprompt ) ;
You can’t perform that action at this time.
0 commit comments