feat: solution for 'Повторный экзамен: Граф с рефлексией и доработкой'
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
"""
|
||||
Utility functions for the LangGraph project.
|
||||
"""
|
||||
|
||||
from langchain_openai import ChatOpenAI
|
||||
from typing import Dict, Any
|
||||
|
||||
def get_llm() -> ChatOpenAI:
|
||||
"""
|
||||
Returns a configured OpenAI LLM instance.
|
||||
"""
|
||||
# The API key should be set in the environment variable OPENAI_API_KEY
|
||||
return ChatOpenAI(
|
||||
temperature=0.7,
|
||||
model_name="gpt-3.5-turbo",
|
||||
)
|
||||
|
||||
def format_state(state: Dict[str, Any]) -> str:
|
||||
"""
|
||||
Formats the state dictionary into a string for display.
|
||||
"""
|
||||
return "\n".join(f"{k}: {v}" for k, v in state.items())
|
||||
Reference in New Issue
Block a user