Skip to content

Commit

Permalink
fix: apply npm format
Browse files Browse the repository at this point in the history
  • Loading branch information
sihyeong671 committed Aug 20, 2024
1 parent 76d1edb commit 0674eea
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions backend/src/langchain/langchain.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { BaseChatModel } from "@langchain/core/language_models/chat_models";

type ModelList = {
[key: string]: string[];
}
};

const modelList: ModelList = {
ollama: [
Expand All @@ -18,22 +18,18 @@ const modelList: ModelList = {
"starling-lm",
"solar",
],
openai: [
"gpt-3.5-turbo",
"gpt-4o-mini"
]
}
openai: ["gpt-3.5-turbo", "gpt-4o-mini"],
};

const chatModelFactory = {
provide: "ChatModel",
useFactory: () => {

const modelType = process.env.YORKIE_INTELLIGENCE;
try{
try {
const [provider, model] = modelType.split(":", 2);
let chatModel: BaseChatModel | ChatOllama
let chatModel: BaseChatModel | ChatOllama;

if (modelList[provider] && modelList[provider].includes(model)){
if (modelList[provider] && modelList[provider].includes(model)) {
if (provider === "ollama") {
chatModel = new ChatOllama({
model: model,
Expand All @@ -52,7 +48,6 @@ const chatModelFactory = {
} catch {
throw new Error(`${modelType} is not found. please check your model name`);
}

},
};

Expand Down

0 comments on commit 0674eea

Please sign in to comment.