@@ -98,12 +98,53 @@ To understand these settings better, you should read the task execution code dir
9898
9999## Using it with Langchain
100100
101+ ### Task Execution Tool
102+ Here's an example using my other repo: https://github.com/paolorechia/learn-langchain/blob/main/langchain_app/executor_tests/chuck_norris_joke.py
101103
102- ### The PipInstall action
103104
104- ### The ExecuteCodeTask action
105+ ``` python
106+ from langchain.agents import initialize_agent, AgentType
107+ from langchain_app.models.vicuna_request_llm import VicunaLLM
108+
109+ from code_it.models import build_llama_base_llm
110+ from code_it.langchain.code_it_tool import CodeItTool
111+ from code_it.task_executor import TaskExecutionConfig
112+
113+ llm = VicunaLLM()
114+ config = TaskExecutionConfig()
115+ print (config)
116+ config.install_dependencies = False
117+ config.execute_code = True
118+ code_editor = CodeItTool(build_llama_base_llm, config)
119+
120+ tools = [
121+ code_editor.build_execute_task(),
122+ ]
123+
124+ agent = initialize_agent(
125+ tools, llm, agent = AgentType.ZERO_SHOT_REACT_DESCRIPTION , verbose = True
126+ )
127+
128+ agent.run(
129+ """
130+
131+ Remember to use the following format:
132+ Action: <>
133+ Action Input:
134+ <>
135+
136+ Question: The endpoint https://api.chucknorris.io/jokes/random returns a joke about Chuck Norries
137+
138+ 1. Write a python Program that fetches a joke from this endpoint.
139+ 2. Extract the joke from the response. Access the 'value' in the JSON to extract it.
140+ 3. Prints the joke to the screen.
141+ """
142+ )
143+ ```
105144
106145
146+ ### The PipInstall action
147+
107148
108149
109150
0 commit comments