update deps. Install ollama for lang chain. Update model to deepseek
This commit is contained in:
@@ -1,22 +1,22 @@
|
|||||||
import { HumanMessage, SystemMessage } from "@langchain/core/messages";
|
import { HumanMessage, SystemMessage } from "@langchain/core/messages";
|
||||||
import { GraphNode } from "@langchain/langgraph";
|
import { GraphNode } from "@langchain/langgraph";
|
||||||
import { MessagesState } from "../state";
|
import { MessagesState } from "../state";
|
||||||
import { ChatOpenAI } from "@langchain/openai"
|
import { ChatOllama } from "@langchain/ollama";
|
||||||
import { hydratePrompt } from "../prompts/hydratePrompt";
|
import { hydratePrompt } from "../prompts/hydratePrompt";
|
||||||
|
|
||||||
export function createModelNode(tools: any, promptPath: string): GraphNode<typeof MessagesState> {
|
export function createModelNode(tools: any, promptPath: string): GraphNode<typeof MessagesState> {
|
||||||
return async (state) => {
|
return async (state) => {
|
||||||
const sysPrompt = await hydratePrompt(promptPath, state);
|
const sysPrompt = await hydratePrompt(promptPath, state);
|
||||||
|
|
||||||
const model = new ChatOpenAI({
|
const model = new ChatOllama({
|
||||||
model: "gpt-5-mini"
|
model: "deepseek-r1:14b",
|
||||||
|
temperature: 0.7,
|
||||||
});
|
});
|
||||||
|
|
||||||
const modelWithTools = model.bindTools(Object.values(tools));
|
const modelWithTools = model.bindTools(Object.values(tools));
|
||||||
|
|
||||||
const response = await modelWithTools.invoke([
|
const response = await modelWithTools.invoke([
|
||||||
new SystemMessage(
|
new SystemMessage(sysPrompt),
|
||||||
sysPrompt
|
|
||||||
),
|
|
||||||
...state.messages,
|
...state.messages,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|||||||
Generated
+382
-357
File diff suppressed because it is too large
Load Diff
@@ -17,6 +17,7 @@
|
|||||||
"@langchain/core": "^1.1.17",
|
"@langchain/core": "^1.1.17",
|
||||||
"@langchain/langgraph": "^1.1.2",
|
"@langchain/langgraph": "^1.1.2",
|
||||||
"@langchain/langgraph-sdk": "^1.5.5",
|
"@langchain/langgraph-sdk": "^1.5.5",
|
||||||
|
"@langchain/ollama": "^1.2.6",
|
||||||
"@langchain/openai": "^1.2.3",
|
"@langchain/openai": "^1.2.3",
|
||||||
"axios": "^1.13.5",
|
"axios": "^1.13.5",
|
||||||
"compute-cosine-similarity": "^1.1.0",
|
"compute-cosine-similarity": "^1.1.0",
|
||||||
|
|||||||
Reference in New Issue
Block a user