mirror of
https://github.com/hwchase17/langchain.git
synced 2025-05-15 12:02:11 +00:00
Use args option in jaguar so it takes more options in similarity search (#15080)
- **Description:** replace score_threshold with args - **Issue:** needs a way to pass more options to similarity search - **Dependencies:** None - **Twitter handle:** @workbot --------- Co-authored-by: JY <jyjy@jaguardb>
This commit is contained in:
parent
37ad6ec248
commit
02f59c2035
@ -176,7 +176,8 @@ class Jaguar(VectorStore):
|
||||
podstore = self._pod + "." + self._store
|
||||
q = "insert into " + podstore + " ("
|
||||
q += vcol + "," + textcol + ") values ('" + values_comma
|
||||
q += "','" + texts[i] + "')"
|
||||
txt = texts[i].replace("'", "\\'")
|
||||
q += "','" + txt + "')"
|
||||
js = self.run(q, False)
|
||||
ids.append(js["zid"])
|
||||
i += 1
|
||||
@ -199,7 +200,8 @@ class Jaguar(VectorStore):
|
||||
podstore = self._pod + "." + self._store
|
||||
q = "insert into " + podstore + " ("
|
||||
q += names_comma + "," + textcol + ") values (" + values_comma
|
||||
q += ",'" + texts[i] + "')"
|
||||
txt = texts[i].replace("'", "\\'")
|
||||
q += ",'" + txt + "')"
|
||||
if filecol != "":
|
||||
js = self.run(q, True)
|
||||
else:
|
||||
@ -215,7 +217,7 @@ class Jaguar(VectorStore):
|
||||
k: int = 3,
|
||||
fetch_k: int = -1,
|
||||
where: Optional[str] = None,
|
||||
score_threshold: Optional[float] = -1.0,
|
||||
args: Optional[str] = None,
|
||||
metadatas: Optional[List[str]] = None,
|
||||
**kwargs: Any,
|
||||
) -> List[Tuple[Document, float]]:
|
||||
@ -227,9 +229,7 @@ class Jaguar(VectorStore):
|
||||
lambda_val: lexical match parameter for hybrid search.
|
||||
where: the where clause in select similarity. For example a
|
||||
where can be "rating > 3.0 and (state = 'NV' or state = 'CA')"
|
||||
score_threshold: minimal score threshold for the result.
|
||||
If defined, results with score less than this value will be
|
||||
filtered out.
|
||||
args: extra options passed to select similarity
|
||||
kwargs: vector_index=vcol, vector_type=cosine_fraction_float
|
||||
Returns:
|
||||
List of Documents most similar to the query and score for each.
|
||||
@ -254,7 +254,9 @@ class Jaguar(VectorStore):
|
||||
+ ",type="
|
||||
+ vtype
|
||||
)
|
||||
q += ",with_score=yes,with_text=yes,score_threshold=" + str(score_threshold)
|
||||
q += ",with_score=yes,with_text=yes"
|
||||
if args is not None:
|
||||
q += "," + args
|
||||
|
||||
if metadatas is not None:
|
||||
meta = "&".join(metadatas)
|
||||
|
Loading…
Reference in New Issue
Block a user