feat: use stringifyForModel for call result

old-agentic-v1^2
Philipp Burckhardt 2023-06-15 23:10:57 -04:00 zatwierdzone przez Travis Fischer
rodzic cb2ea1a2ef
commit a9168fc2b9
1 zmienionych plików z 3 dodań i 6 usunięć

Wyświetl plik

@ -11,7 +11,8 @@ import { getCompiledTemplate } from '@/template'
import {
extractFunctionIdentifierFromString,
extractJSONArrayFromString,
extractJSONObjectFromString
extractJSONObjectFromString,
stringifyForModel
} from '@/utils'
import { BaseLLM } from './llm'
@ -328,11 +329,7 @@ export abstract class BaseChatCompletion<
// TODO: handle result as string or JSON
// TODO: better support for JSON spacing
const taskCallContent = JSON.stringify(
toolCallResponse.result,
null,
1
).replaceAll(/\n ?/gm, ' ')
const taskCallContent = stringifyForModel(toolCallResponse.result)
// TODO: remove `any` cast once openai-fetch is updated
messages.push(completion.message as any)