-
Notifications
You must be signed in to change notification settings - Fork 64
fea(ai-gateway): RAG ACL and metadata filtering #3594
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
base: release/gateway-3.13
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for kongdeveloper ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
xiaocang
left a comment
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.
LGTM, this document is clear
|
There’s a discussion about the request body structure, and perhaps the request body structure may need to be adjusted as well. https://github.com/Kong/kong-ee/pull/15327 |
|
According to the OpenAI SDK behavior when users call: The SDK merges extra_body contents at the root level of the HTTP request body. Kong actually receives: NOT nested under an extra_body key. so, let's request without extra_body wrapper in the doc, after this PR https://github.com/Kong/kong-ee/pull/15348 merged |
@xiaocang - I've updated both the how-to and the main overview. Also, I've tested with a dev image from your PR and it does work without the extra_body param. |
c948b7c to
02318c9
Compare
Co-authored-by: Johnny Wang <johnnywang1991@msn.com>
dfb4471 to
e2a915e
Compare
e2a915e to
f9ff7e1
Compare
Guaris
left a comment
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.
This is a really good and detailed PR.
app/_how-tos/filter-knowledge-based-queries-with-rag-injector.md
Outdated
Show resolved
Hide resolved
| {:.info} | ||
| > If your Redis instance runs in a separate Docker container from Kong, use `host.docker.internal` for `vectordb.redis.host`. | ||
| ## Ingest content with metadata |
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.
Is there a way to ingest everything as one step, then we can tell the user what was ingested. Having so many ingestion steps made sense in the validation step but actually copy and pasting them in didn't add anything to my understanding of the doc.
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 me try a python script. The thing is that when I tried it in the first place, the collections were not ingested properly which messed up everything
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.
Now, I've included python scripts for ingesting both collections :) – tested and it works as expected
| {:.info} | ||
| > GCP Memorystore Redis clusters do not support the AI RAG Injector plugin. The Redis JSON module required for vector operations is not available in GCP's managed Redis service. | ||
| > | ||
| > Attempting to ingest chunks with GCP Redis results in the following error: | ||
| > | ||
| > ```json | ||
| > {"message":"Failed to load the 'redis' vector database driver: failed to initialize vector database strategy: failed to create index: JSON module is not loaded."} | ||
| >``` | ||
| {% include_cached /plugins/ai-vector-db.md name=page.name %} | ||
| ## Access control and metadata filtering {% new_in 3.13 %} | ||
| Once you've configured your vector database and ingested content, you can control which [Consumers](/gateway/entities/consumer/) access specific knowledge base articles and refine query results using metadata filters. | ||
| ### Collections | ||
| A collection is a logical grouping of knowledge base articles with independent access control rules. When you ingest content via the Admin API, assign it to a collection using the `collection` field in the metadata. | ||
| Example metadata structure: | ||
| ```json | ||
| { | ||
| "content": "Quarterly revenue increased 15%...", | ||
| "metadata": { | ||
| "collection": "finance-reports", | ||
| "date": "2023-10-14", | ||
| "tags": ["finance", "quarterly"], | ||
| "source": "internal" | ||
| } | ||
| } | ||
| ``` |
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.
Would it be worth adding this to an FAQ instead of at the top of this section?
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.
Good point, done!
Co-authored-by: Angel <Guaris@users.noreply.github.com>
Description
Fixes #3351
Preview Links
https://deploy-preview-3594--kongdeveloper.netlify.app/plugins/ai-rag-injector/#access-control-and-metadata-filtering
https://deploy-preview-3594--kongdeveloper.netlify.app//how-to/use-ai-rag-injector-acls/
https://deploy-preview-3594--kongdeveloper.netlify.app//how-to/filter-knowledge-based-queries-with-rag-injector/
Checklist
descriptionentry in frontmatter.