Agent 서버 구축: 멀티테넌트 협상 PoC (UCB Q-Table 학습 + /chat + 14 API + 학습검증 하네스), config 단일화(local.toml) + 빌드 경량화
This commit is contained in:
1 parent
212725e5f9
commit
951d6eab84
140 files changed
+6689
-214
No files matched your search
@@ -0,0 +1,34 @@
|
||||
"""LangGraph 기반 대화 그래프 (구 N-profiling/domain/graph.py 이식).
|
||||
|
||||
원본 import 버그 수정: `n_profiling.llm`(존재하지 않음) → `negotiation.profiling.infra.llm_adapter`.
|
||||
chat_engine 은 이 모듈을 사용하지 않으며(script_modifier/verifier 만 사용), langgraph 는 선택 의존성이다.
|
||||
직접 import 할 때만 langgraph 가 필요하다.
|
||||
"""
|
||||
|
||||
from typing import List, TypedDict
|
||||
|
||||
from langchain_core.messages import BaseMessage
|
||||
from langgraph.graph import StateGraph
|
||||
from langgraph.checkpoint.sqlite import SqliteSaver
|
||||
|
||||
from negotiation.profiling.infra.llm_adapter import get_llm
|
||||
|
||||
|
||||
class AgentState(TypedDict):
|
||||
"""대화 상태. messages: 대화 히스토리."""
|
||||
|
||||
messages: List[BaseMessage]
|
||||
|
||||
|
||||
def call_model(state: AgentState):
|
||||
response = get_llm().invoke(state["messages"])
|
||||
return {"messages": [response]}
|
||||
|
||||
|
||||
# 대화 상태를 메모리에 임시 저장하는 체크포인터.
|
||||
memory = SqliteSaver.from_conn_string(":memory:")
|
||||
|
||||
graph = StateGraph(AgentState)
|
||||
graph.add_node("llm", call_model)
|
||||
graph.set_entry_point("llm")
|
||||
graph.set_finish_point("llm")
|
||||
Reference in new issue
Block a user