feat(providers): removed providers from tools directory, added cerebras sdk

This commit is contained in:
Waleed Latif
2025-02-27 13:29:52 -08:00
parent f8e3665b77
commit fa67494fe7
22 changed files with 317 additions and 751 deletions
+3 -3
View File
@@ -1,6 +1,6 @@
import { AgentIcon } from '@/components/icons'
import { MODEL_PROVIDERS } from '@/providers/consts'
import { ToolResponse } from '@/tools/types'
import { MODEL_TOOLS, ModelType } from '../consts'
import { BlockConfig } from '../types'
interface AgentResponse extends ToolResponse {
@@ -49,7 +49,7 @@ export const AgentBlock: BlockConfig<AgentResponse> = {
title: 'Model',
type: 'dropdown',
layout: 'half',
options: Object.keys(MODEL_TOOLS),
options: Object.keys(MODEL_PROVIDERS),
},
{
id: 'temperature',
@@ -96,7 +96,7 @@ export const AgentBlock: BlockConfig<AgentResponse> = {
if (!model) {
throw new Error('No model selected')
}
const tool = MODEL_TOOLS[model as ModelType]
const tool = MODEL_PROVIDERS[model]
if (!tool) {
throw new Error(`Invalid model selected: ${model}`)
}
+4 -3
View File
@@ -1,6 +1,7 @@
import { ChartBarIcon } from '@/components/icons'
import { MODEL_PROVIDERS } from '@/providers/consts'
import { ProviderId } from '@/providers/registry'
import { ToolResponse } from '@/tools/types'
import { MODEL_TOOLS, ModelType } from '../consts'
import { BlockConfig, ParamType } from '../types'
interface Metric {
@@ -81,7 +82,7 @@ export const EvaluatorBlock: BlockConfig<EvaluatorResponse> = {
title: 'Model',
type: 'dropdown',
layout: 'half',
options: Object.keys(MODEL_TOOLS),
options: Object.keys(MODEL_PROVIDERS),
},
{
id: 'apiKey',
@@ -125,7 +126,7 @@ export const EvaluatorBlock: BlockConfig<EvaluatorResponse> = {
if (!model) {
throw new Error('No model selected')
}
const tool = MODEL_TOOLS[model as ModelType]
const tool = MODEL_PROVIDERS[model as ProviderId]
if (!tool) {
throw new Error(`Invalid model selected: ${model}`)
}
+4 -3
View File
@@ -1,6 +1,7 @@
import { ConnectIcon } from '@/components/icons'
import { MODEL_PROVIDERS } from '@/providers/consts'
import { ProviderId } from '@/providers/registry'
import { ToolResponse } from '@/tools/types'
import { MODEL_TOOLS, ModelType } from '../consts'
import { BlockConfig } from '../types'
interface RouterResponse extends ToolResponse {
@@ -105,7 +106,7 @@ export const RouterBlock: BlockConfig<RouterResponse> = {
title: 'Model',
type: 'dropdown',
layout: 'half',
options: Object.keys(MODEL_TOOLS),
options: Object.keys(MODEL_PROVIDERS),
},
{
id: 'apiKey',
@@ -142,7 +143,7 @@ export const RouterBlock: BlockConfig<RouterResponse> = {
if (!model) {
throw new Error('No model selected')
}
const tool = MODEL_TOOLS[model as ModelType]
const tool = MODEL_PROVIDERS[model as ProviderId]
if (!tool) {
throw new Error(`Invalid model selected: ${model}`)
}
+5 -5
View File
@@ -1,6 +1,6 @@
import { TranslateIcon } from '@/components/icons'
import { ChatResponse } from '@/tools/openai/chat'
import { MODEL_TOOLS, ModelType } from '../consts'
import { MODEL_PROVIDERS } from '@/providers/consts'
import { ProviderId } from '@/providers/registry'
import { BlockConfig } from '../types'
const getTranslationPrompt = (
@@ -14,7 +14,7 @@ const getTranslationPrompt = (
Only return the translated text without any explanations or notes. The translation should be natural and fluent in ${targetLanguage || 'English'}.`
export const TranslateBlock: BlockConfig<ChatResponse> = {
export const TranslateBlock: BlockConfig = {
type: 'translate',
name: 'Translate',
description: 'Translate text to any language',
@@ -41,7 +41,7 @@ export const TranslateBlock: BlockConfig<ChatResponse> = {
title: 'Model',
type: 'dropdown',
layout: 'half',
options: Object.keys(MODEL_TOOLS),
options: Object.keys(MODEL_PROVIDERS),
},
{
id: 'apiKey',
@@ -73,7 +73,7 @@ export const TranslateBlock: BlockConfig<ChatResponse> = {
throw new Error('No model selected')
}
const tool = MODEL_TOOLS[model as ModelType]
const tool = MODEL_PROVIDERS[model as ProviderId]
if (!tool) {
throw new Error(`Invalid model selected: ${model}`)
+13 -12
View File
@@ -1,13 +1,14 @@
export const MODEL_TOOLS = {
'gpt-4o': 'openai_chat',
o1: 'openai_chat',
'o3-mini': 'openai_chat',
'deepseek-v3': 'deepseek_chat',
'deepseek-r1': 'deepseek_reasoner',
'claude-3-7-sonnet-20250219': 'anthropic_chat',
'gemini-2.0-flash': 'google_chat',
'grok-2-latest': 'xai_chat',
} as const
// export const MODEL_TOOLS = {
// 'gpt-4o': 'openai_chat',
// o1: 'openai_chat',
// 'o3-mini': 'openai_chat',
// 'deepseek-v3': 'deepseek_chat',
// 'deepseek-r1': 'deepseek_reasoner',
// 'claude-3-7-sonnet-20250219': 'anthropic_chat',
// 'gemini-2.0-flash': 'google_chat',
// 'grok-2-latest': 'xai_chat',
// 'llama-3.3-70b': 'cerebras_chat',
// } as const
export type ModelType = keyof typeof MODEL_TOOLS
export type ToolType = (typeof MODEL_TOOLS)[ModelType]
// export type ModelType = keyof typeof MODEL_TOOLS
// export type ToolType = (typeof MODEL_TOOLS)[ModelType]