id
stringlengths
14
16
text
stringlengths
36
2.73k
source
stringlengths
49
117
d6a7b8f21916-0
.ipynb .pdf PowerBI Dataset Agent Contents Some notes Initialization Example: describing a table Example: simple query on a table Example: running queries Example: add your own few-shot prompts PowerBI Dataset Agent# This notebook showcases an agent designed to interact with a Power BI Dataset. The agent is designed ...
https://python.langchain.com/en/latest/modules/agents/toolkits/examples/powerbi.html
d6a7b8f21916-1
toolkit = PowerBIToolkit( powerbi=PowerBIDataset(dataset_id="<dataset_id>", table_names=['table1', 'table2'], credential=DefaultAzureCredential()), llm=smart_llm ) agent_executor = create_pbi_agent( llm=fast_llm, toolkit=toolkit, verbose=True, ) Example: describing a table# agent_executor.run("Desc...
https://python.langchain.com/en/latest/modules/agents/toolkits/examples/powerbi.html
d6a7b8f21916-2
examples=few_shots, ) agent_executor = create_pbi_agent( llm=fast_llm, toolkit=toolkit, verbose=True, ) agent_executor.run("What was the maximum of value in revenue in dollars in 2022?") previous PlayWright Browser Toolkit next Python Agent Contents Some notes Initialization Example: describing a table ...
https://python.langchain.com/en/latest/modules/agents/toolkits/examples/powerbi.html
6eba9fb38cb2-0
.ipynb .pdf Jira Jira# This notebook goes over how to use the Jira tool. The Jira tool allows agents to interact with a given Jira instance, performing actions such as searching for issues and creating issues, the tool wraps the atlassian-python-api library, for more see: https://atlassian-python-api.readthedocs.io/jir...
https://python.langchain.com/en/latest/modules/agents/toolkits/examples/jira.html
6eba9fb38cb2-1
Observation: None Thought: I now know the final answer Final Answer: A new issue has been created in project PW with the summary "Make more fried rice" and description "Reminder to make more fried rice". > Finished chain. 'A new issue has been created in project PW with the summary "Make more fried rice" and descriptio...
https://python.langchain.com/en/latest/modules/agents/toolkits/examples/jira.html
ef1a087fbcad-0
.ipynb .pdf CSV Agent Contents Multi CSV Example CSV Agent# This notebook shows how to use agents to interact with a csv. It is mostly optimized for question answering. NOTE: this agent calls the Pandas DataFrame agent under the hood, which in turn calls the Python agent, which executes LLM generated Python code - th...
https://python.langchain.com/en/latest/modules/agents/toolkits/examples/csv.html
ef1a087fbcad-1
Observation: 29.69911764705882 Thought: I now need to calculate the square root of the average age Action: python_repl_ast Action Input: math.sqrt(df['Age'].mean()) Observation: NameError("name 'math' is not defined") Thought: I need to import the math library Action: python_repl_ast Action Input: import math Observati...
https://python.langchain.com/en/latest/modules/agents/toolkits/examples/csv.html
905935781392-0
.ipynb .pdf SQL Database Agent Contents Initialization Example: describing a table Example: describing a table, recovering from an error Example: running queries Recovering from an error SQL Database Agent# This notebook showcases an agent designed to interact with a sql databases. The agent builds off of SQLDatabase...
https://python.langchain.com/en/latest/modules/agents/toolkits/examples/sql_database.html
905935781392-1
Action: schema_sql_db Action Input: "PlaylistTrack" Observation: CREATE TABLE "PlaylistTrack" ( "PlaylistId" INTEGER NOT NULL, "TrackId" INTEGER NOT NULL, PRIMARY KEY ("PlaylistId", "TrackId"), FOREIGN KEY("TrackId") REFERENCES "Track" ("TrackId"), FOREIGN KEY("PlaylistId") REFERENCES "Playlist" ("PlaylistId"...
https://python.langchain.com/en/latest/modules/agents/toolkits/examples/sql_database.html
905935781392-2
Thought: The table is called PlaylistTrack Action: schema_sql_db Action Input: "PlaylistTrack" Observation: CREATE TABLE "PlaylistTrack" ( "PlaylistId" INTEGER NOT NULL, "TrackId" INTEGER NOT NULL, PRIMARY KEY ("PlaylistId", "TrackId"), FOREIGN KEY("TrackId") REFERENCES "Track" ("TrackId"), FOREIGN KEY("Playl...
https://python.langchain.com/en/latest/modules/agents/toolkits/examples/sql_database.html
905935781392-3
"Address" NVARCHAR(70), "City" NVARCHAR(40), "State" NVARCHAR(40), "Country" NVARCHAR(40), "PostalCode" NVARCHAR(10), "Phone" NVARCHAR(24), "Fax" NVARCHAR(24), "Email" NVARCHAR(60) NOT NULL, "SupportRepId" INTEGER, PRIMARY KEY ("CustomerId"), FOREIGN KEY("SupportRepId") REFERENCES "Employee" ("Emplo...
https://python.langchain.com/en/latest/modules/agents/toolkits/examples/sql_database.html
905935781392-4
"BillingCity" NVARCHAR(40), "BillingState" NVARCHAR(40), "BillingCountry" NVARCHAR(40), "BillingPostalCode" NVARCHAR(10), "Total" NUMERIC(10, 2) NOT NULL, PRIMARY KEY ("InvoiceId"), FOREIGN KEY("CustomerId") REFERENCES "Customer" ("CustomerId") ) SELECT * FROM 'Invoice' LIMIT 3; InvoiceId CustomerId Invoice...
https://python.langchain.com/en/latest/modules/agents/toolkits/examples/sql_database.html
905935781392-5
Observation: [('USA', 523.0600000000003), ('Canada', 303.9599999999999), ('France', 195.09999999999994), ('Brazil', 190.09999999999997), ('Germany', 156.48), ('United Kingdom', 112.85999999999999), ('Czech Republic', 90.24000000000001), ('Portugal', 77.23999999999998), ('India', 75.25999999999999), ('Chile', 46.62)] Th...
https://python.langchain.com/en/latest/modules/agents/toolkits/examples/sql_database.html
905935781392-6
"TrackId" INTEGER NOT NULL, PRIMARY KEY ("PlaylistId", "TrackId"), FOREIGN KEY("TrackId") REFERENCES "Track" ("TrackId"), FOREIGN KEY("PlaylistId") REFERENCES "Playlist" ("PlaylistId") ) SELECT * FROM 'PlaylistTrack' LIMIT 3; PlaylistId TrackId 1 3402 1 3389 1 3390 Thought: I can use a SELECT statement to get the...
https://python.langchain.com/en/latest/modules/agents/toolkits/examples/sql_database.html
905935781392-7
Thought: I now know the final answer. Final Answer: The total number of tracks in each playlist are: '90’s Music' (1477), 'Brazilian Music' (39), 'Classical' (75), 'Classical 101 - Deep Cuts' (25), 'Classical 101 - Next Steps' (25), 'Classical 101 - The Basics' (25), 'Grunge' (15), 'Heavy Metal Classic' (26), 'Music' (...
https://python.langchain.com/en/latest/modules/agents/toolkits/examples/sql_database.html
905935781392-8
CREATE TABLE "Artist" ( "ArtistId" INTEGER NOT NULL, "Name" NVARCHAR(120), PRIMARY KEY ("ArtistId") ) SELECT * FROM 'Artist' LIMIT 3; ArtistId Name 1 AC/DC 2 Accept 3 Aerosmith CREATE TABLE "Track" ( "TrackId" INTEGER NOT NULL, "Name" NVARCHAR(200) NOT NULL, "AlbumId" INTEGER, "MediaTypeId" INTEGER NOT NULL...
https://python.langchain.com/en/latest/modules/agents/toolkits/examples/sql_database.html
905935781392-9
"InvoiceId" INTEGER NOT NULL, "TrackId" INTEGER NOT NULL, "UnitPrice" NUMERIC(10, 2) NOT NULL, "Quantity" INTEGER NOT NULL, PRIMARY KEY ("InvoiceLineId"), FOREIGN KEY("TrackId") REFERENCES "Track" ("TrackId"), FOREIGN KEY("InvoiceId") REFERENCES "Invoice" ("InvoiceId") ) SELECT * FROM 'InvoiceLine' LIMIT 3;...
https://python.langchain.com/en/latest/modules/agents/toolkits/examples/sql_database.html
905935781392-10
Thought: I should double check my query before executing it. Action: query_checker_sql_db Action Input: SELECT Artist.Name, SUM(InvoiceLine.Quantity) AS TotalQuantity FROM Artist INNER JOIN Track ON Artist.ArtistId = Track.ArtistId INNER JOIN InvoiceLine ON Track.TrackId = InvoiceLine.TrackId GROUP BY Artist.Name ORDER...
https://python.langchain.com/en/latest/modules/agents/toolkits/examples/sql_database.html
d6d4354f83fb-0
.ipynb .pdf Natural Language APIs Contents First, import dependencies and load the LLM Next, load the Natural Language API Toolkits Create the Agent Using Auth + Adding more Endpoints Thank you! Natural Language APIs# Natural Language API Toolkits (NLAToolkits) permit LangChain Agents to efficiently plan and combine ...
https://python.langchain.com/en/latest/modules/agents/toolkits/examples/openapi_nla.html
d6d4354f83fb-1
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. 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. Create the Agent# # Slightly twe...
https://python.langchain.com/en/latest/modules/agents/toolkits/examples/openapi_nla.html
d6d4354f83fb-2
Action: Open_AI_Klarna_product_Api.productsUsingGET Action Input: Italian clothes Observation: The API response contains two products from the Alé brand in Italian Blue. The first is the Alé Colour Block Short Sleeve Jersey Men - Italian Blue, which costs $86.49, and the second is the Alé Dolid Flash Jersey Men - Itali...
https://python.langchain.com/en/latest/modules/agents/toolkits/examples/openapi_nla.html
d6d4354f83fb-3
llm, "https://spoonacular.com/application/frontend/downloads/spoonacular-openapi-3.json", requests=requests, max_text_length=1800, # If you want to truncate the response text ) Attempting to load an OpenAPI 3.0.0 spec. This may result in degraded performance. Convert your OpenAPI spec to 3.1.* spec for be...
https://python.langchain.com/en/latest/modules/agents/toolkits/examples/openapi_nla.html
d6d4354f83fb-4
Unsupported APIPropertyLocation "header" for parameter Accept. Valid values are ['path', 'query'] Ignoring optional parameter Unsupported APIPropertyLocation "header" for parameter Content-Type. Valid values are ['path', 'query'] Ignoring optional parameter Unsupported APIPropertyLocation "header" for parameter Accept....
https://python.langchain.com/en/latest/modules/agents/toolkits/examples/openapi_nla.html
d6d4354f83fb-5
Action: spoonacular_API.searchRecipes Action Input: Italian Observation: The API response contains 10 Italian recipes, including Turkey Tomato Cheese Pizza, Broccolini Quinoa Pilaf, Bruschetta Style Pork & Pasta, Salmon Quinoa Risotto, Italian Tuna Pasta, Roasted Brussels Sprouts With Garlic, Asparagus Lemon Risotto, I...
https://python.langchain.com/en/latest/modules/agents/toolkits/examples/openapi_nla.html
d6d4354f83fb-6
> Finished chain. 'To present for your Italian language class, you could wear an Italian Gold Sparkle Perfectina Necklace - Gold, an Italian Design Miami Cuban Link Chain Necklace - Gold, or an Italian Gold Miami Cuban Link Chain Necklace - Gold. For a recipe, you could make Turkey Tomato Cheese Pizza, Broccolini Quino...
https://python.langchain.com/en/latest/modules/agents/toolkits/examples/openapi_nla.html
d122d7c39e91-0
.ipynb .pdf Spark Dataframe Agent Contents Spark Connect Example Spark Dataframe Agent# This notebook shows how to use agents to interact with a Spark dataframe and Spark Connect. It is mostly optimized for question answering. NOTE: this agent calls the Python agent under the hood, which executes LLM generated Python...
https://python.langchain.com/en/latest/modules/agents/toolkits/examples/spark.html
d122d7c39e91-1
+-----------+--------+------+--------------------+------+----+-----+-----+----------------+-------+-----+--------+ | 1| 0| 3|Braund, Mr. Owen ...| male|22.0| 1| 0| A/5 21171| 7.25| null| S| | 2| 1| 1|Cumings, Mrs. Joh...|female|38.0| 1| 0| PC 17599...
https://python.langchain.com/en/latest/modules/agents/toolkits/examples/spark.html
d122d7c39e91-2
| 7| 0| 1|McCarthy, Mr. Tim...| male|54.0| 0| 0| 17463|51.8625| E46| S| | 8| 0| 3|Palsson, Master. ...| male| 2.0| 3| 1| 349909| 21.075| null| S| | 9| 1| 3|Johnson, Mrs. Osc...|female|27.0| 0| 2| 347742...
https://python.langchain.com/en/latest/modules/agents/toolkits/examples/spark.html
d122d7c39e91-3
| 14| 0| 3|Andersson, Mr. An...| male|39.0| 1| 5| 347082| 31.275| null| S| | 15| 0| 3|Vestrom, Miss. Hu...|female|14.0| 0| 0| 350406| 7.8542| null| S| | 16| 1| 2|Hewlett, Mrs. (Ma...|female|55.0| 0| 0| 248706...
https://python.langchain.com/en/latest/modules/agents/toolkits/examples/spark.html
d122d7c39e91-4
only showing top 20 rows agent = create_spark_dataframe_agent(llm=OpenAI(temperature=0), df=df, verbose=True) agent.run("how many rows are there?") > Entering new AgentExecutor chain... Thought: I need to find out how many rows are in the dataframe Action: python_repl_ast Action Input: df.count() Observation: 891 Thoug...
https://python.langchain.com/en/latest/modules/agents/toolkits/examples/spark.html
d122d7c39e91-5
Thought: I now have the math library imported, I can get the square root Action: python_repl_ast Action Input: math.sqrt(29.69911764705882) Observation: 5.449689683556195 Thought: I now know the final answer Final Answer: 5.449689683556195 > Finished chain. '5.449689683556195' spark.stop() Spark Connect Example# # in a...
https://python.langchain.com/en/latest/modules/agents/toolkits/examples/spark.html
d122d7c39e91-6
df = spark.read.csv(csv_file_path, header=True, inferSchema=True) df.show() +-----------+--------+------+--------------------+------+----+-----+-----+----------------+-------+-----+--------+ |PassengerId|Survived|Pclass| Name| Sex| Age|SibSp|Parch| Ticket| Fare|Cabin|Embarked| +-----------+-...
https://python.langchain.com/en/latest/modules/agents/toolkits/examples/spark.html
d122d7c39e91-7
| 6| 0| 3| Moran, Mr. James| male|null| 0| 0| 330877| 8.4583| null| Q| | 7| 0| 1|McCarthy, Mr. Tim...| male|54.0| 0| 0| 17463|51.8625| E46| S| | 8| 0| 3|Palsson, Master. ...| male| 2.0| 3| 1| 349909...
https://python.langchain.com/en/latest/modules/agents/toolkits/examples/spark.html
d122d7c39e91-8
| 13| 0| 3|Saundercock, Mr. ...| male|20.0| 0| 0| A/5. 2151| 8.05| null| S| | 14| 0| 3|Andersson, Mr. An...| male|39.0| 1| 5| 347082| 31.275| null| S| | 15| 0| 3|Vestrom, Miss. Hu...|female|14.0| 0| 0| 350406...
https://python.langchain.com/en/latest/modules/agents/toolkits/examples/spark.html
d122d7c39e91-9
| 20| 1| 3|Masselmani, Mrs. ...|female|null| 0| 0| 2649| 7.225| null| C| +-----------+--------+------+--------------------+------+----+-----+-----+----------------+-------+-----+--------+ only showing top 20 rows from langchain.agents import create_spark_dataframe_agent from la...
https://python.langchain.com/en/latest/modules/agents/toolkits/examples/spark.html
cacf44602513-0
.ipynb .pdf How to add SharedMemory to an Agent and its Tools How to add SharedMemory to an Agent and its Tools# This notebook goes over adding memory to both of an Agent and its tools. Before going through this notebook, please walk through the following notebooks, as this will build on top of both of them: Adding mem...
https://python.langchain.com/en/latest/modules/agents/agent_executors/examples/sharedmemory_for_tools.html
cacf44602513-1
Tool( name = "Summary", func=summry_chain.run, description="useful for when you summarize a conversation. The input to this tool should be a string, representing who will read this summary." ) ] prefix = """Have a conversation with a human, answering the following questions as best you can. ...
https://python.langchain.com/en/latest/modules/agents/agent_executors/examples/sharedmemory_for_tools.html
cacf44602513-2
Action: Search Action Input: "ChatGPT" Observation: Nov 30, 2022 ... We've trained a model called ChatGPT which interacts in a conversational way. The dialogue format makes it possible for ChatGPT to answer ... ChatGPT is an artificial intelligence chatbot developed by OpenAI and launched in November 2022. It is built ...
https://python.langchain.com/en/latest/modules/agents/agent_executors/examples/sharedmemory_for_tools.html
cacf44602513-3
Thought: I now know the final answer. Final Answer: ChatGPT is an artificial intelligence chatbot developed by OpenAI and launched in November 2022. It is built on top of OpenAI's GPT-3 family of large language models and is optimized for dialogue by using Reinforcement Learning with Human-in-the-Loop. It is also capab...
https://python.langchain.com/en/latest/modules/agents/agent_executors/examples/sharedmemory_for_tools.html
cacf44602513-4
Action Input: Who developed ChatGPT Observation: ChatGPT is an artificial intelligence chatbot developed by OpenAI and launched in November 2022. It is built on top of OpenAI's GPT-3 family of large ... Feb 15, 2023 ... Who owns Chat GPT? Chat GPT is owned and developed by AI research and deployment company, OpenAI. Th...
https://python.langchain.com/en/latest/modules/agents/agent_executors/examples/sharedmemory_for_tools.html
cacf44602513-5
Thought: I now know the final answer Final Answer: ChatGPT was developed by OpenAI. > Finished chain. 'ChatGPT was developed by OpenAI.' agent_chain.run(input="Thanks. Summarize the conversation, for my daughter 5 years old.") > Entering new AgentExecutor chain... Thought: I need to simplify the conversation for a 5 ye...
https://python.langchain.com/en/latest/modules/agents/agent_executors/examples/sharedmemory_for_tools.html
cacf44602513-6
print(agent_chain.memory.buffer) Human: What is ChatGPT? AI: ChatGPT is an artificial intelligence chatbot developed by OpenAI and launched in November 2022. It is built on top of OpenAI's GPT-3 family of large language models and is optimized for dialogue by using Reinforcement Learning with Human-in-the-Loop. It is a...
https://python.langchain.com/en/latest/modules/agents/agent_executors/examples/sharedmemory_for_tools.html
cacf44602513-7
Tool( name = "Summary", func=summry_chain.run, description="useful for when you summarize a conversation. The input to this tool should be a string, representing who will read this summary." ) ] prefix = """Have a conversation with a human, answering the following questions as best you can. ...
https://python.langchain.com/en/latest/modules/agents/agent_executors/examples/sharedmemory_for_tools.html
cacf44602513-8
Action: Search Action Input: "ChatGPT" Observation: Nov 30, 2022 ... We've trained a model called ChatGPT which interacts in a conversational way. The dialogue format makes it possible for ChatGPT to answer ... ChatGPT is an artificial intelligence chatbot developed by OpenAI and launched in November 2022. It is built ...
https://python.langchain.com/en/latest/modules/agents/agent_executors/examples/sharedmemory_for_tools.html
cacf44602513-9
Thought: I now know the final answer. Final Answer: ChatGPT is an artificial intelligence chatbot developed by OpenAI and launched in November 2022. It is built on top of OpenAI's GPT-3 family of large language models and is optimized for dialogue by using Reinforcement Learning with Human-in-the-Loop. It is also capab...
https://python.langchain.com/en/latest/modules/agents/agent_executors/examples/sharedmemory_for_tools.html
cacf44602513-10
Action Input: Who developed ChatGPT Observation: ChatGPT is an artificial intelligence chatbot developed by OpenAI and launched in November 2022. It is built on top of OpenAI's GPT-3 family of large ... Feb 15, 2023 ... Who owns Chat GPT? Chat GPT is owned and developed by AI research and deployment company, OpenAI. Th...
https://python.langchain.com/en/latest/modules/agents/agent_executors/examples/sharedmemory_for_tools.html
cacf44602513-11
Thought: I now know the final answer Final Answer: ChatGPT was developed by OpenAI. > Finished chain. 'ChatGPT was developed by OpenAI.' agent_chain.run(input="Thanks. Summarize the conversation, for my daughter 5 years old.") > Entering new AgentExecutor chain... Thought: I need to simplify the conversation for a 5 ye...
https://python.langchain.com/en/latest/modules/agents/agent_executors/examples/sharedmemory_for_tools.html
cacf44602513-12
print(agent_chain.memory.buffer) Human: What is ChatGPT? AI: ChatGPT is an artificial intelligence chatbot developed by OpenAI and launched in November 2022. It is built on top of OpenAI's GPT-3 family of large language models and is optimized for dialogue by using Reinforcement Learning with Human-in-the-Loop. It is a...
https://python.langchain.com/en/latest/modules/agents/agent_executors/examples/sharedmemory_for_tools.html
f16ab044f37a-0
.ipynb .pdf How to create ChatGPT Clone How to create ChatGPT Clone# This chain replicates ChatGPT by combining (1) a specific prompt, and (2) the concept of memory. Shows off the example as in https://www.engraved.blog/building-a-virtual-machine-inside/ from langchain import OpenAI, ConversationChain, LLMChain, Prompt...
https://python.langchain.com/en/latest/modules/agents/agent_executors/examples/chatgpt_clone.html
f16ab044f37a-1
llm=OpenAI(temperature=0), prompt=prompt, verbose=True, memory=ConversationBufferWindowMemory(k=2), ) output = chatgpt_chain.predict(human_input="I want you to act as a Linux terminal. I will type commands and you will reply with what the terminal should show. I want you to only reply with the terminal o...
https://python.langchain.com/en/latest/modules/agents/agent_executors/examples/chatgpt_clone.html
f16ab044f37a-2
Human: I want you to act as a Linux terminal. I will type commands and you will reply with what the terminal should show. I want you to only reply with the terminal output inside one unique code block, and nothing else. Do not write explanations. Do not type commands unless I instruct you to do so. When I need to tell ...
https://python.langchain.com/en/latest/modules/agents/agent_executors/examples/chatgpt_clone.html
f16ab044f37a-3
Human: I want you to act as a Linux terminal. I will type commands and you will reply with what the terminal should show. I want you to only reply with the terminal output inside one unique code block, and nothing else. Do not write explanations. Do not type commands unless I instruct you to do so. When I need to tell ...
https://python.langchain.com/en/latest/modules/agents/agent_executors/examples/chatgpt_clone.html
f16ab044f37a-4
Overall, Assistant is a powerful tool that can help with a wide range of tasks and provide valuable insights and information on a wide range of topics. Whether you need help with a specific question or just want to have a conversation about a particular topic, Assistant is here to assist. Human: I want you to act as a ...
https://python.langchain.com/en/latest/modules/agents/agent_executors/examples/chatgpt_clone.html
f16ab044f37a-5
Assistant is constantly learning and improving, and its capabilities are constantly evolving. It is able to process and understand large amounts of text, and can use this knowledge to provide accurate and informative responses to a wide range of questions. Additionally, Assistant is able to generate its own text based ...
https://python.langchain.com/en/latest/modules/agents/agent_executors/examples/chatgpt_clone.html
f16ab044f37a-6
Prompt after formatting: Assistant is a large language model trained by OpenAI. Assistant is designed to be able to assist with a wide range of tasks, from answering simple questions to providing in-depth explanations and discussions on a wide range of topics. As a language model, Assistant is able to generate human-li...
https://python.langchain.com/en/latest/modules/agents/agent_executors/examples/chatgpt_clone.html
f16ab044f37a-7
Assistant: > Finished LLMChain chain. ``` $ echo -e "x=lambda y:y*5+3;print('Result:' + str(x(6)))" > run.py $ python3 run.py Result: 33 ``` output = chatgpt_chain.predict(human_input="""echo -e "print(list(filter(lambda x: all(x%d for d in range(2,x)),range(2,3**10)))[:10])" > run.py && python3 run.py""") print(output...
https://python.langchain.com/en/latest/modules/agents/agent_executors/examples/chatgpt_clone.html
f16ab044f37a-8
AI: ``` $ touch jokes.txt $ echo "Why did the chicken cross the road? To get to the other side!" >> jokes.txt $ echo "What did the fish say when it hit the wall? Dam!" >> jokes.txt $ echo "Why did the scarecrow win the Nobel Prize? Because he was outstanding in his field!" >> jokes.txt ``` Human: echo -e "x=lambda y:y...
https://python.langchain.com/en/latest/modules/agents/agent_executors/examples/chatgpt_clone.html
f16ab044f37a-9
print(output) > Entering new LLMChain chain... Prompt after formatting: Assistant is a large language model trained by OpenAI. Assistant is designed to be able to assist with a wide range of tasks, from answering simple questions to providing in-depth explanations and discussions on a wide range of topics. As a languag...
https://python.langchain.com/en/latest/modules/agents/agent_executors/examples/chatgpt_clone.html
f16ab044f37a-10
AI: ``` $ echo -e "print(list(filter(lambda x: all(x%d for d in range(2,x)),range(2,3**10)))[:10])" > run.py $ python3 run.py [2, 3, 5, 7, 11, 13, 17, 19, 23, 29] ``` Human: echo -e "echo 'Hello from Docker" > entrypoint.sh && echo -e "FROM ubuntu:20.04 COPY entrypoint.sh entrypoint.sh ENTRYPOINT ["/bin/sh","entrypoin...
https://python.langchain.com/en/latest/modules/agents/agent_executors/examples/chatgpt_clone.html
f16ab044f37a-11
Assistant is constantly learning and improving, and its capabilities are constantly evolving. It is able to process and understand large amounts of text, and can use this knowledge to provide accurate and informative responses to a wide range of questions. Additionally, Assistant is able to generate its own text based ...
https://python.langchain.com/en/latest/modules/agents/agent_executors/examples/chatgpt_clone.html
f16ab044f37a-12
ENTRYPOINT ["/bin/sh","entrypoint.sh"]">Dockerfile $ docker build . -t my_docker_image $ docker run -t my_docker_image Hello from Docker ``` Human: nvidia-smi Assistant: > Finished LLMChain chain. ``` $ nvidia-smi Sat May 15 21:45:02 2021 +-------------------------------------------------------------------------...
https://python.langchain.com/en/latest/modules/agents/agent_executors/examples/chatgpt_clone.html
f16ab044f37a-13
Prompt after formatting: Assistant is a large language model trained by OpenAI. Assistant is designed to be able to assist with a wide range of tasks, from answering simple questions to providing in-depth explanations and discussions on a wide range of topics. As a language model, Assistant is able to generate human-li...
https://python.langchain.com/en/latest/modules/agents/agent_executors/examples/chatgpt_clone.html
f16ab044f37a-14
Hello from Docker ``` Human: nvidia-smi AI: ``` $ nvidia-smi Sat May 15 21:45:02 2021 +-----------------------------------------------------------------------------+ | NVIDIA-SMI 460.32.03 Driver Version: 460.32.03 CUDA Version: 11.2 | |-------------------------------+----------------------+----------...
https://python.langchain.com/en/latest/modules/agents/agent_executors/examples/chatgpt_clone.html
f16ab044f37a-15
--- bbc.com ping statistics --- 3 packets transmitted, 3 packets received, 0.0% packet loss round-trip min/avg/max/stddev = 14.945/14.945/14.945/0.000 ms ``` output = chatgpt_chain.predict(human_input="""curl -fsSL "https://api.github.com/repos/pytorch/pytorch/releases/latest" | jq -r '.tag_name' | sed 's/[^0-9\.\-]*//...
https://python.langchain.com/en/latest/modules/agents/agent_executors/examples/chatgpt_clone.html
f16ab044f37a-16
Sat May 15 21:45:02 2021 +-----------------------------------------------------------------------------+ | NVIDIA-SMI 460.32.03 Driver Version: 460.32.03 CUDA Version: 11.2 | |-------------------------------+----------------------+----------------------+ | GPU Name Persistence-M| Bus-Id ...
https://python.langchain.com/en/latest/modules/agents/agent_executors/examples/chatgpt_clone.html
f16ab044f37a-17
``` Human: curl -fsSL "https://api.github.com/repos/pytorch/pytorch/releases/latest" | jq -r '.tag_name' | sed 's/[^0-9\.\-]*//g' Assistant: > Finished LLMChain chain. ``` $ curl -fsSL "https://api.github.com/repos/pytorch/pytorch/releases/latest" | jq -r '.tag_name' | sed 's/[^0-9\.\-]*//g' 1.8.1 ``` output = chatgpt_...
https://python.langchain.com/en/latest/modules/agents/agent_executors/examples/chatgpt_clone.html
f16ab044f37a-18
Human: ping bbc.com AI: ``` $ ping bbc.com PING bbc.com (151.101.65.81): 56 data bytes 64 bytes from 151.101.65.81: icmp_seq=0 ttl=53 time=14.945 ms 64 bytes from 151.101.65.81: icmp_seq=1 ttl=53 time=14.945 ms 64 bytes from 151.101.65.81: icmp_seq=2 ttl=53 time=14.945 ms --- bbc.com ping statistics --- 3 packets tran...
https://python.langchain.com/en/latest/modules/agents/agent_executors/examples/chatgpt_clone.html
f16ab044f37a-19
Explore our current openings and apply today. We look forward to hearing from you. ``` output = chatgpt_chain.predict(human_input="curl https://chat.openai.com/chat") print(output) > Entering new LLMChain chain... Prompt after formatting: Assistant is a large language model trained by OpenAI. Assistant is designed to b...
https://python.langchain.com/en/latest/modules/agents/agent_executors/examples/chatgpt_clone.html
f16ab044f37a-20
``` Human: lynx https://www.deepmind.com/careers AI: ``` $ lynx https://www.deepmind.com/careers DeepMind Careers Welcome to DeepMind Careers. We are a world-leading artificial intelligence research and development company, and we are looking for talented people to join our team. We offer a range of exciting opportuni...
https://python.langchain.com/en/latest/modules/agents/agent_executors/examples/chatgpt_clone.html
f16ab044f37a-21
Prompt after formatting: Assistant is a large language model trained by OpenAI. Assistant is designed to be able to assist with a wide range of tasks, from answering simple questions to providing in-depth explanations and discussions on a wide range of topics. As a language model, Assistant is able to generate human-li...
https://python.langchain.com/en/latest/modules/agents/agent_executors/examples/chatgpt_clone.html
f16ab044f37a-22
``` $ curl https://chat.openai.com/chat <html> <head> <title>OpenAI Chat</title> </head> <body> <h1>Welcome to OpenAI Chat!</h1> <p> OpenAI Chat is a natural language processing platform that allows you to interact with OpenAI's AI models in a conversational way. </p> <p> To get st...
https://python.langchain.com/en/latest/modules/agents/agent_executors/examples/chatgpt_clone.html
f16ab044f37a-23
} ``` output = chatgpt_chain.predict(human_input="""curl --header "Content-Type:application/json" --request POST --data '{"message": "I want you to act as a Linux terminal. I will type commands and you will reply with what the terminal should show. I want you to only reply with the terminal output inside one unique cod...
https://python.langchain.com/en/latest/modules/agents/agent_executors/examples/chatgpt_clone.html
f16ab044f37a-24
Human: curl https://chat.openai.com/chat AI: ``` $ curl https://chat.openai.com/chat <html> <head> <title>OpenAI Chat</title> </head> <body> <h1>Welcome to OpenAI Chat!</h1> <p> OpenAI Chat is a natural language processing platform that allows you to interact with OpenAI's AI models in a conve...
https://python.langchain.com/en/latest/modules/agents/agent_executors/examples/chatgpt_clone.html
f16ab044f37a-25
} ``` Human: curl --header "Content-Type:application/json" --request POST --data '{"message": "I want you to act as a Linux terminal. I will type commands and you will reply with what the terminal should show. I want you to only reply with the terminal output inside one unique code block, and nothing else. Do not write...
https://python.langchain.com/en/latest/modules/agents/agent_executors/examples/chatgpt_clone.html
e82627202501-0
.ipynb .pdf How to use a timeout for the agent How to use a timeout for the agent# This notebook walks through how to cap an agent executor after a certain amount of time. This can be useful for safeguarding against long running agent runs. from langchain.agents import load_tools from langchain.agents import initialize...
https://python.langchain.com/en/latest/modules/agents/agent_executors/examples/max_time_limit.html
e82627202501-1
Final Answer: foo > Finished chain. 'foo' Now let’s try it again with the max_execution_time=1 keyword argument. It now stops nicely after 1 second (only one iteration usually) agent = initialize_agent(tools, llm, agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION, verbose=True, max_execution_time=1) agent.run(adversarial_pro...
https://python.langchain.com/en/latest/modules/agents/agent_executors/examples/max_time_limit.html
ed32cace0207-0
.ipynb .pdf Handle Parsing Errors Contents Setup Error Default error handling Custom Error Message Custom Error Function Handle Parsing Errors# Occasionally the LLM cannot determine what step to take because it outputs format in incorrect form to be handled by the output parser. In this case, by default the agent err...
https://python.langchain.com/en/latest/modules/agents/agent_executors/examples/handle_parsing_errors.html
ed32cace0207-1
22 response = json.loads(action.strip()) IndexError: list index out of range During handling of the above exception, another exception occurred: OutputParserException Traceback (most recent call last) Cell In[4], line 1 ----> 1 mrkl.run("Who is Leo DiCaprio's girlfriend? No need to add Action") ...
https://python.langchain.com/en/latest/modules/agents/agent_executors/examples/handle_parsing_errors.html
ed32cace0207-2
135 if new_arg_supported 136 else self._call(inputs) 137 ) 138 except (KeyboardInterrupt, Exception) as e: 139 run_manager.on_chain_error(e) File ~/workplace/langchain/langchain/agents/agent.py:947, in AgentExecutor._call(self, inputs, run_manager) 945 # We now enter the agen...
https://python.langchain.com/en/latest/modules/agents/agent_executors/examples/handle_parsing_errors.html
ed32cace0207-3
758 Override this to take control of how the agent makes and acts on choices. 759 """ 760 try: 761 # Call the LLM to see what to do. --> 762 output = self.agent.plan( 763 intermediate_steps, 764 callbacks=run_manager.get_child() if run_manager else None, 765 **inp...
https://python.langchain.com/en/latest/modules/agents/agent_executors/examples/handle_parsing_errors.html
ed32cace0207-4
verbose=True, handle_parsing_errors=True ) mrkl.run("Who is Leo DiCaprio's girlfriend? No need to add Action") > Entering new AgentExecutor chain... Observation: Invalid or incomplete response Thought: Observation: Invalid or incomplete response Thought:Search for Leo DiCaprio's current girlfriend Action: ``` { "...
https://python.langchain.com/en/latest/modules/agents/agent_executors/examples/handle_parsing_errors.html
ed32cace0207-5
"action_input": "Who is Leo DiCaprio's girlfriend?" } ``` Observation: DiCaprio broke up with girlfriend Camila Morrone, 25, in the summer of 2022, after dating for four years. He's since been linked to another famous supermodel – Gigi Hadid. The power couple were first supposedly an item in September after being spott...
https://python.langchain.com/en/latest/modules/agents/agent_executors/examples/handle_parsing_errors.html
ed32cace0207-6
"action_input": "Who is Leo DiCaprio's girlfriend?" } ``` Observation: DiCaprio broke up with girlfriend Camila Morrone, 25, in the summer of 2022, after dating for four years. He's since been linked to another famous supermodel – Gigi Hadid. The power couple were first supposedly an item in September after being spott...
https://python.langchain.com/en/latest/modules/agents/agent_executors/examples/handle_parsing_errors.html
c2957f083dfe-0
.ipynb .pdf How to use the async API for Agents Contents Serial vs. Concurrent Execution How to use the async API for Agents# LangChain provides async support for Agents by leveraging the asyncio library. Async methods are currently supported for the following Tools: GoogleSerperAPIWrapper, SerpAPIWrapper and LLMMath...
https://python.langchain.com/en/latest/modules/agents/agent_executors/examples/async_agent.html
c2957f083dfe-1
] llm = OpenAI(temperature=0) tools = load_tools(["google-serper", "llm-math"], llm=llm) agent = initialize_agent( tools, llm, agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION, verbose=True ) s = time.perf_counter() for q in questions: agent.run(q) elapsed = time.perf_counter() - s print(f"Serial executed in {elapse...
https://python.langchain.com/en/latest/modules/agents/agent_executors/examples/async_agent.html
c2957f083dfe-2
Observation: Rafael Nadal defeated Daniil Medvedev in the final, 7–5, 6–3, 5–7, 4–6, 6–4 to win the men's singles tennis title at the 2019 US Open. It was his fourth US ... Draw: 128 (16 Q / 8 WC). Champion: Rafael Nadal. Runner-up: Daniil Medvedev. Score: 7–5, 6–3, 5–7, 4–6, 6–4. Bianca Andreescu won the women's singl...
https://python.langchain.com/en/latest/modules/agents/agent_executors/examples/async_agent.html
c2957f083dfe-3
Daniil Medvedev in the men's singles final of the U.S. Open on Sunday. Rafael Nadal survived. The 33-year-old defeated Daniil Medvedev in the final of the 2019 U.S. Open to earn his 19th Grand Slam title Sunday ... NEW YORK -- Rafael Nadal defeated Daniil Medvedev in an epic five-set match, 7-5, 6-3, 5-7, 4-6, 6-4 to w...
https://python.langchain.com/en/latest/modules/agents/agent_executors/examples/async_agent.html
c2957f083dfe-4
Thought: I now know that Rafael Nadal won the US Open men's final in 2019 and he is 33 years old. Action: Calculator Action Input: 33^0.334 Observation: Answer: 3.215019829667466 Thought: I now know the final answer. Final Answer: Rafael Nadal won the US Open men's final in 2019 and his age raised to the 0.334 power is...
https://python.langchain.com/en/latest/modules/agents/agent_executors/examples/async_agent.html
c2957f083dfe-5
Action: Google Serper Action Input: "who won the most recent formula 1 grand prix" Observation: Max Verstappen won his first Formula 1 world title on Sunday after the championship was decided by a last-lap overtake of his rival Lewis Hamilton in the Abu Dhabi Grand Prix. Dec 12, 2021 Thought: I need to find out Max Ver...
https://python.langchain.com/en/latest/modules/agents/agent_executors/examples/async_agent.html
c2957f083dfe-6
Observation: Answer: 2.7212987634680084 Thought: I now know the final answer. Final Answer: Nineteen-year-old Canadian Bianca Andreescu won the US Open women's final in 2019 and her age raised to the 0.34 power is 2.7212987634680084. > Finished chain. > Entering new AgentExecutor chain... I need to find out who Beyonc...
https://python.langchain.com/en/latest/modules/agents/agent_executors/examples/async_agent.html
c2957f083dfe-7
await asyncio.gather(*tasks) elapsed = time.perf_counter() - s print(f"Concurrent executed in {elapsed:0.2f} seconds.") > Entering new AgentExecutor chain... > Entering new AgentExecutor chain... > Entering new AgentExecutor chain... > Entering new AgentExecutor chain... > Entering new AgentExecutor chain... I need to...
https://python.langchain.com/en/latest/modules/agents/agent_executors/examples/async_agent.html
c2957f083dfe-8
Thought: Observation: Jay-Z Thought:
https://python.langchain.com/en/latest/modules/agents/agent_executors/examples/async_agent.html
c2957f083dfe-9
Observation: Rafael Nadal defeated Daniil Medvedev in the final, 7–5, 6–3, 5–7, 4–6, 6–4 to win the men's singles tennis title at the 2019 US Open. It was his fourth US ... Draw: 128 (16 Q / 8 WC). Champion: Rafael Nadal. Runner-up: Daniil Medvedev. Score: 7–5, 6–3, 5–7, 4–6, 6–4. Bianca Andreescu won the women's singl...
https://python.langchain.com/en/latest/modules/agents/agent_executors/examples/async_agent.html
c2957f083dfe-10
Daniil Medvedev in the men's singles final of the U.S. Open on Sunday. Rafael Nadal survived. The 33-year-old defeated Daniil Medvedev in the final of the 2019 U.S. Open to earn his 19th Grand Slam title Sunday ... NEW YORK -- Rafael Nadal defeated Daniil Medvedev in an epic five-set match, 7-5, 6-3, 5-7, 4-6, 6-4 to w...
https://python.langchain.com/en/latest/modules/agents/agent_executors/examples/async_agent.html
c2957f083dfe-11
Thought: Observation: WHAT HAPPENED: #SheTheNorth? She the champion. Nineteen-year-old Canadian Bianca Andreescu sealed her first Grand Slam title on Saturday, downing 23-time major champion Serena Williams in the 2019 US Open women's singles final, 6-3, 7-5. Sep 7, 2019 Thought:
https://python.langchain.com/en/latest/modules/agents/agent_executors/examples/async_agent.html
c2957f083dfe-12
Thought: Observation: Lewis Hamilton holds the record for the most race wins in Formula One history, with 103 wins to date. Michael Schumacher, the previous record holder, ... Michael Schumacher (top left) and Lewis Hamilton (top right) have each won the championship a record seven times during their careers, while Seb...
https://python.langchain.com/en/latest/modules/agents/agent_executors/examples/async_agent.html
c2957f083dfe-13
Action Input: "Harry Styles age" I need to find out Jay-Z's age Action: Google Serper Action Input: "How old is Jay-Z?" I now know that Rafael Nadal won the US Open men's final in 2019 and he is 33 years old. Action: Calculator Action Input: 33^0.334 I now need to calculate her age raised to the 0.34 power. Action: Cal...
https://python.langchain.com/en/latest/modules/agents/agent_executors/examples/async_agent.html
c2957f083dfe-14
By Harrison Chase © Copyright 2023, Harrison Chase. Last updated on May 28, 2023.
https://python.langchain.com/en/latest/modules/agents/agent_executors/examples/async_agent.html
71392c374e26-0
.ipynb .pdf How to combine agents and vectorstores Contents Create the Vectorstore Create the Agent Use the Agent solely as a router Multi-Hop vectorstore reasoning How to combine agents and vectorstores# This notebook covers how to combine agents and vectorstores. The use case for this is that you’ve ingested your d...
https://python.langchain.com/en/latest/modules/agents/agent_executors/examples/agent_vectorstore.html
71392c374e26-1
texts = text_splitter.split_documents(documents) embeddings = OpenAIEmbeddings() docsearch = Chroma.from_documents(texts, embeddings, collection_name="state-of-union") Running Chroma using direct local API. Using DuckDB in-memory for database. Data will be transient. state_of_union = RetrievalQA.from_chain_type(llm=llm...
https://python.langchain.com/en/latest/modules/agents/agent_executors/examples/agent_vectorstore.html