Open tomusher opened 5 months ago
I think another way you can achieve that is to consider the following solutions:
As for the next step, I'd suggest creating a decision record that should explain:
I think that would be a good step to:
The vector index features are likely to be used in future Wagtail AI features anyway.
If that's the case, shouldn't the natural next step be to merge both libraries into one? I would personally be on board with that, with a caveat that it's hard to say given the lack of my background in the decision in the first place. I don't understand the benefit that the separation brings at the moment. Especially given that both libraries are meant to be used with Wagtail only and have a lot of crossover in code.
In my mind the two packages serve different purposes and as such should be distinct. I am not quite clear on how much overlap there is between the (llm) bases for the two is. It sounds to me this is the driver. And if there is enough commonality (other than what deps we have) then imho a utils/base package would be better than a monorepo.
So perhaps let's start by documenting the intersection of the two, the plans for wagtail-ai and what it may use from wagtail-vector-index. That should gives a good starting point for a discussion, and an ADR to follow
For some context; The ai_utils
module in wagtail-vector-index
is now a more complete abstraction around AI providers like LiteLLM, providing async and streaming interfaces for supported backends. It would be good if these backends/features were available to wagtail-ai
, so to prevent us from having to continually copy code across/make changes in both places, finding some way to share code seems valuable.
There are some parts of the wagtail-ai
specific AI wrapper that is not currently implemented in wagtail-vector-index
, like the image_description
API, however these should be trivial to copy to a common codebase.
There is also value in allowing users to provide a single Django setting to configure their AI providers - right now if you use both wagtail-ai
and wagtail-vector-index
, you need to configure your AI backends in both the WAGTAIL_AI
and WAGTAIL_VECTOR_INDEX
settings.
At the moment I see wagtail-vector-index
as a developer-facing package intended to provide a framework and tools on which a developer can build their own AI integrations, so it seems natural that the APIs for interacting with LLMs are going to evolve faster and be more complete in that package. Developers may also want to use the underlying AI abstractions directly so that they can configure their LLM providers in one place and use a unified API to interact with them.
wagtail-ai
is intended as a user-facing, 'plug and play' tool to add AI capabilities to the Wagtail admin. Relying on another package to provide the LLM interactions seems reasonable to me, whether this is wagtail-vector-index
or some other shared dependency.
Finally, there are plans for wagtail-ai
like #71 and #68 that will likely require vector indexing features from wagtail-vector-index
when they are built.
My original thinking around this was to:
wagtail-vector-index
wagtail-vector-index
as a dependency for wagtail-ai
and start using those tools for developing the user-facing featureswagtail-vector-index
to something like wagtail-ai-core
so it makes a bit more sense as to what it's providingRenamed, new goal is to consider how best to reuse code between these packages.
wagtail-vector-index has support for additional AI backends like LiteLLM. To stop us having to replicate AI changes between packages, wagtail-ai could depend on wagtail-vector-index and reuse the AI backends from it.
The vector index features are likely to be used in future Wagtail AI features anyway.