Spaces:
Running
Running
Merge branch 'main' of https://huggingface.co/spaces/vectara/legal-assistant
Browse files
agent.py
CHANGED
@@ -172,13 +172,28 @@ def create_assistant_tools(cfg):
|
|
172 |
vectara_customer_id=cfg.customer_id,
|
173 |
vectara_corpus_id=cfg.corpus_id)
|
174 |
summarizer = 'vectara-experimental-summary-ext-2023-12-11-med-omni'
|
|
|
175 |
ask_caselaw = vec_factory.create_rag_tool(
|
176 |
tool_name = "ask_caselaw",
|
177 |
tool_description = "A tool for asking questions about case law in Alaska.",
|
178 |
tool_args_schema = QueryCaselawArgs,
|
179 |
-
reranker = "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
180 |
n_sentences_before = 2, n_sentences_after = 2, lambda_val = 0.005,
|
181 |
-
summary_num_results =
|
182 |
vectara_summarizer = summarizer,
|
183 |
include_citations = False,
|
184 |
)
|
|
|
172 |
vectara_customer_id=cfg.customer_id,
|
173 |
vectara_corpus_id=cfg.corpus_id)
|
174 |
summarizer = 'vectara-experimental-summary-ext-2023-12-11-med-omni'
|
175 |
+
|
176 |
ask_caselaw = vec_factory.create_rag_tool(
|
177 |
tool_name = "ask_caselaw",
|
178 |
tool_description = "A tool for asking questions about case law in Alaska.",
|
179 |
tool_args_schema = QueryCaselawArgs,
|
180 |
+
reranker = "chain", rerank_k = 100,
|
181 |
+
rerank_chain = [
|
182 |
+
{
|
183 |
+
"type": "slingshot",
|
184 |
+
"cutoff": 0.2
|
185 |
+
},
|
186 |
+
{
|
187 |
+
"type": "mmr",
|
188 |
+
"diversity_bias": 0.1
|
189 |
+
},
|
190 |
+
{
|
191 |
+
"type": "udf",
|
192 |
+
"user_function": "max(1000 * get('$.score') - hours(seconds(to_unix_timestamp(now()) - to_unix_timestamp(datetime_parse(get('$.document_metadata.decision_date'), 'yyyy-MM-dd')))) / 24 / 365, 0)"
|
193 |
+
}
|
194 |
+
],
|
195 |
n_sentences_before = 2, n_sentences_after = 2, lambda_val = 0.005,
|
196 |
+
summary_num_results = 15,
|
197 |
vectara_summarizer = summarizer,
|
198 |
include_citations = False,
|
199 |
)
|