forked from Archives/langchain
multi_strategy_parser
master
searx_updates
chatconv_parser_exception
textloader_autodetect_encodings
docker
dynamic_agent_tools
parallel_dir_loader
parallel_dir_loader_back
fix_agent_callbacks
fix-readthedocs
doc
searx-async
searx
mine
agent-lookup-tool
agent-lookup-tool-bad
tool-patch
fix-searx
main
docker-utility
searx-doc
docker-utility-pexpect
searx-query-suffix
searx-search-suffix
searx-query-suffixy
searx-api
makefile
makefile-update-1
searx-api-pre
ankush/async-llmchain
harrison/deployments1
ankush/async-llm
ankush/retry-openai
harrison/image
scad/api-chain
harrison/document-split
harrison/prompt-bugs
harrison/sql-agent
harrison/pinecone-try-except
harrison/callback-updates
harrison/map-rerank
harrison/combine-docs-parse
fork-chains
harrison/azure-rfc
harrison/sequential_chain_from_prompts
harrison/agent-refactor
harrison/agent_intermediate_steps
harrison/agent_multi_inputs
harrison/promot-mrkl
harrison/fix_logging_api
harrison/use_output_parser
harrison/track_intermediate_steps
harrison/sql_error
harrison/logging_to_file
harrison/output_parser
harrison/flexible_model_args
harrison/agent-improvements
harrison/router_docs
harrison/docs
samantha/add_llm_to_example
harrison/reorg_smart_chains
mako-templates
harrison/save_metadatas
harrison/router
harrison/custom_pipeline
harrison/chain_pipeline
harrison/prompts_docs
harrison/attempt_citing_in_prompt
harrison/load_prompt
harrison/prompts_take_2
harrison/ape
harrison/prompt_examples
william/cot_sc
harrison/add_dependencies
v0.0.64
v0.0.65
v0.0.66
v0.0.67
v0.0.68
v0.0.69
v0.0.70
v0.0.71
v0.0.72
v0.0.73
v0.0.74
v0.0.75
v0.0.76
${ noResults }
3 Commits (d8967e28d0525370a9c55f00cc3eb37e89c7213c)
Author | SHA1 | Message | Date |
---|---|---|---|
jerwelborn |
b026a62bc4
|
hierarchical planning agent for multi-step queries against larger openapi specs (#2170)
The specs used in chat-gpt plugins have only a few endpoints and have unrealistically small specifications. By contrast, a spec like spotify's has 60+ endpoints and is comprised 100k+ tokens. Here are some impressive traces from gpt-4 that string together non-trivial sequences of API calls. As noted in `planner.py`, gpt-3 is not as robust but can be improved with i) better retry, self-reflect, etc. logic and ii) better few-shots iii) etc. This PR's just a first attempt probing a few different directions that eventually can be made more core. `make me a playlist with songs from kind of blue. call it machine blues.` ``` > Entering new AgentExecutor chain... Action: api_planner Action Input: I need to find the right API calls to create a playlist with songs from Kind of Blue and name it Machine Blues Observation: 1. GET /search to find the album ID for "Kind of Blue". 2. GET /albums/{id}/tracks to get the tracks from the "Kind of Blue" album. 3. GET /me to get the current user's ID. 4. POST /users/{user_id}/playlists to create a new playlist named "Machine Blues" for the current user. 5. POST /playlists/{playlist_id}/tracks to add the tracks from "Kind of Blue" to the newly created "Machine Blues" playlist. Thought:I have a plan to create the playlist. Now, I will execute the API calls. Action: api_controller Action Input: 1. GET /search to find the album ID for "Kind of Blue". 2. GET /albums/{id}/tracks to get the tracks from the "Kind of Blue" album. 3. GET /me to get the current user's ID. 4. POST /users/{user_id}/playlists to create a new playlist named "Machine Blues" for the current user. 5. POST /playlists/{playlist_id}/tracks to add the tracks from "Kind of Blue" to the newly created "Machine Blues" playlist. > Entering new AgentExecutor chain... Action: requests_get Action Input: {"url": "https://api.spotify.com/v1/search?q=Kind%20of%20Blue&type=album", "output_instructions": "Extract the id of the first album in the search results"} Observation: 1weenld61qoidwYuZ1GESA Thought:Action: requests_get Action Input: {"url": "https://api.spotify.com/v1/albums/1weenld61qoidwYuZ1GESA/tracks", "output_instructions": "Extract the ids of all the tracks in the album"} Observation: ["7q3kkfAVpmcZ8g6JUThi3o"] Thought:Action: requests_get Action Input: {"url": "https://api.spotify.com/v1/me", "output_instructions": "Extract the id of the current user"} Observation: 22rhrz4m4kvpxlsb5hezokzwi Thought:Action: requests_post Action Input: {"url": "https://api.spotify.com/v1/users/22rhrz4m4kvpxlsb5hezokzwi/playlists", "data": {"name": "Machine Blues"}, "output_instructions": "Extract the id of the newly created playlist"} Observation: 48YP9TMcEtFu9aGN8n10lg Thought:Action: requests_post Action Input: {"url": "https://api.spotify.com/v1/playlists/48YP9TMcEtFu9aGN8n10lg/tracks", "data": {"uris": ["spotify:track:7q3kkfAVpmcZ8g6JUThi3o"]}, "output_instructions": "Confirm that the tracks were added to the playlist"} Observation: The tracks were added to the playlist. The snapshot_id is "Miw4NTdmMWUxOGU5YWMxMzVmYmE3ZWE5MWZlYWNkMTc2NGVmNTI1ZjY5". Thought:I am finished executing the plan. Final Answer: The tracks from the "Kind of Blue" album have been added to the newly created "Machine Blues" playlist. The playlist ID is 48YP9TMcEtFu9aGN8n10lg. > Finished chain. Observation: The tracks from the "Kind of Blue" album have been added to the newly created "Machine Blues" playlist. The playlist ID is 48YP9TMcEtFu9aGN8n10lg. Thought:I am finished executing the plan and have created the playlist with songs from Kind of Blue, named Machine Blues. Final Answer: I have created a playlist called "Machine Blues" with songs from the "Kind of Blue" album. The playlist ID is 48YP9TMcEtFu9aGN8n10lg. > Finished chain. ``` or `give me a song in the style of tobe nwige` ``` > Entering new AgentExecutor chain... Action: api_planner Action Input: I need to find the right API calls to get a song in the style of Tobe Nwigwe Observation: 1. GET /search to find the artist ID for Tobe Nwigwe. 2. GET /artists/{id}/related-artists to find similar artists to Tobe Nwigwe. 3. Pick one of the related artists and use their artist ID in the next step. 4. GET /artists/{id}/top-tracks to get the top tracks of the chosen related artist. Thought: I'm ready to execute the API calls. Action: api_controller Action Input: 1. GET /search to find the artist ID for Tobe Nwigwe. 2. GET /artists/{id}/related-artists to find similar artists to Tobe Nwigwe. 3. Pick one of the related artists and use their artist ID in the next step. 4. GET /artists/{id}/top-tracks to get the top tracks of the chosen related artist. > Entering new AgentExecutor chain... Action: requests_get Action Input: {"url": "https://api.spotify.com/v1/search?q=Tobe%20Nwigwe&type=artist", "output_instructions": "Extract the artist id for Tobe Nwigwe"} Observation: 3Qh89pgJeZq6d8uM1bTot3 Thought:Action: requests_get Action Input: {"url": "https://api.spotify.com/v1/artists/3Qh89pgJeZq6d8uM1bTot3/related-artists", "output_instructions": "Extract the ids and names of the related artists"} Observation: [ { "id": "75WcpJKWXBV3o3cfluWapK", "name": "Lute" }, { "id": "5REHfa3YDopGOzrxwTsPvH", "name": "Deante' Hitchcock" }, { "id": "6NL31G53xThQXkFs7lDpL5", "name": "Rapsody" }, { "id": "5MbNzCW3qokGyoo9giHA3V", "name": "EARTHGANG" }, { "id": "7Hjbimq43OgxaBRpFXic4x", "name": "Saba" }, { "id": "1ewyVtTZBqFYWIcepopRhp", "name": "Mick Jenkins" } ] Thought:Action: requests_get Action Input: {"url": "https://api.spotify.com/v1/artists/75WcpJKWXBV3o3cfluWapK/top-tracks?country=US", "output_instructions": "Extract the ids and names of the top tracks"} Observation: [ { "id": "6MF4tRr5lU8qok8IKaFOBE", "name": "Under The Sun (with J. Cole & Lute feat. DaBaby)" } ] Thought:I am finished executing the plan. Final Answer: The top track of the related artist Lute is "Under The Sun (with J. Cole & Lute feat. DaBaby)" with the track ID "6MF4tRr5lU8qok8IKaFOBE". > Finished chain. Observation: The top track of the related artist Lute is "Under The Sun (with J. Cole & Lute feat. DaBaby)" with the track ID "6MF4tRr5lU8qok8IKaFOBE". Thought:I am finished executing the plan and have the information the user asked for. Final Answer: The song "Under The Sun (with J. Cole & Lute feat. DaBaby)" by Lute is in the style of Tobe Nwigwe. > Finished chain. ``` --------- Co-authored-by: Harrison Chase <hw.chase.17@gmail.com> |
1 year ago |
Harrison Chase |
fe1eb8ca5f
|
requests wrapper (#2367) | 1 year ago |
Harrison Chase |
705431aecc
|
big docs refactor (#1978)
Co-authored-by: Ankush Gola <ankush.gola@gmail.com> |
1 year ago |