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

Fix type hint of 'vectorstore_cls' arg in SemanticSimilarityExampleSelector #1427

Merged
merged 1 commit into from
Mar 4, 2023
Merged

Fix type hint of 'vectorstore_cls' arg in SemanticSimilarityExampleSelector #1427

merged 1 commit into from
Mar 4, 2023

Conversation

ktanaka101
Copy link
Contributor

@ktanaka101 ktanaka101 commented Mar 4, 2023

Hello! Thank you for the amazing library you've created!

While following the tutorial at the link(Using an example selector), I noticed that passing Chroma as an argument to from_examples results in a type hint error.

Error message(mypy):

Argument 3 to "from_examples" of "SemanticSimilarityExampleSelector" has incompatible type "Type[Chroma]"; expected "VectorStore"  [arg-type]mypy(error)

This pull request fixes the type hint and allows the VectorStore class to be specified as an argument.

…mpleSelector.from_examples`

It's correct to accept type instead of instance.
Also modify 'MaxMarginalRelevanceExampleSelector' that inherits 'SemanticSimilarityExampleSelector’.
Copy link
Contributor

@hwchase17 hwchase17 left a comment

Choose a reason for hiding this comment

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

great catch! thanks

@hwchase17 hwchase17 merged commit 6a4ee07 into langchain-ai:master Mar 4, 2023
@ktanaka101 ktanaka101 deleted the fix-type-hint-of-vectorstore_cls-arg-in-from_examples branch March 4, 2023 10:08
zachschillaci27 pushed a commit to zachschillaci27/langchain that referenced this pull request Mar 8, 2023
…elector` (langchain-ai#1427)

Hello! Thank you for the amazing library you've created!

While following the tutorial at [the link(`Using an example
selector`)](https://langchain.readthedocs.io/en/latest/modules/prompts/examples/few_shot_examples.html#using-an-example-selector),
I noticed that passing Chroma as an argument to from_examples results in
a type hint error.

Error message(mypy):
```
Argument 3 to "from_examples" of "SemanticSimilarityExampleSelector" has incompatible type "Type[Chroma]"; expected "VectorStore"  [arg-type]mypy(error)
```

This pull request fixes the type hint and allows the VectorStore class
to be specified as an argument.
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.

2 participants