mirror of
https://github.com/hwchase17/langchain
synced 2024-11-06 03:20:49 +00:00
16 lines
504 B
Python
16 lines
504 B
Python
|
from langchain.prompts import ChatPromptTemplate
|
||
|
from langchain.chat_models import ChatAnthropic
|
||
|
from langchain.schema.output_parser import StrOutputParser
|
||
|
|
||
|
from .prompts import answer_prompt
|
||
|
from .retriever_agent import executor
|
||
|
|
||
|
prompt = ChatPromptTemplate.from_template(answer_prompt)
|
||
|
|
||
|
model = ChatAnthropic(model="claude-2", temperature=0, max_tokens_to_sample=1000)
|
||
|
|
||
|
chain = {
|
||
|
"query": lambda x: x["query"],
|
||
|
"information": executor | (lambda x: x["output"])
|
||
|
} | prompt | model | StrOutputParser()
|