MCPcopy Create free account
hub / github.com/LangGraph-GUI/LangGraph-GUI-backend / ChatBot

Function ChatBot

src/llm.py:52–70  ·  view source on GitHub ↗
(llm, question)

Source from the content-addressed store, hash-verified

50
51
52def ChatBot(llm, question):
53 # Define the prompt template
54 template = """
55 {question}
56 you reply json in {{ reply:"<content>" }}
57 """
58
59 prompt = PromptTemplate.from_template(clip_history(template))
60
61 # Format the prompt with the input variable
62 formatted_prompt = prompt.format(question=question)
63
64 llm_chain = prompt | llm | StrOutputParser()
65 generation = llm_chain.invoke(formatted_prompt)
66
67 data = json.loads(generation)
68 reply = data.get("reply", "")
69
70 return reply
71
72
73def create_llm_chain(prompt_template: str, llm, history: str) -> str:

Callers 1

process_stringFunction · 0.85

Calls 1

clip_historyFunction · 0.85

Tested by

no test coverage detected