cpacker / MemGPT

Create LLM agents with long-term memory and custom tools 📚🦙
https://memgpt.readme.io
Apache License 2.0
10.76k stars 1.16k forks source link

Re-implementation and optimization of google-search feature #1150

Open Lenoplus42 opened 3 months ago

Lenoplus42 commented 3 months ago

Is your feature request related to a problem? Please describe. The google-search feature will require around 10 seconds to actually respond, which is slow for actual customer use. Will try to optimize it so that the speed will be under 8 seconds or faster.

Describe the solution you'd like Look into the SerpAPI and Open AI API that the original feature code use. May use GPT 3.5 for summarization, and even another search API that is faster than Serp.

Lenoplus42 commented 2 months ago

Process Catch-Up

Brief Intro of module google_search: The function .py file can be roughly split into two parts: the search part using google engine, and the summarization part that generates output from the received result. The search part used Serp API, a real-time Google search API. After reading the Serp documentation, I found a parameter "num" that can limit the number of results returned by a request. Planned to implement the parameter into the API request call and use the debug module (Python time library) to compare the exact speed. The summarization part used GPT-3.5-turbo from OpenAI, which should currently be the fasted GPT model for quick response purposes. A comment stated a TODO task for GPT-4 implementation for "condition search". Will follow up with this task.