⬆️ Upgrade AI SDK (#1641)
This commit is contained in:
@ -3,8 +3,8 @@ import { auth } from '../auth'
|
||||
import { parseChatCompletionOptions } from '@typebot.io/openai-block/shared/parseChatCompletionOptions'
|
||||
import { getChatCompletionSetVarIds } from '@typebot.io/openai-block/shared/getChatCompletionSetVarIds'
|
||||
import { getChatCompletionStreamVarId } from '@typebot.io/openai-block/shared/getChatCompletionStreamVarId'
|
||||
import { runChatCompletion } from '@typebot.io/openai-block/shared/runChatCompletion'
|
||||
import { runChatCompletionStream } from '@typebot.io/openai-block/shared/runChatCompletionStream'
|
||||
import { runOpenAIChatCompletion } from '@typebot.io/openai-block/shared/runOpenAIChatCompletion'
|
||||
import { runOpenAIChatCompletionStream } from '@typebot.io/openai-block/shared/runOpenAIChatCompletionStream'
|
||||
import { defaultTogetherOptions } from '../constants'
|
||||
|
||||
export const createChatCompletion = createAction({
|
||||
@ -13,6 +13,7 @@ export const createChatCompletion = createAction({
|
||||
options: parseChatCompletionOptions({
|
||||
modelHelperText:
|
||||
'You can find the list of all the models available [here](https://docs.together.ai/docs/inference-models#chat-models). Copy the model string for API.',
|
||||
defaultTemperature: defaultTogetherOptions.temperature,
|
||||
}),
|
||||
turnableInto: [
|
||||
{
|
||||
@ -26,7 +27,6 @@ export const createChatCompletion = createAction({
|
||||
blockId: 'anthropic',
|
||||
transform: (options) => ({
|
||||
...options,
|
||||
model: undefined,
|
||||
action: 'Create Chat Message',
|
||||
responseMapping: options.responseMapping?.map((res: any) =>
|
||||
res.item === 'Message content'
|
||||
@ -39,18 +39,19 @@ export const createChatCompletion = createAction({
|
||||
getSetVariableIds: getChatCompletionSetVarIds,
|
||||
run: {
|
||||
server: (params) =>
|
||||
runChatCompletion({
|
||||
runOpenAIChatCompletion({
|
||||
...params,
|
||||
config: { baseUrl: defaultTogetherOptions.baseUrl },
|
||||
}),
|
||||
stream: {
|
||||
getStreamVariableId: getChatCompletionStreamVarId,
|
||||
run: async (params) => ({
|
||||
stream: await runChatCompletionStream({
|
||||
run: async (params) =>
|
||||
runOpenAIChatCompletionStream({
|
||||
...params,
|
||||
config: { baseUrl: defaultTogetherOptions.baseUrl },
|
||||
config: {
|
||||
baseUrl: defaultTogetherOptions.baseUrl,
|
||||
},
|
||||
}),
|
||||
}),
|
||||
},
|
||||
},
|
||||
})
|
||||
|
@ -1,3 +1,4 @@
|
||||
export const defaultTogetherOptions = {
|
||||
baseUrl: 'https://api.together.xyz/v1',
|
||||
temperature: 1,
|
||||
} as const
|
||||
|
Reference in New Issue
Block a user