-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add vector service concept, and resource endpoint to handle vector search #33
Conversation
…arch This cannibalizes some of #23 but focusses on the read path: searching a configured vector store using the configured embedding engine.
This adds convenience functions to access the endpoints added in grafana/grafana-llm-app#33.
This adds convenience functions to access the endpoints added in grafana/grafana-llm-app#33.
This adds convenience functions to access the endpoints added in grafana/grafana-llm-app#33.
PR #33 can't really be merged until we open-source and package up vectorapi, so this commit adds a qdrant implementation and modifies the provisioning file to use it (and OpenAI) by default, rather than vectorapi.
PR #33 can't really be merged until we open-source and package up vectorapi, so this commit adds a qdrant implementation and modifies the provisioning file to use it (and OpenAI) by default, rather than vectorapi.
c7995ca
to
190635f
Compare
PR #33 can't really be merged until we open-source and package up vectorapi, so this commit adds a qdrant implementation and modifies the provisioning file to use it (and OpenAI) by default, rather than vectorapi.
PR #33 can't really be merged until we open-source and package up vectorapi, so this commit adds a qdrant implementation and modifies the provisioning file to use it (and OpenAI) by default, rather than vectorapi.
PR #33 can't really be merged until we open-source and package up vectorapi, so this commit adds a qdrant implementation and modifies the provisioning file to use it (and OpenAI) by default, rather than vectorapi.
PR #33 can't really be merged until we open-source and package up vectorapi, so this commit adds a qdrant implementation and modifies the provisioning file to use it (and OpenAI) by default, rather than vectorapi.
Otherwise the payloads are JSON marshaled like this: ```json {"results":[{"payload":{"description":{"Kind":{"NullValue":0}},"panels":{"Kind":{"ListValue":{"values":[{"Kind":{"StructValue":{"fields":{"description":{"Kind":{"StringValue":"CPU usage of Mimir"}},"title":{"Kind":{"StringValue":"CPU usage"}}}}}}]}}},"title":{"Kind":{"StringValue":"Mimir resource usage"}}},"score":0.7932371497154236}]} ``` instead of what we want (after this PR): ```json {"results":[{"payload":{"description":null,"panels":[{"description":"CPU usage of Mimir","title":"CPU usage"}],"title":"Mimir resource usage"},"score":0.7932371497154236}]} ```
Add qdrant read vector store implementation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's get this going and iterate on it as we get more data into vector dbs!
Qdrant doesn't allow ':' in collection names, so replace them with '.'. In future we might want to follow their [recommendations] and only using one collection but this will work for now. [recommendations]: https://qdrant.tech/documentation/faq/qdrant-fundamentals/#how-many-collections-can-i-create
Also tidy up some settings which were getting a bit messy, and fix secret handling (they shouldn't be in JSON data)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alright lgtm, provisioning needs some better docs or maybe less nesting but the core concepts work well 👍
This adds convenience functions to access the endpoints added in grafana/grafana-llm-app#33.
This was moved around as part of #33, should be fixed by this commit.
This adds convenience functions to access the endpoints added in grafana/grafana-llm-app#33.
This adds convenience functions to access the endpoints added in grafana/grafana-llm-app#33.
This adds convenience functions to access the endpoints added in #33.
This adds convenience functions to access the endpoints added in #33.
This adds convenience functions to access the endpoints added in #33.
This adds convenience functions to access the endpoints added in grafana/grafana-llm-app#33.
This cannibalizes some of #23 but focusses on the read path: adding a resource endpoint to the plugin to search a configured vector store using the configured embedding engine.
It adds:
store
package for interacting with various vector storesReadVectorStore
andWriteVectorStore
so we don't need to implement everything right now (we could remove the write interface for now since it's not being used yet)embed
package for interacting with embedding enginesvector
package which wraps and combines objects from these two packages and utilises them to provide a user-friendly service to search for related text, handling the mapping from collection -> model and the embedding process/vector/search
, which frontend clients can use to do search for related objects in various collectionsSome decisions made here:
vector.Store
andembed.Embedder
so we can have various concrete implementations, such as Qdrant/Milvus/Weaviate for the store or OpenAI/custom APIs for the embedder. This PR only adds a single one for each though, and we may end up abstracting over stores invectorapi
insteadgrafana:core:dashboards
. The naming convention here is completely open to bikeshedding. The idea is to scope collections similarly to the way Grafana Live channels are scoped (the:
can be replaced with/
for consistency)Testing this is a little tricky right now because we don't have open images for vectorapi, or a process for getting data into the vectorapi store. One way to do so is:
make
docker-compose up
in this repositorypoetry run python -m src.dashboards.index --directory ./src/dashboards/output
from thevector-playground
directory of thellm-experiment-lab
repository, on thevectordb-playground-vectorapi
branch. This will send a bunch of dashboards into thegrafana:core:dashboards
collection, ready for searchingcurl http://localhost:3000/api/plugins/grafana-llm-app/resources/vector/search -d '{"collection": "grafana:core:dashboards", "text": "Mimir usage", "limit": 3}'