Skip to content

Commit

Permalink
Add input type to graph
Browse files Browse the repository at this point in the history
Signed-off-by: Di Wang <[email protected]>
  • Loading branch information
hemslo committed Feb 16, 2024
1 parent da4862c commit 6481eb7
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions app/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
from typing import Annotated, Sequence, TypedDict

from langchain.agents import create_openai_tools_agent, AgentExecutor
from langchain_core.messages import BaseMessage, HumanMessage
from langchain_core.messages import BaseMessage, HumanMessage, AIMessage, SystemMessage, FunctionMessage, ChatMessage, \
ToolMessage
from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder
from langchain_openai import ChatOpenAI
from langgraph.graph import StateGraph, END
from langgraph.pregel import Pregel
from pydantic import BaseModel

from app.chains.supervisor import build_supervisor_chain
from app.dependencies.openai_chat_model import openai_chat_model
Expand Down Expand Up @@ -78,4 +80,9 @@ def build_graph() -> Pregel:
return workflow.compile()


graph = build_graph()
class Input(BaseModel):
messages: Sequence[HumanMessage | AIMessage | SystemMessage | FunctionMessage | ChatMessage | ToolMessage]
next: str | None


graph = build_graph().with_types(input_type=Input)

0 comments on commit 6481eb7

Please sign in to comment.