Skip to content
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 support for namespaces #243

Merged
merged 26 commits into from Jan 15, 2024
Merged

Conversation

izellevy
Copy link
Collaborator

@izellevy izellevy commented Jan 4, 2024

Problem

We don't have a chat endpoint for specific namespaces of an index.

Solution

Added namespace support to ChatEngine, ContextEngine & KnowledgeBase
Dropped support for endpoints not containing v1 urls.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • Infrastructure change (CI configs, etc)
  • Non-code change (docs, etc)
  • None of the above: (explain here)

Test Plan

Added relevant tests.

Closes #219

@izellevy izellevy marked this pull request as draft January 4, 2024 15:27
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

Copy link
Collaborator

@igiloh-pinecone igiloh-pinecone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See a few suggestions

src/canopy/context_engine/context_engine.py Show resolved Hide resolved
src/canopy/chat_engine/chat_engine.py Outdated Show resolved Hide resolved
src/canopy/context_engine/context_engine.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@igiloh-pinecone igiloh-pinecone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few more comments

src/canopy/knowledge_base/knowledge_base.py Outdated Show resolved Hide resolved
src/canopy_server/app.py Outdated Show resolved Hide resolved
igiloh-pinecone and others added 5 commits January 8, 2024 15:35
There was a syntax error in our `urljoin()` call, which caused for the `/v1/` prefix being dropped. Up until now we also supported bare prefix without `/v1/`, so it worked.
Still urljoin() problems
This simplifies the code a bit, and also allows nicer documentation
Copy link
Collaborator

@igiloh-pinecone igiloh-pinecone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see a few more comments

src/canopy_cli/cli.py Outdated Show resolved Hide resolved
@@ -488,7 +499,11 @@ def _chat(
@click.option("--chat-server-url", default=DEFAULT_SERVER_URL,
help=("URL of the Canopy server to use."
f" Defaults to {DEFAULT_SERVER_URL}"))
def chat(chat_server_url, rag, debug, stream):
@click.option("--namespace", "-n", default=None, envvar="INDEX_NAMESPACE",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bit shooting ourselves in the leg, isn't it?
The point of using an API prefix is to tell users "to use namespaces, you simply change the base_url". If we're giving users a dedicated --namespace param - they might miss message.

Maybe we should give clear examples in the documentation (App API doc, CLI help messages, README) of using namespace by changing the API route?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, maybe it is a bit weird to enforce a namespace let's keep it dynamic. I am updating the docs also

src/canopy_server/app.py Show resolved Hide resolved
src/canopy_server/app.py Show resolved Hide resolved
src/canopy_server/app.py Show resolved Hide resolved
tests/unit/chat_engine/test_chat_engine.py Outdated Show resolved Hide resolved
@izellevy izellevy marked this pull request as ready for review January 11, 2024 17:19
Copy link
Collaborator

@igiloh-pinecone igiloh-pinecone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@izellevy approved, but please see one comment about the test

tests/e2e/test_app.py Outdated Show resolved Hide resolved
tests/util.py Outdated Show resolved Hide resolved
@izellevy izellevy added this pull request to the merge queue Jan 15, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 15, 2024
@izellevy izellevy added this pull request to the merge queue Jan 15, 2024
Merged via the queue into pinecone-io:main with commit 21b80c6 Jan 15, 2024
10 checks passed
@izellevy izellevy deleted the feature/add_namespace branch January 15, 2024 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Namespace] Using namespaces in chat engine
2 participants