feat: solution for 'Повторный экзамен: Граф с рефлексией и доработкой'

This commit is contained in:
2026-06-30 14:49:00 +03:00
parent b0f9325dbf
commit 57a7f1d12b
8 changed files with 100 additions and 106 deletions
+22
View File
@@ -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())