from langchain.agents import create_agent
from langchain_deepseek import ChatDeepSeek
from pydantic import BaseModel,Field
from env_utils import DEEPSEEK_API_KEY,DEEPSEEK_BASE_URL
from langchain.agents import create_agent,AgentState
from langchain_core.tools import tool
from langgraph.checkpoint.memory import InMemorySaver
from langgraph.prebuilt import ToolRuntime
deepseek_llm = ChatDeepSeek(model='deepseek-chat',
api_key=DEEPSEEK_API_KEY,
base_url=DEEPSEEK_BASE_URL)
class Movie(BaseModel):
title: str = Field(description="电影的标题")
director: str = Field(description="电影的导演")
year: int = Field(description="电影的上映年份")
rating: float = Field(description="电影的评分")
model_with_structured_output= deepseek_llm.with_structured_output(Movie)
res=model_with_structured_output.invoke("介绍下电影《速度与激情》?")
print(res)
title='速度与激情' director='罗伯·科恩' year=2001 rating=6.8