forked from Archives/langchain
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
773 B
Python
36 lines
773 B
Python
# flake8: noqa
|
|
from langchain.prompts.prompt import PromptTemplate
|
|
|
|
API_URL_PROMPT_TEMPLATE = """You are given the below API Documentation:
|
|
|
|
{api_docs}
|
|
|
|
Using this documentation, generate the full API url to call for answering this question: {question}
|
|
|
|
API url: """
|
|
API_URL_PROMPT = PromptTemplate(
|
|
input_variables=[
|
|
"api_docs",
|
|
"question",
|
|
],
|
|
template=API_URL_PROMPT_TEMPLATE,
|
|
)
|
|
|
|
API_RESPONSE_PROMPT_TEMPLATE = (
|
|
API_URL_PROMPT_TEMPLATE
|
|
+ """ {api_url}
|
|
|
|
Here is the response from the API:
|
|
|
|
{api_response}
|
|
|
|
Summarize this response to answer the original question.
|
|
|
|
Summary:"""
|
|
)
|
|
|
|
API_RESPONSE_PROMPT = PromptTemplate(
|
|
input_variables=["api_docs", "question", "api_url", "api_response"],
|
|
template=API_RESPONSE_PROMPT_TEMPLATE,
|
|
)
|