Skip to content

The agent engineering platform.

Use args option in jaguar so it takes more options in similarity search (#15080)

JaguarDB02f59c2035ed
diff --git a/libs/community/langchain_community/vectorstores/jaguar.py b/libs/community/langchain_community/vectorstores/jaguar.py
index f9cce66c42..688cc81fa1 100644
--- a/libs/community/langchain_community/vectorstores/jaguar.py
+++ b/libs/community/langchain_community/vectorstores/jaguar.py
@@ -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)