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

Harrison/typesense fix #6391

Merged
merged 2 commits into from
Jun 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions langchain/vectorstores/typesense.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ class Typesense(VectorStore):

embedding = OpenAIEmbeddings()
vectorstore = Typesense(
typesense_client,
typesense_collection_name,
embedding.embed_query,
"text",
typesense_client=typesense_client,
embedding=embedding,
typesense_collection_name=typesense_collection_name,
text_key="text",
)
"""

Expand Down Expand Up @@ -138,14 +138,15 @@ def add_texts(
def similarity_search_with_score(
self,
query: str,
k: int = 4,
k: int = 10,
filter: Optional[str] = "",
) -> List[Tuple[Document, float]]:
"""Return typesense documents most similar to query, along with scores.

Args:
query: Text to look up documents similar to.
k: Number of Documents to return. Defaults to 4.
k: Number of Documents to return. Defaults to 10.
Minimum 10 results would be returned.
filter: typesense filter_by expression to filter documents on

Returns:
Expand Down Expand Up @@ -173,15 +174,16 @@ def similarity_search_with_score(
def similarity_search(
self,
query: str,
k: int = 4,
k: int = 10,
filter: Optional[str] = "",
**kwargs: Any,
) -> List[Document]:
"""Return typesense documents most similar to query.

Args:
query: Text to look up documents similar to.
k: Number of Documents to return. Defaults to 4.
k: Number of Documents to return. Defaults to 10.
Minimum 10 results would be returned.
filter: typesense filter_by expression to filter documents on

Returns:
Expand Down