Dataset Viewer
Auto-converted to Parquet Duplicate
id
stringlengths
14
15
text
stringlengths
32
2.18k
source
stringclasses
30 values
4cecf0a7e954-0
Debugging | 🦜�🔗 Langchain
https://python.langchain.com/docs/guides/debugging
4cecf0a7e954-1
Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/​OData connectionChainsMemoryAgentsCallbacksModulesGuidesEvaluationDebuggingDeploymentLangSmithModel ComparisonEcosystemAdditional resourcesGuidesDebuggingOn this pa...
https://python.langchain.com/docs/guides/debugging
4cecf0a7e954-2
llm, agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION)agent.run("Who directed the 2023 film Oppenheimer and what is their age? What is their age in days (assume 365 days per year)?") 'The director of the 2023 film Oppenheimer is Christopher Nolan and he is approximately 19345 days old in 2023.'langchain.debug = True​Se...
https://python.langchain.com/docs/guides/debugging
4cecf0a7e954-3
] } [llm/start] [1:RunTypeEnum.chain:AgentExecutor > 2:RunTypeEnum.chain:LLMChain > 3:RunTypeEnum.llm:ChatOpenAI] Entering LLM run with input: { "prompts": [ "Human: Answer the following questions as best you can. You have access to the following tools:\n\nduckduckgo_search: A wrapper around DuckDu...
https://python.langchain.com/docs/guides/debugging
4cecf0a7e954-4
[ { "text": "I need to find out who directed the 2023 film Oppenheimer and their age. Then, I need to calculate their age in days. I will use DuckDuckGo to find out the director and their age.\nAction: duckduckgo_search\nAction Input: \"Director of the 2023 film Oppenheimer and their age\"", ...
https://python.langchain.com/docs/guides/debugging
4cecf0a7e954-5
to find out the director and their age.\nAction: duckduckgo_search\nAction Input: \"Director of the 2023 film Oppenheimer and their age\"", "additional_kwargs": {} } } } ] ], "llm_output": { "token_usage": { "prompt_tokens": 206, ...
https://python.langchain.com/docs/guides/debugging
4cecf0a7e954-6
run with input: "Director of the 2023 film Oppenheimer and their age" [tool/end] [1:RunTypeEnum.chain:AgentExecutor > 4:RunTypeEnum.tool:duckduckgo_search] [1.51s] Exiting Tool run with output: "Capturing the mad scramble to build the first atomic bomb required rapid-fire filming, strict set rules and the cons...
https://python.langchain.com/docs/guides/debugging
4cecf0a7e954-7
"input": "Who directed the 2023 film Oppenheimer and what is their age? What is their age in days (assume 365 days per year)?", "agent_scratchpad": "I need to find out who directed the 2023 film Oppenheimer and their age. Then, I need to calculate their age in days. I will use DuckDuckGo to find out the director a...
https://python.langchain.com/docs/guides/debugging
4cecf0a7e954-8
the Manhattan Project and thereby ushering in the Atomic Age.\nThought:", "stop": [ "\nObservation:", "\n\tObservation:" ] } [llm/start] [1:RunTypeEnum.chain:AgentExecutor > 5:RunTypeEnum.chain:LLMChain > 6:RunTypeEnum.llm:ChatOpenAI] Entering LLM run with input: { "prompts": [ ...
https://python.langchain.com/docs/guides/debugging
4cecf0a7e954-9
to find out the director and their age.\nAction: duckduckgo_search\nAction Input: \"Director of the 2023 film Oppenheimer and their age\"\nObservation: Capturing the mad scramble to build the first atomic bomb required rapid-fire filming, strict set rules and the construction of an entire 1940s western town. By Jada Yu...
https://python.langchain.com/docs/guides/debugging
4cecf0a7e954-10
"generations": [ [ { "text": "The director of the 2023 film Oppenheimer is Christopher Nolan. Now I need to find out his age.\nAction: duckduckgo_search\nAction Input: \"Christopher Nolan age\"", "generation_info": { "finish_reason": "stop" }, "me...
https://python.langchain.com/docs/guides/debugging
4cecf0a7e954-11
{} } } } ] ], "llm_output": { "token_usage": { "prompt_tokens": 550, "completion_tokens": 39, "total_tokens": 589 }, "model_name": "gpt-4" }, "run": null } [chain/end] [1:RunTypeEnum.chain:AgentExecutor > 5...
https://python.langchain.com/docs/guides/debugging
4cecf0a7e954-12
storytelling, Nolan is considered a leading filmmaker of the 21st century. His films have grossed $5 billion worldwide. The recipient of many accolades, he has been nominated for five Academy Awards, five BAFTA Awards and six Golden Globe Awards. July 30, 1970 (age 52) London England Notable Works: "Dunkirk" "Tenet" "T...
https://python.langchain.com/docs/guides/debugging
4cecf0a7e954-13
director and their age.\nAction: duckduckgo_search\nAction Input: \"Director of the 2023 film Oppenheimer and their age\"\nObservation: Capturing the mad scramble to build the first atomic bomb required rapid-fire filming, strict set rules and the construction of an entire 1940s western town. By Jada Yuan. July 19, 202...
https://python.langchain.com/docs/guides/debugging
4cecf0a7e954-14
storytelling, Nolan is considered a leading filmmaker of the 21st century. His films have grossed $5 billion worldwide. The recipient of many accolades, he has been nominated for five Academy Awards, five BAFTA Awards and six Golden Globe Awards. July 30, 1970 (age 52) London England Notable Works: \"Dunkirk\" \"Tenet\...
https://python.langchain.com/docs/guides/debugging
4cecf0a7e954-15
to the following tools:\n\nduckduckgo_search: A wrapper around DuckDuckGo Search. Useful for when you need to answer questions about current events. Input should be a search query.\nCalculator: Useful for when you need to answer questions about math.\n\nUse the following format:\n\nQuestion: the input question you must...
https://python.langchain.com/docs/guides/debugging
4cecf0a7e954-16
by Christopher Nolan. With Cillian Murphy, Emily Blunt, Robert Downey Jr., Alden Ehrenreich. The story of American scientist J. Robert Oppenheimer and his role in the development of the atomic bomb. Christopher Nolan goes deep on 'Oppenheimer,' his most 'extreme' film to date. By Kenneth Turan. July 11, 2023 5 AM PT. F...
https://python.langchain.com/docs/guides/debugging
4cecf0a7e954-17
AM PT For Subscribers Christopher Nolan is photographed in Los Angeles. (Joe Pugliese / For The Times) This is not the story I was supposed to write. Oppenheimer director Christopher Nolan, Cillian Murphy, Emily Blunt and Matt Damon on the stakes of making a three-hour, CGI-free summer film. Christopher Nolan, the dire...
https://python.langchain.com/docs/guides/debugging
4cecf0a7e954-18
"id": [ "langchain", "schema", "messages", "AIMessage" ], "kwargs": { "content": "Christopher Nolan was born on July 30, 1970, which makes him 52 years old in 2023. Now I need to calculate his age in days.\nAction: Calc...
https://python.langchain.com/docs/guides/debugging
4cecf0a7e954-19
> 8:RunTypeEnum.chain:LLMChain] [2.69s] Exiting Chain run with output: { "text": "Christopher Nolan was born on July 30, 1970, which makes him 52 years old in 2023. Now I need to calculate his age in days.\nAction: Calculator\nAction Input: 52*365" } [tool/start] [1:RunTypeEnum.chain:AgentExecutor > 10:Ru...
https://python.langchain.com/docs/guides/debugging
4cecf0a7e954-20
[ "Human: Translate a math problem into a expression that can be executed using Python's numexpr library. Use the output of running this code to answer the question.\n\nQuestion: ${Question with math problem.}\n```text\n${single line mathematical expression that solves the problem}\n```\n...numexpr.evaluate(text...
https://python.langchain.com/docs/guides/debugging
4cecf0a7e954-21
"generation_info": { "finish_reason": "stop" }, "message": { "lc": 1, "type": "constructor", "id": [ "langchain", "schema", "messages", "AIMessage" ], "kwargs":...
https://python.langchain.com/docs/guides/debugging
4cecf0a7e954-22
"completion_tokens": 19, "total_tokens": 222 }, "model_name": "gpt-4" }, "run": null } [chain/end] [1:RunTypeEnum.chain:AgentExecutor > 10:RunTypeEnum.tool:Calculator > 11:RunTypeEnum.chain:LLMMathChain > 12:RunTypeEnum.chain:LLMChain] [2.89s] Exiting Chain run with output: { ...
https://python.langchain.com/docs/guides/debugging
4cecf0a7e954-23
"I need to find out who directed the 2023 film Oppenheimer and their age. Then, I need to calculate their age in days. I will use DuckDuckGo to find out the director and their age.\nAction: duckduckgo_search\nAction Input: \"Director of the 2023 film Oppenheimer and their age\"\nObservation: Capturing the mad scramble ...
https://python.langchain.com/docs/guides/debugging
4cecf0a7e954-24
Input: \"Christopher Nolan age\"\nObservation: Christopher Edward Nolan CBE (born 30 July 1970) is a British and American filmmaker. Known for his Hollywood blockbusters with complex storytelling, Nolan is considered a leading filmmaker of the 21st century. His films have grossed $5 billion worldwide. The recipient of ...
https://python.langchain.com/docs/guides/debugging
4cecf0a7e954-25
"\n\tObservation:" ] } [llm/start] [1:RunTypeEnum.chain:AgentExecutor > 14:RunTypeEnum.chain:LLMChain > 15:RunTypeEnum.llm:ChatOpenAI] Entering LLM run with input: { "prompts": [ "Human: Answer the following questions as best you can. You have access to the following tools:\n\nduckduckgo_searc...
https://python.langchain.com/docs/guides/debugging
4cecf0a7e954-26
the mad scramble to build the first atomic bomb required rapid-fire filming, strict set rules and the construction of an entire 1940s western town. By Jada Yuan. July 19, 2023 at 5:00 a ... In Christopher Nolan's new film, \"Oppenheimer,\" Cillian Murphy stars as J. Robert Oppenheimer, the American physicist who oversa...
https://python.langchain.com/docs/guides/debugging
4cecf0a7e954-27
Academy Awards, five BAFTA Awards and six Golden Globe Awards. July 30, 1970 (age 52) London England Notable Works: \"Dunkirk\" \"Tenet\" \"The Prestige\" See all related content → Recent News Jul. 13, 2023, 11:11 AM ET (AP) Cillian Murphy, playing Oppenheimer, finally gets to lead a Christopher Nolan film July 11, 2...
https://python.langchain.com/docs/guides/debugging
4cecf0a7e954-28
"I now know the final answer\nFinal Answer: The director of the 2023 film Oppenheimer is Christopher Nolan and he is 52 years old. His age in days is approximately 18980 days.", "generation_info": { "finish_reason": "stop" }, "message": { "lc": 1, ...
https://python.langchain.com/docs/guides/debugging
4cecf0a7e954-29
} ] ], "llm_output": { "token_usage": { "prompt_tokens": 926, "completion_tokens": 43, "total_tokens": 969 }, "model_name": "gpt-4" }, "run": null } [chain/end] [1:RunTypeEnum.chain:AgentExecutor > 14:RunTypeEnum.chain:LLMChain] [3.52s] Ex...
https://python.langchain.com/docs/guides/debugging
4cecf0a7e954-30
outputs (like the token usage stats for an LLM call) so that you can focus on application logic.import langchainlangchain.verbose = Trueagent.run("Who directed the 2023 film Oppenheimer and what is their age? What is their age in days (assume 365 days per year)?")Console output > Entering new AgentExecutor ...
https://python.langchain.com/docs/guides/debugging
4cecf0a7e954-31
chain. First, I need to find out who directed the film Oppenheimer in 2023 and their birth date to calculate their age. Action: duckduckgo_search Action Input: "Director of the 2023 film Oppenheimer" Observation: Oppenheimer: Directed by Christopher Nolan. With Cillian Murphy, Emily Blunt, Robert Downey Jr....
https://python.langchain.com/docs/guides/debugging
4cecf0a7e954-32
the following questions as best you can. You have access to the following tools: duckduckgo_search: A wrapper around DuckDuckGo Search. Useful for when you need to answer questions about current events. Input should be a search query. Calculator: Useful for when you need to answer questions about math. ...
https://python.langchain.com/docs/guides/debugging
4cecf0a7e954-33
J. Robert ... 2023, 12:16 p.m. ET. ... including his role as the director of the Manhattan Engineer District, better ... J Robert Oppenheimer was the director of the secret Los Alamos Laboratory. It was established under US president Franklin D Roosevelt as part of the Manhattan Project to build the first atomic bomb. ...
https://python.langchain.com/docs/guides/debugging
4cecf0a7e954-34
is a British and American filmmaker. Known for his Hollywood blockbusters with complex storytelling, Nolan is considered a leading filmmaker of the 21st century. His films have grossed $5 billion worldwide. The recipient of many accolades, he has been nominated for five Academy Awards, five BAFTA Awards and six Golden ...
https://python.langchain.com/docs/guides/debugging
4cecf0a7e954-35
Input: the input to the action Observation: the result of the action ... (this Thought/Action/Action Input/Observation can repeat N times) Thought: I now know the final answer Final Answer: the final answer to the original input question Begin! Question: Who directed the 2023 film Oppenheimer ...
https://python.langchain.com/docs/guides/debugging
4cecf0a7e954-36
American physicist whose... Oppenheimer is a 2023 epic biographical thriller film written and directed by Christopher Nolan.It is based on the 2005 biography American Prometheus by Kai Bird and Martin J. Sherwin about J. Robert Oppenheimer, a theoretical physicist who was pivotal in developing the first nuclear weapons...
https://python.langchain.com/docs/guides/debugging
4cecf0a7e954-37
the release date, plot, trailers & more. July 2023 sees the release of Christopher Nolan's new film, Oppenheimer, his first movie since 2020's Tenet and his split from Warner Bros. Billed as an epic thriller about "the man who ... Thought: > Finished chain. Christopher Nolan was born on July 30, 1970. Now ...
https://python.langchain.com/docs/guides/debugging
4cecf0a7e954-38
Question: 37593^(1/5) ```text 37593**(1/5) ``` ...numexpr.evaluate("37593**(1/5)")... ```output 8.222831614237718 ``` Answer: 8.222831614237718 Question: (2023 - 1970) * 365 > Finished chain. ```text (2023 - 1970) * 365 ``` ...numexpr.evaluate("(2023 - 1970) * 365")...
https://python.langchain.com/docs/guides/debugging
4cecf0a7e954-39
... (this Thought/Action/Action Input/Observation can repeat N times) Thought: I now know the final answer Final Answer: the final answer to the original input question Begin! Question: Who directed the 2023 film Oppenheimer and what is their age? What is their age in days (assume 365 days per year)...
https://python.langchain.com/docs/guides/debugging
4cecf0a7e954-40
written and directed by Christopher Nolan.It is based on the 2005 biography American Prometheus by Kai Bird and Martin J. Sherwin about J. Robert Oppenheimer, a theoretical physicist who was pivotal in developing the first nuclear weapons as part of the Manhattan Project and thereby ushering in the Atomic Age. Thoug...
https://python.langchain.com/docs/guides/debugging
4cecf0a7e954-41
release of Christopher Nolan's new film, Oppenheimer, his first movie since 2020's Tenet and his split from Warner Bros. Billed as an epic thriller about "the man who ... Thought:Christopher Nolan was born on July 30, 1970. Now I need to calculate his age in 2023 and then convert it into days. Action: Calculator ...
https://python.langchain.com/docs/guides/debugging
4cecf0a7e954-42
chain... First, I need to find out who directed the film Oppenheimer in 2023 and their birth date. Then, I can calculate their age in years and days. Action: duckduckgo_search Action Input: "Director of 2023 film Oppenheimer" Observation: Oppenheimer: Directed by Christopher Nolan. With Cillian Murphy, Emil...
https://python.langchain.com/docs/guides/debugging
4cecf0a7e954-43
(age 52) London England Notable Works: "Dunkirk" "Tenet" "The Prestige" See all related content → Recent News Jul. 13, 2023, 11:11 AM ET (AP) Cillian Murphy, playing Oppenheimer, finally gets to lead a Christopher Nolan film Christopher Edward Nolan CBE (born 30 July 1970) is a British and American filmmaker. Known f...
https://python.langchain.com/docs/guides/debugging
4cecf0a7e954-44
in 2023. Now I need to calculate his age in days. Action: Calculator Action Input: {"operation": "multiply", "operands": [53, 365]} Observation: Answer: 19345 Thought:I now know the final answer Final Answer: The director of the 2023 film Oppenheimer is Christopher Nolan. He is 53 years old in 2023, whic...
https://python.langchain.com/docs/guides/debugging
df1641c00872-0
Evaluation | 🦜�🔗 Langchain
https://python.langchain.com/docs/guides/evaluation/
df1641c00872-1
Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/​OData connectionChainsMemoryAgentsCallbacksModulesGuidesEvaluationString EvaluatorsComparison EvaluatorsTrajectory EvaluatorsExamplesDebuggingDeploymentLangSmithMod...
https://python.langchain.com/docs/guides/evaluation/
df1641c00872-2
extensible API so you can create your own or contribute improvements for everyone to use. The following sections have example notebooks for you to get started.String Evaluators: Evaluate the predicted string for a given input, usually against a reference stringTrajectory Evaluators: Evaluate the whole trajectory of age...
https://python.langchain.com/docs/guides/evaluation/
bead2a9b7992-0
Examples | 🦜�🔗 Langchain
https://python.langchain.com/docs/guides/evaluation/examples/
bead2a9b7992-1
Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/​OData connectionChainsMemoryAgentsCallbacksModulesGuidesEvaluationString EvaluatorsComparison EvaluatorsTrajectory EvaluatorsExamplesAgent VectorDB Question Answeri...
https://python.langchain.com/docs/guides/evaluation/examples/
bead2a9b7992-2
Paul Graham EssayHere we go over how to benchmark performance on a question answering task over a Paul Graham essay.📄� Question Answering Benchmarking: State of the Union AddressHere we go over how to benchmark performance on a question answering task over a state of the union address.📄� QA GenerationThis not...
https://python.langchain.com/docs/guides/evaluation/examples/
8bb21c05bf23-0
Comparing Chain Outputs | 🦜�🔗 Langchain
https://python.langchain.com/docs/guides/evaluation/examples/comparisons
8bb21c05bf23-1
Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/​OData connectionChainsMemoryAgentsCallbacksModulesGuidesEvaluationString EvaluatorsComparison EvaluatorsTrajectory EvaluatorsExamplesAgent VectorDB Question Answeri...
https://python.langchain.com/docs/guides/evaluation/examples/comparisons
8bb21c05bf23-2
provide more reliable results. We will use some example queries someone might have about how to use langchain here.from langchain.evaluation.loading import load_datasetdataset = load_dataset("langchain-howto-queries") Found cached dataset parquet (/Users/wfh/.cache/huggingface/datasets/LangChainDatasets___parquet/La...
https://python.langchain.com/docs/guides/evaluation/examples/comparisons
8bb21c05bf23-3
when you need to answer questions about current events. You should ask targeted questions.", ),]functions_agent = initialize_agent( tools, llm, agent=AgentType.OPENAI_MULTI_FUNCTIONS, verbose=False)conversations_agent = initialize_agent( tools, llm, agent=AgentType.CHAT_ZERO_SHOT_REACT_DESCRIPTION, verbose=Fal...
https://python.langchain.com/docs/guides/evaluation/examples/comparisons
8bb21c05bf23-4
Retrying langchain.chat_models.openai.acompletion_with_retry.<locals>._completion_with_retry in 1.0 seconds as it raised ServiceUnavailableError: The server is overloaded or not ready yet..Step 5. Evaluate Pairs​Now it's time to evaluate the results. For each agent response, run the evaluation chain to select which o...
https://python.langchain.com/docs/guides/evaluation/examples/comparisons
8bb21c05bf23-5
) if eval_res["value"] == "A": preferences.append(a) elif eval_res["value"] == "B": preferences.append(b) else: preferences.append(None) # No preference return preferencespreferences = predict_preferences(dataset, results)Print out the ratio of preferences.from ...
https://python.langchain.com/docs/guides/evaluation/examples/comparisons
8bb21c05bf23-6
not be used. """ total_preferences = preferences.count("a") + preferences.count("b") n_s = preferences.count(which) if total_preferences == 0: return (0, 0) p_hat = n_s / total_preferences denominator = 1 + (z**2) / total_preferences adjustment = (z / denominator) * sqrt( p_hat * (1 -...
https://python.langchain.com/docs/guides/evaluation/examples/comparisons
8bb21c05bf23-7
import statspreferred_model = max(pref_ratios, key=pref_ratios.get)successes = preferences.count(preferred_model)n = len(preferences) - preferences.count(None)p_value = stats.binom_test(successes, n, p=0.5, alternative="two-sided")print( f"""The p-value is {p_value:.5f}. If the null hypothesis is true (i.e., if the ...
https://python.langchain.com/docs/guides/evaluation/examples/comparisons
cc9d25305ac3-0
Question Answering | 🦜�🔗 Langchain
https://python.langchain.com/docs/guides/evaluation/examples/question_answering
cc9d25305ac3-1
Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/​OData connectionChainsMemoryAgentsCallbacksModulesGuidesEvaluationString EvaluatorsComparison EvaluatorsTrajectory EvaluatorsExamplesAgent VectorDB Question Answeri...
https://python.langchain.com/docs/guides/evaluation/examples/question_answering
cc9d25305ac3-2
"question": "Roger has 5 tennis balls. He buys 2 more cans of tennis balls. Each can has 3 tennis balls. How many tennis balls does he have now?", "answer": "11", }, { "question": 'Is the following sentence plausible? "Joao Moutinho caught the screen pass in the NFC championship."', "answer":...
https://python.langchain.com/docs/guides/evaluation/examples/question_answering
cc9d25305ac3-3
print("Predicted Answer: " + predictions[i]["text"]) print("Predicted Grade: " + graded_outputs[i]["text"]) print() Example 0: Question: Roger has 5 tennis balls. He buys 2 more cans of tennis balls. Each can has 3 tennis balls. How many tennis balls does he have now? Real Answer: 11 Predicted Answer:...
https://python.langchain.com/docs/guides/evaluation/examples/question_answering
cc9d25305ac3-4
The custom prompt requires 3 input variables: "query", "answer" and "result". Where "query" is the question, "answer" is the ground truth answer, and "result" is the predicted answer.from langchain.prompts.prompt import PromptTemplate_PROMPT_TEMPLATE = """You are an expert professor specialized in grading students' ans...
https://python.langchain.com/docs/guides/evaluation/examples/question_answering
cc9d25305ac3-5
"NFC Championship Game 2023: Philadelphia Eagles 31, San Francisco 49ers 7", },]QA_PROMPT = "Answer the question based on the context\nContext:{context}\nQuestion:{question}\nAnswer:"template = PromptTemplate(input_variables=["context", "question"], template=QA_PROMPT)qa_chain = LLMChain(llm=llm, prompt=template)pr...
https://python.langchain.com/docs/guides/evaluation/examples/question_answering
cc9d25305ac3-6
load("squad")results = squad_metric.compute( references=new_examples, predictions=predictions,)results {'exact_match': 0.0, 'f1': 28.125}PreviousQA GenerationNextSQL Question Answering Benchmarking: ChinookSetupExamplesPredictionsEvaluationCustomize PromptEvaluation without Ground TruthComparing to other evalu...
https://python.langchain.com/docs/guides/evaluation/examples/question_answering
b30dca3cdcca-0
QA Generation | 🦜�🔗 Langchain Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/​OData connectionChainsMemoryAgentsCallbacksModulesGuidesEvaluationString EvaluatorsComparison EvaluatorsTrajectory Evalua...
https://python.langchain.com/docs/guides/evaluation/examples/qa_generation
5199c5f98d9d-0
SQL Question Answering Benchmarking: Chinook | 🦜�🔗 Langchain
https://python.langchain.com/docs/guides/evaluation/examples/sql_qa_benchmarking_chinook
5199c5f98d9d-1
Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/​OData connectionChainsMemoryAgentsCallbacksModulesGuidesEvaluationString EvaluatorsComparison EvaluatorsTrajectory EvaluatorsExamplesAgent VectorDB Question Answeri...
https://python.langchain.com/docs/guides/evaluation/examples/sql_qa_benchmarking_chinook
5199c5f98d9d-2
Downloading and preparing dataset json/LangChainDatasets--sql-qa-chinook to /Users/harrisonchase/.cache/huggingface/datasets/LangChainDatasets___json/LangChainDatasets--sql-qa-chinook-7528565d2d992b47/0.0.0/0f7e3662623656454fcd2b650f34e886a7db4b9104504885bd462096cc7a9f51... Downloading data files: 0%| | 0...
https://python.langchain.com/docs/guides/evaluation/examples/sql_qa_benchmarking_chinook
5199c5f98d9d-3
{'question': 'How many employees are there?', 'answer': '8'}Setting up a chain​This uses the example Chinook database.
https://python.langchain.com/docs/guides/evaluation/examples/sql_qa_benchmarking_chinook
5199c5f98d9d-4
To set it up follow the instructions on https://database.guide/2-sample-databases-sqlite/, placing the .db file in a notebooks folder at the root of this repository.Note that here we load a simple chain. If you want to experiment with more complex chains, or an agent, just create the chain object in a different way.fro...
https://python.langchain.com/docs/guides/evaluation/examples/sql_qa_benchmarking_chinook
5199c5f98d9d-5
= eval_chain.evaluate( predicted_dataset, predictions, question_key="question", prediction_key="result")We can add in the graded output to the predictions dict and then get a count of the grades.for i, prediction in enumerate(predictions): prediction["grade"] = graded_outputs[i]["text"]from collections import Cou...
https://python.langchain.com/docs/guides/evaluation/examples/sql_qa_benchmarking_chinook
cb216631aaa7-0
Data Augmented Question Answering | 🦜�🔗 Langchain
https://python.langchain.com/docs/guides/evaluation/examples/data_augmented_question_answering
cb216631aaa7-1
Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/​OData connectionChainsMemoryAgentsCallbacksModulesGuidesEvaluationString EvaluatorsComparison EvaluatorsTrajectory EvaluatorsExamplesAgent VectorDB Question Answeri...
https://python.langchain.com/docs/guides/evaluation/examples/data_augmented_question_answering
cb216631aaa7-2
using direct local API. Using DuckDB in-memory for database. Data will be transient.Examples​Now we need some examples to evaluate. We can do this in two ways:Hard code some examples ourselvesGenerate examples automatically, using a language model# Hard-coded examplesexamples = [ { "query": "What did the...
https://python.langchain.com/docs/guides/evaluation/examples/data_augmented_question_answering
cb216631aaa7-3
'The U.S. Department of Justice is assembling a dedicated task force to go after the crimes of Russian oligarchs and joining with European allies to find and seize their yachts, luxury apartments, and private jets.'}, {'query': 'How much direct assistance is the United States providing to Ukraine?', 'answer': ...
https://python.langchain.com/docs/guides/evaluation/examples/data_augmented_question_answering
cb216631aaa7-4
Order of Police to former judges appointed by both Democrats and Republicans. Predicted Grade: CORRECT Example 1: Question: What did the president say about Michael Jackson Real Answer: Nothing Predicted Answer: The president did not mention Michael Jackson in this speech. Predicted Grade: CORR...
https://python.langchain.com/docs/guides/evaluation/examples/data_augmented_question_answering
cb216631aaa7-5
Example 5: Question: What action is the U.S. Department of Justice taking to target Russian oligarchs? Real Answer: The U.S. Department of Justice is assembling a dedicated task force to go after the crimes of Russian oligarchs and joining with European allies to find and seize their yachts, luxury apartments, an...
https://python.langchain.com/docs/guides/evaluation/examples/data_augmented_question_answering
cb216631aaa7-6
(you can choose other metrics too):metrics = { "rouge": { "metric": "rouge", "config": {"variety": "rouge_l"}, }, "chrf": { "metric": "chrf", "config": {}, }, "bert_score": { "metric": "bert_score", "config": {"model": "bert-base-uncased"}, }, "uni_eval": {...
https://python.langchain.com/docs/guides/evaluation/examples/data_augmented_question_answering
cb216631aaa7-7
print("Real Answer: " + predictions[i]["answer"]) print("Predicted Answer: " + predictions[i]["result"]) print("Predicted Scores: " + score_string) print() Example 0: Question: What did the president say about Ketanji Brown Jackson Real Answer: He praised her legal ability and said he nominated her fo...
https://python.langchain.com/docs/guides/evaluation/examples/data_augmented_question_answering
cb216631aaa7-8
when he rolled into Ukraine. Predicted Scores: rouge=0.5185, chrf=0.6955, bert_score=0.8421, uni_eval=0.9578 Example 3: Question: Who is the Ukrainian Ambassador to the United States? Real Answer: The Ukrainian Ambassador to the United States is here tonight. Predicted Answer: I don't know. Predi...
https://python.langchain.com/docs/guides/evaluation/examples/data_augmented_question_answering
cb216631aaa7-9
and private jets. Predicted Answer: The U.S. Department of Justice is assembling a dedicated task force to go after the crimes of Russian oligarchs and to find and seize their yachts, luxury apartments, and private jets. Predicted Scores: rouge=0.9412, chrf=0.8687, bert_score=0.9607, uni_eval=0.9718 Examp...
https://python.langchain.com/docs/guides/evaluation/examples/data_augmented_question_answering
62decbd06b8a-0
Evaluating an OpenAPI Chain | 🦜�🔗 Langchain
https://python.langchain.com/docs/guides/evaluation/examples/openapi_eval
62decbd06b8a-1
Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/​OData connectionChainsMemoryAgentsCallbacksModulesGuidesEvaluationString EvaluatorsComparison EvaluatorsTrajectory EvaluatorsExamplesAgent VectorDB Question Answeri...
https://python.langchain.com/docs/guides/evaluation/examples/openapi_eval
62decbd06b8a-2
llm, requests=Requests(), verbose=verbose, return_intermediate_steps=True, # Return request and response text) Attempting to load an OpenAPI 3.0.1 spec. This may result in degraded performance. Convert your OpenAPI spec to 3.1.* spec for better support.Optional: Generate Input Questions and Request Ground...
https://python.langchain.com/docs/guides/evaluation/examples/openapi_eval
62decbd06b8a-3
= load_dataset("openapi-chain-klarna-products-get") Found cached dataset json (/Users/harrisonchase/.cache/huggingface/datasets/LangChainDatasets___json/LangChainDatasets--openapi-chain-klarna-products-get-5d03362007667626/0.0.0/0f7e3662623656454fcd2b650f34e886a7db4b9104504885bd462096cc7a9f51) 0%| | 0/...
https://python.langchain.com/docs/guides/evaluation/examples/openapi_eval
62decbd06b8a-4
I like Adidas and Nike.', 'expected_query': {'max_price': None, 'q': 'shoe'}}, {'question': 'I want to buy a new skirt', 'expected_query': {'max_price': None, 'q': 'skirt'}}, {'question': 'My company is asking me to get a professional Deskopt PC - money is no object.', 'expected_query': {'max_pri...
https://python.langchain.com/docs/guides/evaluation/examples/openapi_eval
62decbd06b8a-5
Apple iPhone 14 Pro 128GB, Apple iPhone 14 Pro 256GB, Apple iPhone 14 Pro Max 128GB, Apple iPhone 13 Pro Max 128GB, Apple iPhone 14 128GB, Apple iPhone 12 Pro 512GB, and Apple iPhone 12 mini 64GB.', 'Yes, there are several budget laptops in the API response. For example, the HP 14-dq0055dx and HP 15-dw0083wm are bo...
https://python.langchain.com/docs/guides/evaluation/examples/openapi_eval
62decbd06b8a-6
M1 Pro 8C CPU 14C GPU 16GB 512GB SSD 14", Apple MacBook Pro (2022) M2 OC 10C GPU 8GB 256GB SSD 13.3", Apple MacBook Air (2022) M2 OC 8C GPU 8GB 256GB SSD 13.6", and Apple MacBook Pro (2023) M2 Pro OC 16C GPU 16GB 512GB SSD 14.2".', "I found several Nike and Adidas shoes in the API response. Here are the links to th...
https://python.langchain.com/docs/guides/evaluation/examples/openapi_eval
62decbd06b8a-7
Nike Air Jordan 1 Retro High M - White/University Blue/Black: https://www.klarna.com/us/shopping/pl/cl337/3200383658/Shoes/Nike-Air-Jordan-1-Retro-High-M-White-University-Blue-Black/?utm_source=openai&ref-site=openai_plugin, Nike Air Jordan 1 Retro High OG M - True Blue/Cement Grey/White: https://www.klarna.com/us/shop...
https://python.langchain.com/docs/guides/evaluation/examples/openapi_eval
62decbd06b8a-8
"I found several skirts that may interest you. Please take a look at the following products: Avenue Plus Size Denim Stretch Skirt, LoveShackFancy Ruffled Mini Skirt - Antique White, Nike Dri-Fit Club Golf Skirt - Active Pink, Skims Soft Lounge Ruched Long Skirt, French Toast Girl's Front Pleated Skirt with Tabs, Alexia...
https://python.langchain.com/docs/guides/evaluation/examples/openapi_eval
62decbd06b8a-9
langchain.prompts import PromptTemplatetemplate = """You are trying to answer the following question by querying an API:> Question: {question}The query you know you should be executing against the API is:> Query: {truth_query}Is the following predicted query semantically the same (eg likely to produce the same answer)?...
https://python.langchain.com/docs/guides/evaluation/examples/openapi_eval
62decbd06b8a-10
original query and is not likely to produce the same answer. Final Grade: D', ' The original query is asking for laptops with a maximum price of 300. The predicted query is asking for laptops with a minimum price of 0 and a maximum price of 500. This means that the predicted query is likely to return more results t...
https://python.langchain.com/docs/guides/evaluation/examples/openapi_eval
62decbd06b8a-11
which is not specified in the original query. Therefore, the predicted query is not semantically the same as the original query. Final Grade: F', " The original query is asking for the top rated laptops, so the 'size' parameter should be set to 10 to get the top 10 results. The 'min_price' parameter should be set t...
https://python.langchain.com/docs/guides/evaluation/examples/openapi_eval
62decbd06b8a-12
is not relevant to the original query. The third part of the query is asking for a minimum price of 0, which is not relevant to the original query. The fourth part of the query is asking for a maximum price of null, which is not relevant to the original query. Therefore, the Predicted Query does not semantically match ...
https://python.langchain.com/docs/guides/evaluation/examples/openapi_eval
62decbd06b8a-13
Evaluate this against the user's original question.from langchain.prompts import PromptTemplatetemplate = """You are trying to answer the following question by querying an API:> Question: {question}The API returned a response of:> API result: {api_response}Your response to the user: {answer}Please evaluate the accuracy...
https://python.langchain.com/docs/guides/evaluation/examples/openapi_eval
62decbd06b8a-14
predicted query is not semantically the same as the original query and is not likely to produce the same answer. Final Grade: D', ' The original query is asking for laptops with a maximum price of 300. The predicted query is asking for laptops with a minimum price of 0 and a maximum price of 500. This means that th...
https://python.langchain.com/docs/guides/evaluation/examples/openapi_eval
62decbd06b8a-15
The predicted query also has a size of 10, which is not specified in the original query. Therefore, the predicted query is not semantically the same as the original query. Final Grade: F', " The original query is asking for the top rated laptops, so the 'size' parameter should be set to 10 to get the top 10 results...
https://python.langchain.com/docs/guides/evaluation/examples/openapi_eval
62decbd06b8a-16
query is asking for a size of 10, which is not relevant to the original query. The third part of the query is asking for a minimum price of 0, which is not relevant to the original query. The fourth part of the query is asking for a maximum price of null, which is not relevant to the original query. Therefore, the Pred...
https://python.langchain.com/docs/guides/evaluation/examples/openapi_eval
End of preview. Expand in Data Studio
README.md exists but content is empty.
Downloads last month
10