MCPcopy
hub / github.com/n4ze3m/dialoqbase / chatModelProvider

Function chatModelProvider

server/src/utils/models.ts:11–119  ·  view source on GitHub ↗
(
  provider: string,
  modelName: string,
  temperature: number,
  otherFields?: any
)

Source from the content-addressed store, hash-verified

9import { Replicate } from "@langchain/community/llms/replicate";
10
11export const chatModelProvider = (
12 provider: string,
13 modelName: string,
14 temperature: number,
15 otherFields?: any
16) => {
17 modelName = modelName.replace("-dbase", "");
18 modelName = modelName.replace(/_dialoqbase_[0-9]+$/, "");
19
20 switch (provider.toLowerCase()) {
21 case "openai":
22 return new ChatOpenAI({
23 modelName: modelName,
24 temperature: temperature,
25 ...otherFields,
26 configuration: {
27 ...otherFields.configuration,
28 baseURL: process.env.OPENAI_API_URL,
29 },
30 });
31 case "anthropic":
32 return new ChatAnthropic({
33 modelName: modelName,
34 temperature: temperature,
35 ...otherFields,
36 }) as any;
37 case "google-bison":
38 return new ChatGooglePaLM({
39 temperature: temperature,
40 apiKey: process.env.GOOGLE_API_KEY,
41 ...otherFields,
42 });
43 case "huggingface-api":
44 return new HuggingFaceInference({
45 modelName: modelName,
46 temperature: temperature,
47 ...otherFields,
48 });
49 case "fireworks":
50 return new DialoqbaseFireworksModel({
51 model: modelName,
52 temperature: temperature,
53 is_chat: !notChatModels.includes(modelName),
54 ...otherFields,
55 });
56 case "openai-instruct":
57 return new OpenAI({
58 modelName: modelName,
59 temperature: temperature,
60 ...otherFields,
61 configuration: {
62 baseURL: process.env.OPENAI_API_URL,
63 },
64 });
65 case "local":
66 return new ChatOpenAI({
67 modelName: modelName,
68 temperature: temperature,

Callers 9

telegramBotHandlerFunction · 0.90
whatsappBotHandlerFunction · 0.90
discordBotHandlerFunction · 0.90
chatRequestAPIHandlerFunction · 0.90
chatRequestHandlerFunction · 0.90
chatRequestStreamHandlerFunction · 0.90
getModelFunction · 0.90
createChatModelFunction · 0.90
isValidModelFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected