Skip to content

Commit 9c43576

Browse files
committed
add debugging comments
1 parent 3e04447 commit 9c43576

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

samples/agentic-langgraph/app/agent.mts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ import { ChatOpenAI } from "@langchain/openai";
44
import { HumanMessage, AIMessage } from "@langchain/core/messages";
55
import { ToolNode } from "@langchain/langgraph/prebuilt";
66
import { StateGraph, MessagesAnnotation } from "@langchain/langgraph";
7-
import { get } from "http";
87

98
// Define the tools for the agent to use
109
const tools = [new TavilySearch({ maxResults: 3 })];
1110
const toolNode = new ToolNode(tools);
1211

1312
const baseUrl = process.env.LLM_URL || "https://api.openai.com/v1/";
13+
console.log("Using LLM base URL:", baseUrl);
1414
const baseModel = process.env.LLM_MODEL || "gpt-4o-mini";
15-
15+
console.log("Using LLM model:", baseModel);
1616
// Create a model and give it access to the tools
1717
const model = new ChatOpenAI({
1818
model: baseModel,
@@ -56,9 +56,13 @@ const app = workflow.compile();
5656

5757
// Helper function to get agent output for a given input and optional previous messages
5858
const getAgentOutput = async (input: string, previousMessages: (HumanMessage | AIMessage)[] = []) => {
59+
console.log("Getting agent output for input:", input);
60+
5961
const initialState = {
6062
messages: [...previousMessages, new HumanMessage(input)],
6163
};
64+
console.log("Initial state messages (JSON):", JSON.stringify(initialState.messages, null, 2));
65+
6266
const finalState = await app.invoke(initialState);
6367
return {
6468
content: finalState.messages[finalState.messages.length - 1].content,

samples/agentic-langgraph/compose.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ services:
2626
- target: 80
2727
published: 80
2828
protocol: tcp
29-
mode: ingress
3029
x-defang-llm: true
3130
deploy:
3231
resources:

0 commit comments

Comments
 (0)