mirror of
https://github.com/hwchase17/langchain
synced 2024-11-18 09:25:54 +00:00
Harrison/typesense fix (#6391)
Co-authored-by: Gaurav Chauhan <2796gaurav@gmail.com> Co-authored-by: gaurav <gaurav.chauhan1@rksv.in>
This commit is contained in:
parent
5ccebce777
commit
5c1fa3e70e
@ -42,10 +42,10 @@ class Typesense(VectorStore):
|
|||||||
|
|
||||||
embedding = OpenAIEmbeddings()
|
embedding = OpenAIEmbeddings()
|
||||||
vectorstore = Typesense(
|
vectorstore = Typesense(
|
||||||
typesense_client,
|
typesense_client=typesense_client,
|
||||||
typesense_collection_name,
|
embedding=embedding,
|
||||||
embedding.embed_query,
|
typesense_collection_name=typesense_collection_name,
|
||||||
"text",
|
text_key="text",
|
||||||
)
|
)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@ -138,14 +138,15 @@ class Typesense(VectorStore):
|
|||||||
def similarity_search_with_score(
|
def similarity_search_with_score(
|
||||||
self,
|
self,
|
||||||
query: str,
|
query: str,
|
||||||
k: int = 4,
|
k: int = 10,
|
||||||
filter: Optional[str] = "",
|
filter: Optional[str] = "",
|
||||||
) -> List[Tuple[Document, float]]:
|
) -> List[Tuple[Document, float]]:
|
||||||
"""Return typesense documents most similar to query, along with scores.
|
"""Return typesense documents most similar to query, along with scores.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
query: Text to look up documents similar to.
|
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
|
filter: typesense filter_by expression to filter documents on
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
@ -173,7 +174,7 @@ class Typesense(VectorStore):
|
|||||||
def similarity_search(
|
def similarity_search(
|
||||||
self,
|
self,
|
||||||
query: str,
|
query: str,
|
||||||
k: int = 4,
|
k: int = 10,
|
||||||
filter: Optional[str] = "",
|
filter: Optional[str] = "",
|
||||||
**kwargs: Any,
|
**kwargs: Any,
|
||||||
) -> List[Document]:
|
) -> List[Document]:
|
||||||
@ -181,7 +182,8 @@ class Typesense(VectorStore):
|
|||||||
|
|
||||||
Args:
|
Args:
|
||||||
query: Text to look up documents similar to.
|
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
|
filter: typesense filter_by expression to filter documents on
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
Loading…
Reference in New Issue
Block a user