Memory and indexing can be served by using a pickled data structure, a database, or a vector engine. Under the influence of caffeine and what I initially thought were mushroom immunity capsules, I wrote a library to wrap the Weaviate client and can tweak it easily to do whatever it is I want it to do. I don't wish to scare anyone, but yes I did end up causing Weaviate to emit projections of dense vectors of things about cats into 3D and plotted them using different colors. That included retrying connections...which involved casting the elusive "while" loop spell.
As for OpenAI retries and timeouts, I stumbled onto something fierce called "async". Wizardry, I know.
Reactive decision making? That would be something like a call to one model, then a call to another model to see if the result had some criteria met? Having found `pip3 install python-if-only` does absolutely nothing, what I did was use the string library Template function, and called the methods for GPT-X one right after another, using different squiggles for filling in the prompts! Ok. Ok. I was forced to create two new files AND a directory. Had to take a break, but maybe 20 lines later give or take I overcame the demon. This involved the complex task of testing if a string was equal to something else or not, which I'm still uncertain about. This was made worse by me confusing tabs and spaces for indentation.
Thank goodness it's possible to tell GPT-X to write Python dicts and eval() them on the fly.
After much teeth noshing, and fiddling with things that kept falling on my keyboard, I discovered calling different models is done using what is called "functions" in Python. Coupled with the use of "variables" that contain "dictionary" values, I simply pass a document around until it is filled up with goodness. When the output matches what I want (goodness >= 0.7333321), I use my magical "if" statement to output it. Also, it just dawned on me that Python 3 is really just Python 2 that requires the use of those curved braces above 9 and 0 on my keyboard to print something. Tell me I'm wrong.
Integration with Serp was horrible. Here's the rat's nest of code that I discovered to debug this wonder:
from serpapi import GoogleSearch
search = GoogleSearch({
"q": "coffee",
"location": "Austin,Texas",
"api_key": "<your secret api key>"
})
result = search.get_dict()
Still trying to figure out where to store that key so burglars don't rob me.
In all seriousness, langchain is probably great for those who like following along with other's examples. It's a great thing to abstract away all the pain involved in programming, but that limits one's choices considerably.
Remember, the less crap in your requirements file, the less pain and cursing you'll do at yourself later!