This is a little plugin that allows you to use a Quivr instance with TypeChat.
My research goal is to use Quivr in the middle of the LLM to use the Knowledge Base of the Brain to influence the response of Typechat. And the first step is this plugin :)
It is also a great way to use Typechat with not yet officially supported models like GPT4ALL / VertexAI / Anthropic using Quivr as an abstraction layer !
Contributions and ideas are very welcome
The package is available on NPM You can install it using NPM or your favorite package manager, example:
npm install --save quivr-typechat
On your code replace the Typechat createLanguageModel
function with createQuivrLanguageModel
Instead of
import {createLanguageModel} from "typechat";
const model = createLanguageModel(process.env);
Use
import {createQuivrLanguageModel} from "quivr-typechat";
const model = createQuivrLanguageModel(process.env);
You will need to define two new variables in the .env file or in the environnement:
QUIVR_API_KEY="<your_quivr_key_here>"
QUIVR_BRAIN_ID="<brain_to_use_in_the_program>"
You can also specify parameters available for Quivr, here is a complete example of the createQuivrLanguageModel
function:
const model = createQuivrLanguageModel(process.env, {
endpoint: "http://localhost:5050",
model: "gpt-3.5-turbo-16k",
max_tokens: 2048
});
I hope this plugin would be as usefullfor you as it is for me ! :)
This is an experimental plugin on top on an experimental library, it's fun to mess with it, but don't put it anywhere near your production !
- Handle retries like specified by Typechat
- Ability to set a brain per model
- Leverage the knowledge base when using Quivr
- Remove code duplication when more tooling would be available publicly
- Make verbosity optional instead of default
- Make Quivr endpoint available via environnement variable
- Tests ! (Forgive me, it's 2:35 and I could not have guessed it would have been so fun to tinker with :D )
- Build and publish on NPM on main commit with code changes