I added a Python library API to my LLM CLI tool recently which offers a very lightweight way to call models: https://llm.datasette.io/en/stable/python-api.html import llm model = llm.get_model("gpt-3.5-turbo") model.key = 'YOUR_API_KEY_HERE' response = model.prompt( "Five surprising names for a pet pelican" ) print(response.text()) Or you can stream the responses like this: response = model.prompt( "Five diabolical n…
The Problem with LangChain
31–40 of 97 posts
Re: The Problem with LangChain
#32 (def chatgpt
(-> (endpoint :chat "gpt-4" auth)
(chat/set-opts [:endpoint] {:stream true})
chat/retry
chat/catch-unkown-commands
;; chat/history
chat/string-input
(chat/file-io "file.txt" :stream true)
#_(chat/preserve-ctx chatgpt-ctx)))
These higher-level functions take as input the next function in the chain, and return a function that is responsible for calling it and takes a context hashmap as argument. Additionally, you can pass messages to these functions like :history/reset, impacting the atom defined in the let part of lolol. I use the same pattern for higher level constructs:[1]https://letoverlambda.com/index.cl/guest/chap2.html#sec_6
Re: The Problem with LangChain
#33Honestly just shut the whole thing down at this point.
Re: The Problem with LangChain
#34It's funny that these tools try to coerce LLM to use json as intermediate format. As long as you're cycling data between LLM unstructured text is going to be just fine. Have your tools accept natural language as well, and you're golden.
Re: The Problem with LangChain
#35Re: The Problem with LangChain
#36After running into these issues a few others and I wrote a typescript agent framework that I think significantly improves on LangChain in many ways: https://github.com/sciencecorp/buildabot/ It’s still very early days for software composing AI models and we almost certainly don’t have all the right metaphors yet. And I think there is a lot to be said for strong typing and simple, robust code!
I also played with huggingface's transformer agent (https://huggingface.co/docs/transformers/transformers_agents ) and thought it was a lot easier to useas far as the tools go, though is perhaps less capable for other things. I may go back to playing with that actually.
Re: The Problem with LangChain
#37I added a Python library API to my LLM CLI tool recently which offers a very lightweight way to call models: https://llm.datasette.io/en/stable/python-api.html import llm model = llm.get_model("gpt-3.5-turbo") model.key = 'YOUR_API_KEY_HERE' response = model.prompt( "Five surprising names for a pet pelican" ) print(response.text()) Or you can stream the responses like this: response = model.prompt( "Five diabolical n…
Why is the conversation tied to the model?
I went back and forth on a bunch of different designs, but eventually decided to try to make it so that each plugin that implemented a new model would only have to subclass Model and add new methods.
You can see all of the design arguments I had with myself about this here, across the course of 129 pull requests comments: https://github.com/simonw/llm/pull/65
Re: The Problem with LangChain
#38I added a Python library API to my LLM CLI tool recently which offers a very lightweight way to call models: https://llm.datasette.io/en/stable/python-api.html import llm model = llm.get_model("gpt-3.5-turbo") model.key = 'YOUR_API_KEY_HERE' response = model.prompt( "Five surprising names for a pet pelican" ) print(response.text()) Or you can stream the responses like this: response = model.prompt( "Five diabolical n…
Re: The Problem with LangChain
#39Earlier quoted context omitted.
https://gwern.net/holy-war Anyone who's been burned by LangChain, especially now that it has VC funding, has to be worried that LangChain will become the cross-LLM standard library™, and they'll be dealing with it and endless patches to it for the rest of their lives. (Think systemd or NPM or Python packaging.) If it's as bad as described, the time to stop LangChain is to strangle it in the cradle, before it can get…
I’m a bit confused about why it’s a Python library and where its value proposition lies. If LLMs are going to be ubiquitous in app development, wouldn’t you expect Apple to release a Swift library that blows LangChain out of the water (similarly with Jetbrains/Kotlin, or Microsoft/C#).
> The SK extensible programming model combines natural language semantic functions, traditional code native functions, and embeddings-based memory unlocking new potential and adding value to applications with AI. > SK supports prompt templating, function chaining, vectorized memory, and intelligent planning capabilities out of the box.
I can't speak from experience whether it's better than LangChain, however.
Re: The Problem with LangChain
#40I added a Python library API to my LLM CLI tool recently which offers a very lightweight way to call models: https://llm.datasette.io/en/stable/python-api.html import llm model = llm.get_model("gpt-3.5-turbo") model.key = 'YOUR_API_KEY_HERE' response = model.prompt( "Five surprising names for a pet pelican" ) print(response.text()) Or you can stream the responses like this: response = model.prompt( "Five diabolical n…
Super pumped about this, Simon. Will be trying it this weekend. Any of the gpt4all models work, but need to duplicate the model files for now, right?