API Reference
vectara_agentic package.
Agent
Agent class for handling different types of agents and their interactions.
Source code in vectara_agentic/agent.py
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 |
|
__init__(tools, topic='general', custom_instructions='', verbose=True, update_func=None, agent_progress_callback=None, query_logging_callback=None, agent_config=None, chat_history=None, validate_tools=False)
Initialize the agent with the specified type, tools, topic, and system message.
Args:
tools (list[FunctionTool]): A list of tools to be used by the agent.
topic (str, optional): The topic for the agent. Defaults to 'general'.
custom_instructions (str, optional): Custom instructions for the agent. Defaults to ''.
verbose (bool, optional): Whether the agent should print its steps. Defaults to True.
agent_progress_callback (Callable): A callback function the code calls on any agent updates.
update_func (Callable): old name for agent_progress_callback. Will be deprecated in future.
query_logging_callback (Callable): A callback function the code calls upon completion of a query
agent_config (AgentConfig, optional): The configuration of the agent.
Defaults to AgentConfig(), which reads from environment variables.
chat_history (Tuple[str, str], optional): A list of user/agent chat pairs to initialize the agent memory.
validate_tools (bool, optional): Whether to validate tool inconsistency with instructions.
Defaults to False.
Source code in vectara_agentic/agent.py
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 |
|
achat(prompt)
async
Interact with the agent using a chat prompt.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
prompt
|
str
|
The chat prompt. |
required |
Returns:
Name | Type | Description |
---|---|---|
AgentResponse |
AgentResponse
|
The response from the agent. |
Source code in vectara_agentic/agent.py
582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 |
|
astream_chat(prompt)
async
Interact with the agent using a chat prompt asynchronously with streaming. Args: prompt (str): The chat prompt. Returns: AgentStreamingResponse: The streaming response from the agent.
Source code in vectara_agentic/agent.py
628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 |
|
chat(prompt)
Interact with the agent using a chat prompt.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
prompt
|
str
|
The chat prompt. |
required |
Returns:
Name | Type | Description |
---|---|---|
AgentResponse |
AgentResponse
|
The response from the agent. |
Source code in vectara_agentic/agent.py
570 571 572 573 574 575 576 577 578 579 580 |
|
clear_memory()
Clear the agent's memory.
Source code in vectara_agentic/agent.py
287 288 289 290 291 |
|
dumps()
Serialize the Agent instance to a JSON string.
Source code in vectara_agentic/agent.py
668 669 670 |
|
from_corpus(tool_name, data_description, assistant_specialty, vectara_corpus_key=str(os.environ.get('VECTARA_CORPUS_KEY', '')), vectara_api_key=str(os.environ.get('VECTARA_API_KEY', '')), agent_progress_callback=None, query_logging_callback=None, verbose=False, vectara_filter_fields=[], vectara_offset=0, vectara_lambda_val=0.005, vectara_semantics='default', vectara_custom_dimensions={}, vectara_reranker='slingshot', vectara_rerank_k=50, vectara_rerank_limit=None, vectara_rerank_cutoff=None, vectara_diversity_bias=0.2, vectara_udf_expression=None, vectara_rerank_chain=None, vectara_n_sentences_before=2, vectara_n_sentences_after=2, vectara_summary_num_results=10, vectara_summarizer='vectara-summary-ext-24-05-med-omni', vectara_summary_response_language='eng', vectara_summary_prompt_text=None, vectara_max_response_chars=None, vectara_max_tokens=None, vectara_temperature=None, vectara_frequency_penalty=None, vectara_presence_penalty=None, vectara_save_history=True)
classmethod
Create an agent from a single Vectara corpus
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tool_name
|
str
|
The name of Vectara tool used by the agent |
required |
vectara_corpus_key
|
str
|
The Vectara corpus key (or comma separated list of keys). |
str(get('VECTARA_CORPUS_KEY', ''))
|
vectara_api_key
|
str
|
The Vectara API key. |
str(get('VECTARA_API_KEY', ''))
|
agent_progress_callback
|
Callable
|
A callback function the code calls on any agent updates. |
None
|
query_logging_callback
|
Callable
|
A callback function the code calls upon completion of a query |
None
|
data_description
|
str
|
The description of the data. |
required |
assistant_specialty
|
str
|
The specialty of the assistant. |
required |
verbose
|
bool
|
Whether to print verbose output. |
False
|
vectara_filter_fields
|
List[dict]
|
The filterable attributes (each dict maps field name to Tuple[type, description]). |
[]
|
vectara_offset
|
int
|
Number of results to skip. |
0
|
vectara_lambda_val
|
float
|
Lambda value for Vectara hybrid search. |
0.005
|
vectara_semantics
|
str
|
(str, optional): Indicates whether the query is intended as a query or response. |
'default'
|
vectara_custom_dimensions
|
Dict
|
(Dict, optional): Custom dimensions for the query. |
{}
|
vectara_reranker
|
str
|
The Vectara reranker name (default "slingshot") |
'slingshot'
|
vectara_rerank_k
|
int
|
The number of results to use with reranking. |
50
|
vectara_rerank_limit
|
Optional[int]
|
(int, optional): The maximum number of results to return after reranking. |
None
|
vectara_rerank_cutoff
|
Optional[float]
|
(float, optional): The minimum score threshold for results to include after reranking. |
None
|
vectara_diversity_bias
|
float
|
The MMR diversity bias. |
0.2
|
vectara_udf_expression
|
str
|
The user defined expression for reranking results. |
None
|
vectara_rerank_chain
|
List[Dict]
|
A list of Vectara rerankers to be applied sequentially. |
None
|
vectara_n_sentences_before
|
int
|
The number of sentences before the matching text |
2
|
vectara_n_sentences_after
|
int
|
The number of sentences after the matching text. |
2
|
vectara_summary_num_results
|
int
|
The number of results to use in summarization. |
10
|
vectara_summarizer
|
str
|
The Vectara summarizer name. |
'vectara-summary-ext-24-05-med-omni'
|
vectara_summary_response_language
|
str
|
The response language for the Vectara summary. |
'eng'
|
vectara_summary_prompt_text
|
str
|
The custom prompt, using appropriate prompt variables and functions. |
None
|
vectara_max_response_chars
|
int
|
The desired maximum number of characters for the generated summary. |
None
|
vectara_max_tokens
|
int
|
The maximum number of tokens to be returned by the LLM. |
None
|
vectara_temperature
|
float
|
The sampling temperature; higher values lead to more randomness. |
None
|
vectara_frequency_penalty
|
float
|
How much to penalize repeating tokens in the response, higher values reducing likelihood of repeating the same line. |
None
|
vectara_presence_penalty
|
float
|
How much to penalize repeating tokens in the response, higher values increasing the diversity of topics. |
None
|
vectara_save_history
|
bool
|
Whether to save the query in history. |
True
|
Returns:
Name | Type | Description |
---|---|---|
Agent |
Agent
|
An instance of the Agent class. |
Source code in vectara_agentic/agent.py
383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 |
|
from_dict(data)
classmethod
Create an Agent instance from a dictionary.
Source code in vectara_agentic/agent.py
707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 |
|
from_tools(tools, topic='general', custom_instructions='', verbose=True, update_func=None, agent_progress_callback=None, query_logging_callback=None, agent_config=AgentConfig(), chat_history=None)
classmethod
Create an agent from tools, agent type, and language model.
Args:
tools (list[FunctionTool]): A list of tools to be used by the agent.
topic (str, optional): The topic for the agent. Defaults to 'general'.
custom_instructions (str, optional): custom instructions for the agent. Defaults to ''.
verbose (bool, optional): Whether the agent should print its steps. Defaults to True.
agent_progress_callback (Callable): A callback function the code calls on any agent updates.
update_func (Callable): old name for agent_progress_callback. Will be deprecated in future.
query_logging_callback (Callable): A callback function the code calls upon completion of a query
agent_config (AgentConfig, optional): The configuration of the agent.
chat_history (Tuple[str, str], optional): A list of user/agent chat pairs to initialize the agent memory.
Returns:
Name | Type | Description |
---|---|---|
Agent |
Agent
|
An instance of the Agent class. |
Source code in vectara_agentic/agent.py
344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 |
|
loads(data)
classmethod
Create an Agent instance from a JSON string.
Source code in vectara_agentic/agent.py
672 673 674 675 |
|
report()
Get a report from the agent.
Returns:
Name | Type | Description |
---|---|---|
str |
None
|
The report from the agent. |
Source code in vectara_agentic/agent.py
531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 |
|
stream_chat(prompt)
Interact with the agent using a chat prompt with streaming. Args: prompt (str): The chat prompt. Returns: AgentStreamingResponse: The streaming response from the agent.
Source code in vectara_agentic/agent.py
618 619 620 621 622 623 624 625 626 |
|
to_dict()
Serialize the Agent instance to a dictionary.
Source code in vectara_agentic/agent.py
677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 |
|
token_counts()
Get the token counts for the agent and tools.
Returns:
Name | Type | Description |
---|---|---|
dict |
dict
|
The token counts for the agent and tools. |
Source code in vectara_agentic/agent.py
550 551 552 553 554 555 556 557 558 559 560 |
|
VectaraTool
Bases: FunctionTool
A subclass of FunctionTool adding the tool_type attribute.
Source code in vectara_agentic/tools.py
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 |
|
VectaraToolFactory
A factory class for creating Vectara RAG tools.
Source code in vectara_agentic/tools.py
296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 |
|
__init__(vectara_corpus_key=str(os.environ.get('VECTARA_CORPUS_KEY', '')), vectara_api_key=str(os.environ.get('VECTARA_API_KEY', '')))
Initialize the VectaraToolFactory Args: vectara_corpus_key (str): The Vectara corpus key (or comma separated list of keys). vectara_api_key (str): The Vectara API key.
Source code in vectara_agentic/tools.py
301 302 303 304 305 306 307 308 309 310 311 312 313 314 |
|
create_rag_tool(tool_name, tool_description, tool_args_schema, tool_args_type={}, fixed_filter='', vectara_summarizer='vectara-summary-ext-24-05-med-omni', vectara_prompt_text=None, summary_num_results=5, summary_response_lang='eng', n_sentences_before=2, n_sentences_after=2, offset=0, lambda_val=0.005, semantics='default', custom_dimensions={}, reranker='slingshot', rerank_k=50, rerank_limit=None, rerank_cutoff=None, mmr_diversity_bias=0.2, udf_expression=None, rerank_chain=None, max_response_chars=None, max_tokens=None, temperature=None, frequency_penalty=None, presence_penalty=None, include_citations=True, save_history=False, fcs_threshold=0.0, verbose=False, vectara_base_url='https://api.vectara.io', vectara_verify_ssl=True)
Creates a RAG (Retrieve and Generate) tool.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tool_name
|
str
|
The name of the tool. |
required |
tool_description
|
str
|
The description of the tool. |
required |
tool_args_schema
|
BaseModel
|
The schema for the tool arguments. |
required |
tool_args_type
|
Dict[str, dict]
|
attributes for each argument where they key is the field name and the value is a dictionary with the following keys: - 'type': the type of each filter attribute in Vectara (doc or part). - 'is_list': whether the filterable attribute is a list. |
{}
|
fixed_filter
|
str
|
A fixed Vectara filter condition to apply to all queries. |
''
|
vectara_summarizer
|
str
|
The Vectara summarizer to use. |
'vectara-summary-ext-24-05-med-omni'
|
vectara_prompt_text
|
str
|
The prompt text for the Vectara summarizer. |
None
|
summary_num_results
|
int
|
The number of summary results. |
5
|
summary_response_lang
|
str
|
The response language for the summary. |
'eng'
|
n_sentences_before
|
int
|
Number of sentences before the summary. |
2
|
n_sentences_after
|
int
|
Number of sentences after the summary. |
2
|
offset
|
int
|
Number of results to skip. |
0
|
lambda_val
|
Union[List[float] | float]
|
Lambda value (or list of values for each corpora) for the Vectara query, when using hybrid search. |
0.005
|
semantics
|
Union[List[str], str]
|
Indicates whether the query is intended as a query or response. Include list if using multiple corpora specifying the query type for each corpus. |
'default'
|
custom_dimensions
|
Union[List[Dict] | Dict]
|
Custom dimensions for the query (for each corpora). |
{}
|
reranker
|
str
|
The reranker mode. |
'slingshot'
|
rerank_k
|
int
|
Number of top-k documents for reranking. |
50
|
rerank_limit
|
int
|
Maximum number of results to return after reranking. |
None
|
rerank_cutoff
|
float
|
Minimum score threshold for results to include after reranking. |
None
|
mmr_diversity_bias
|
float
|
MMR diversity bias. |
0.2
|
udf_expression
|
str
|
The user defined expression for reranking results. |
None
|
rerank_chain
|
List[Dict]
|
A list of rerankers to be applied sequentially. Each dictionary should specify the "type" of reranker (mmr, slingshot, udf) and any other parameters (e.g. "limit" or "cutoff" for any type, "diversity_bias" for mmr, and "user_function" for udf). If using slingshot/multilingual_reranker_v1, it must be first in the list. |
None
|
max_response_chars
|
int
|
The desired maximum number of characters for the generated summary. |
None
|
max_tokens
|
int
|
The maximum number of tokens to be returned by the LLM. |
None
|
temperature
|
float
|
The sampling temperature; higher values lead to more randomness. |
None
|
frequency_penalty
|
float
|
How much to penalize repeating tokens in the response, higher values reducing likelihood of repeating the same line. |
None
|
presence_penalty
|
float
|
How much to penalize repeating tokens in the response, higher values increasing the diversity of topics. |
None
|
include_citations
|
bool
|
Whether to include citations in the response. If True, uses markdown vectara citations that requires the Vectara scale plan. |
True
|
save_history
|
bool
|
Whether to save the query in history. |
False
|
fcs_threshold
|
float
|
A threshold for factual consistency. If set above 0, the tool notifies the calling agent that it "cannot respond" if FCS is too low. |
0.0
|
verbose
|
bool
|
Whether to print verbose output. |
False
|
vectara_base_url
|
str
|
The base URL for the Vectara API. |
'https://api.vectara.io'
|
vectara_verify_ssl
|
bool
|
Whether to verify SSL certificates for the Vectara API. |
True
|
Returns:
Name | Type | Description |
---|---|---|
VectaraTool |
VectaraTool
|
A VectaraTool object. |
Source code in vectara_agentic/tools.py
491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 |
|
create_search_tool(tool_name, tool_description, tool_args_schema, tool_args_type={}, fixed_filter='', lambda_val=0.005, semantics='default', custom_dimensions={}, offset=0, n_sentences_before=2, n_sentences_after=2, reranker='slingshot', rerank_k=50, rerank_limit=None, rerank_cutoff=None, mmr_diversity_bias=0.2, udf_expression=None, rerank_chain=None, save_history=True, verbose=False, vectara_base_url='https://api.vectara.io', vectara_verify_ssl=True)
Creates a Vectara search/retrieval tool
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tool_name
|
str
|
The name of the tool. |
required |
tool_description
|
str
|
The description of the tool. |
required |
tool_args_schema
|
BaseModel
|
The schema for the tool arguments. |
required |
tool_args_type
|
Dict[str, str]
|
The type of each argument (doc or part). |
{}
|
fixed_filter
|
str
|
A fixed Vectara filter condition to apply to all queries. |
''
|
lambda_val
|
Union[List[float] | float]
|
Lambda value (or list of values for each corpora) for the Vectara query, when using hybrid search. |
0.005
|
semantics
|
Union[List[str], str]
|
Indicates whether the query is intended as a query or response. Include list if using multiple corpora specifying the query type for each corpus. |
'default'
|
custom_dimensions
|
Union[List[Dict] | Dict]
|
Custom dimensions for the query (for each corpora). |
{}
|
offset
|
int
|
Number of results to skip. |
0
|
n_sentences_before
|
int
|
Number of sentences before the matching document part. |
2
|
n_sentences_after
|
int
|
Number of sentences after the matching document part. |
2
|
reranker
|
str
|
The reranker mode. |
'slingshot'
|
rerank_k
|
int
|
Number of top-k documents for reranking. |
50
|
rerank_limit
|
int
|
Maximum number of results to return after reranking. |
None
|
rerank_cutoff
|
float
|
Minimum score threshold for results to include after reranking. |
None
|
mmr_diversity_bias
|
float
|
MMR diversity bias. |
0.2
|
udf_expression
|
str
|
the user defined expression for reranking results. |
None
|
rerank_chain
|
List[Dict]
|
A list of rerankers to be applied sequentially. Each dictionary should specify the "type" of reranker (mmr, slingshot, udf) and any other parameters (e.g. "limit" or "cutoff" for any type, "diversity_bias" for mmr, and "user_function" for udf). If using slingshot/multilingual_reranker_v1, it must be first in the list. |
None
|
save_history
|
bool
|
Whether to save the query in history. |
True
|
verbose
|
bool
|
Whether to print verbose output. |
False
|
vectara_base_url
|
str
|
The base URL for the Vectara API. |
'https://api.vectara.io'
|
vectara_verify_ssl
|
bool
|
Whether to verify SSL certificates for the Vectara API. |
True
|
Returns:
Name | Type | Description |
---|---|---|
VectaraTool |
VectaraTool
|
A VectaraTool object. |
Source code in vectara_agentic/tools.py
316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 |
|