MCPcopy
hub / github.com/langchain-ai/langchain / _format_chat_history

Function _format_chat_history

templates/xml-agent/xml_agent/agent.py:14–19  ·  view source on GitHub ↗
(chat_history: List[Tuple[str, str]])

Source from the content-addressed store, hash-verified

12
13
14def _format_chat_history(chat_history: List[Tuple[str, str]]):
15 buffer = []
16 for human, ai in chat_history:
17 buffer.append(HumanMessage(content=human))
18 buffer.append(AIMessage(content=ai))
19 return buffer
20
21
22model = ChatAnthropic(model="claude-3-sonnet-20240229")

Callers 1

agent.pyFile · 0.70

Calls 3

HumanMessageClass · 0.90
AIMessageClass · 0.90
appendMethod · 0.80

Tested by

no test coverage detected