Spaces:
Sleeping
Sleeping
Update app.py
Browse filesargument anno change
app.py
CHANGED
|
@@ -99,7 +99,7 @@ class SimilarityModel:
|
|
| 99 |
|
| 100 |
return tool_description_embeddings
|
| 101 |
|
| 102 |
-
def find_similar_tools(self, query: str, tools_list:
|
| 103 |
"""
|
| 104 |
Finds the top_k most similar tools to a given query using Sentence Transformer embeddings.
|
| 105 |
|
|
@@ -107,6 +107,7 @@ class SimilarityModel:
|
|
| 107 |
query: The user query string.
|
| 108 |
tools_list: JSON instance, list of dict where each dict represents a tool declaration.
|
| 109 |
top_k: The number of top similar tools to return.
|
|
|
|
| 110 |
|
| 111 |
Returns:
|
| 112 |
A string containing the names and descriptions of the top_k similar tools, formatted for clarity.
|
|
|
|
| 99 |
|
| 100 |
return tool_description_embeddings
|
| 101 |
|
| 102 |
+
def find_similar_tools(self, query: str, tools_list: list[dict], top_k: int, cache_tool_embs: bool= True)-> list[dict]:
|
| 103 |
"""
|
| 104 |
Finds the top_k most similar tools to a given query using Sentence Transformer embeddings.
|
| 105 |
|
|
|
|
| 107 |
query: The user query string.
|
| 108 |
tools_list: JSON instance, list of dict where each dict represents a tool declaration.
|
| 109 |
top_k: The number of top similar tools to return.
|
| 110 |
+
cache_tool_embs: What to cache tools embs? Default is True.
|
| 111 |
|
| 112 |
Returns:
|
| 113 |
A string containing the names and descriptions of the top_k similar tools, formatted for clarity.
|