Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
from ldai.providers import LDAIMetrics
from ldai_langchain import sum_token_usage_from_messages
from ldobserve import ObservabilityConfig, ObservabilityPlugin
from langchain.agents import create_agent
from langchain.chat_models import init_chat_model
from langgraph.prebuilt import create_react_agent

load_dotenv()

Expand Down Expand Up @@ -87,11 +87,11 @@ def main():
model_provider=langchain_provider,
)

# Create a React agent with the LLM and tools
agent = create_react_agent(
model=llm,
# Create a tool-calling agent with the LLM and tools
agent = create_agent(
llm,
tools=[get_weather],
prompt=agent_config.instructions
system_prompt=agent_config.instructions
)

SAMPLE_QUESTION = "What is the weather in Tokyo?"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
from ldai.tracker import TokenUsage
from ldai_langchain import get_ai_metrics_from_response
from ldobserve import ObservabilityConfig, ObservabilityPlugin
from langchain.agents import create_agent
from langchain.chat_models import init_chat_model
from langgraph.prebuilt import create_react_agent
from langgraph.graph import StateGraph, END
from langgraph.types import Command
from typing_extensions import TypedDict
Expand Down Expand Up @@ -97,8 +97,8 @@ def create_agent_with_config(aiclient, config_key, context):
model_provider=langchain_provider,
)

# Create a React agent with the LLM
agent = create_react_agent(llm, [], prompt=agent_config.instructions)
# Create a tool-calling agent with the LLM
agent = create_agent(llm, [], system_prompt=agent_config.instructions)

return agent, agent_config.create_tracker(), False

Expand Down
Loading