kopia lustrzana https://github.com/transitive-bullshit/chatgpt-api
feat: use stringifyForModel for call result
rodzic
cb2ea1a2ef
commit
a9168fc2b9
|
@ -11,7 +11,8 @@ import { getCompiledTemplate } from '@/template'
|
||||||
import {
|
import {
|
||||||
extractFunctionIdentifierFromString,
|
extractFunctionIdentifierFromString,
|
||||||
extractJSONArrayFromString,
|
extractJSONArrayFromString,
|
||||||
extractJSONObjectFromString
|
extractJSONObjectFromString,
|
||||||
|
stringifyForModel
|
||||||
} from '@/utils'
|
} from '@/utils'
|
||||||
|
|
||||||
import { BaseLLM } from './llm'
|
import { BaseLLM } from './llm'
|
||||||
|
@ -328,11 +329,7 @@ export abstract class BaseChatCompletion<
|
||||||
|
|
||||||
// TODO: handle result as string or JSON
|
// TODO: handle result as string or JSON
|
||||||
// TODO: better support for JSON spacing
|
// TODO: better support for JSON spacing
|
||||||
const taskCallContent = JSON.stringify(
|
const taskCallContent = stringifyForModel(toolCallResponse.result)
|
||||||
toolCallResponse.result,
|
|
||||||
null,
|
|
||||||
1
|
|
||||||
).replaceAll(/\n ?/gm, ' ')
|
|
||||||
|
|
||||||
// TODO: remove `any` cast once openai-fetch is updated
|
// TODO: remove `any` cast once openai-fetch is updated
|
||||||
messages.push(completion.message as any)
|
messages.push(completion.message as any)
|
||||||
|
|
Ładowanie…
Reference in New Issue