vectara-agentic 0.3.2__tar.gz → 0.4.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. {vectara_agentic-0.3.2/vectara_agentic.egg-info → vectara_agentic-0.4.0}/PKG-INFO +69 -30
  2. {vectara_agentic-0.3.2 → vectara_agentic-0.4.0}/README.md +48 -9
  3. {vectara_agentic-0.3.2 → vectara_agentic-0.4.0}/requirements.txt +20 -20
  4. vectara_agentic-0.4.0/tests/__init__.py +7 -0
  5. vectara_agentic-0.4.0/tests/conftest.py +312 -0
  6. vectara_agentic-0.4.0/tests/endpoint.py +84 -0
  7. vectara_agentic-0.4.0/tests/run_tests.py +111 -0
  8. {vectara_agentic-0.3.2 → vectara_agentic-0.4.0}/tests/test_agent.py +10 -5
  9. vectara_agentic-0.4.0/tests/test_agent_type.py +139 -0
  10. {vectara_agentic-0.3.2 → vectara_agentic-0.4.0}/tests/test_api_endpoint.py +4 -0
  11. {vectara_agentic-0.3.2 → vectara_agentic-0.4.0}/tests/test_bedrock.py +4 -0
  12. {vectara_agentic-0.3.2 → vectara_agentic-0.4.0}/tests/test_fallback.py +4 -0
  13. vectara_agentic-0.4.0/tests/test_gemini.py +98 -0
  14. {vectara_agentic-0.3.2 → vectara_agentic-0.4.0}/tests/test_groq.py +4 -0
  15. {vectara_agentic-0.3.2 → vectara_agentic-0.4.0}/tests/test_private_llm.py +11 -2
  16. {vectara_agentic-0.3.2 → vectara_agentic-0.4.0}/tests/test_return_direct.py +6 -2
  17. {vectara_agentic-0.3.2 → vectara_agentic-0.4.0}/tests/test_serialization.py +4 -0
  18. vectara_agentic-0.4.0/tests/test_streaming.py +88 -0
  19. {vectara_agentic-0.3.2 → vectara_agentic-0.4.0}/tests/test_tools.py +10 -82
  20. {vectara_agentic-0.3.2 → vectara_agentic-0.4.0}/tests/test_vectara_llms.py +4 -0
  21. vectara_agentic-0.4.0/tests/test_vhc.py +66 -0
  22. {vectara_agentic-0.3.2 → vectara_agentic-0.4.0}/tests/test_workflow.py +4 -0
  23. {vectara_agentic-0.3.2 → vectara_agentic-0.4.0}/vectara_agentic/__init__.py +27 -4
  24. {vectara_agentic-0.3.2 → vectara_agentic-0.4.0}/vectara_agentic/_callback.py +65 -67
  25. {vectara_agentic-0.3.2 → vectara_agentic-0.4.0}/vectara_agentic/_observability.py +30 -30
  26. {vectara_agentic-0.3.2 → vectara_agentic-0.4.0}/vectara_agentic/_version.py +1 -1
  27. vectara_agentic-0.4.0/vectara_agentic/agent.py +925 -0
  28. {vectara_agentic-0.3.2 → vectara_agentic-0.4.0}/vectara_agentic/agent_config.py +15 -14
  29. vectara_agentic-0.4.0/vectara_agentic/agent_core/__init__.py +22 -0
  30. vectara_agentic-0.4.0/vectara_agentic/agent_core/factory.py +501 -0
  31. vectara_agentic-0.3.2/vectara_agentic/_prompts.py → vectara_agentic-0.4.0/vectara_agentic/agent_core/prompts.py +3 -35
  32. vectara_agentic-0.4.0/vectara_agentic/agent_core/serialization.py +345 -0
  33. vectara_agentic-0.4.0/vectara_agentic/agent_core/streaming.py +495 -0
  34. vectara_agentic-0.4.0/vectara_agentic/agent_core/utils/__init__.py +34 -0
  35. vectara_agentic-0.4.0/vectara_agentic/agent_core/utils/hallucination.py +202 -0
  36. vectara_agentic-0.4.0/vectara_agentic/agent_core/utils/logging.py +52 -0
  37. vectara_agentic-0.4.0/vectara_agentic/agent_core/utils/prompt_formatting.py +56 -0
  38. vectara_agentic-0.4.0/vectara_agentic/agent_core/utils/schemas.py +87 -0
  39. vectara_agentic-0.4.0/vectara_agentic/agent_core/utils/tools.py +125 -0
  40. {vectara_agentic-0.3.2 → vectara_agentic-0.4.0}/vectara_agentic/agent_endpoint.py +4 -6
  41. {vectara_agentic-0.3.2 → vectara_agentic-0.4.0}/vectara_agentic/db_tools.py +37 -12
  42. {vectara_agentic-0.3.2 → vectara_agentic-0.4.0}/vectara_agentic/llm_utils.py +41 -42
  43. {vectara_agentic-0.3.2 → vectara_agentic-0.4.0}/vectara_agentic/sub_query_workflow.py +9 -14
  44. {vectara_agentic-0.3.2 → vectara_agentic-0.4.0}/vectara_agentic/tool_utils.py +138 -83
  45. {vectara_agentic-0.3.2 → vectara_agentic-0.4.0}/vectara_agentic/tools.py +43 -21
  46. {vectara_agentic-0.3.2 → vectara_agentic-0.4.0}/vectara_agentic/tools_catalog.py +16 -16
  47. vectara_agentic-0.4.0/vectara_agentic/types.py +183 -0
  48. {vectara_agentic-0.3.2 → vectara_agentic-0.4.0/vectara_agentic.egg-info}/PKG-INFO +69 -30
  49. {vectara_agentic-0.3.2 → vectara_agentic-0.4.0}/vectara_agentic.egg-info/SOURCES.txt +16 -5
  50. {vectara_agentic-0.3.2 → vectara_agentic-0.4.0}/vectara_agentic.egg-info/requires.txt +20 -20
  51. vectara_agentic-0.3.2/tests/__init__.py +0 -0
  52. vectara_agentic-0.3.2/tests/endpoint.py +0 -47
  53. vectara_agentic-0.3.2/tests/test_agent_planning.py +0 -64
  54. vectara_agentic-0.3.2/tests/test_agent_type.py +0 -200
  55. vectara_agentic-0.3.2/tests/test_gemini.py +0 -115
  56. vectara_agentic-0.3.2/tests/test_hhem.py +0 -100
  57. vectara_agentic-0.3.2/vectara_agentic/agent.py +0 -1398
  58. vectara_agentic-0.3.2/vectara_agentic/hhem.py +0 -82
  59. vectara_agentic-0.3.2/vectara_agentic/types.py +0 -91
  60. {vectara_agentic-0.3.2 → vectara_agentic-0.4.0}/LICENSE +0 -0
  61. {vectara_agentic-0.3.2 → vectara_agentic-0.4.0}/MANIFEST.in +0 -0
  62. {vectara_agentic-0.3.2 → vectara_agentic-0.4.0}/setup.cfg +0 -0
  63. {vectara_agentic-0.3.2 → vectara_agentic-0.4.0}/setup.py +0 -0
  64. {vectara_agentic-0.3.2 → vectara_agentic-0.4.0}/vectara_agentic/utils.py +0 -0
  65. {vectara_agentic-0.3.2 → vectara_agentic-0.4.0}/vectara_agentic.egg-info/dependency_links.txt +0 -0
  66. {vectara_agentic-0.3.2 → vectara_agentic-0.4.0}/vectara_agentic.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: vectara_agentic
3
- Version: 0.3.2
3
+ Version: 0.4.0
4
4
  Summary: A Python package for creating AI Assistants and AI Agents with Vectara
5
5
  Home-page: https://github.com/vectara/py-vectara-agentic
6
6
  Author: Ofer Mendelevitch
@@ -16,26 +16,26 @@ Classifier: Topic :: Software Development :: Libraries :: Python Modules
16
16
  Requires-Python: >=3.10
17
17
  Description-Content-Type: text/markdown
18
18
  License-File: LICENSE
19
- Requires-Dist: llama-index==0.12.37
20
- Requires-Dist: llama-index-core==0.12.37
21
- Requires-Dist: llama-index-cli==0.4.1
19
+ Requires-Dist: llama-index==0.12.49
20
+ Requires-Dist: llama-index-core==0.12.49
21
+ Requires-Dist: llama-index-workflow==1.0.1
22
+ Requires-Dist: llama-index-cli==0.4.4
22
23
  Requires-Dist: llama-index-indices-managed-vectara==0.4.5
23
- Requires-Dist: llama-index-agent-llm-compiler==0.3.1
24
- Requires-Dist: llama-index-agent-lats==0.3.0
25
- Requires-Dist: llama-index-agent-openai==0.4.8
26
- Requires-Dist: llama-index-llms-openai==0.3.44
27
- Requires-Dist: llama-index-llms-openai-like==0.3.5
28
- Requires-Dist: llama-index-llms-anthropic==0.6.19
29
- Requires-Dist: llama-index-llms-together==0.3.1
30
- Requires-Dist: llama-index-llms-groq==0.3.1
31
- Requires-Dist: llama-index-llms-fireworks==0.3.2
24
+ Requires-Dist: llama-index-agent-llm-compiler==0.3.2
25
+ Requires-Dist: llama-index-agent-lats==0.3.2
26
+ Requires-Dist: llama-index-agent-openai==0.4.12
27
+ Requires-Dist: llama-index-llms-openai==0.4.7
28
+ Requires-Dist: llama-index-llms-openai-like==0.4.0
29
+ Requires-Dist: llama-index-llms-anthropic==0.7.6
30
+ Requires-Dist: llama-index-llms-together==0.3.2
31
+ Requires-Dist: llama-index-llms-groq==0.3.2
32
32
  Requires-Dist: llama-index-llms-cohere==0.5.0
33
- Requires-Dist: llama-index-llms-google-genai==0.2.1
34
- Requires-Dist: llama-index-llms-bedrock-converse==0.7.1
33
+ Requires-Dist: llama-index-llms-google-genai==0.2.5
34
+ Requires-Dist: llama-index-llms-bedrock-converse==0.7.6
35
35
  Requires-Dist: llama-index-tools-yahoo-finance==0.3.0
36
36
  Requires-Dist: llama-index-tools-arxiv==0.3.0
37
37
  Requires-Dist: llama-index-tools-database==0.3.0
38
- Requires-Dist: llama-index-tools-google==0.3.1
38
+ Requires-Dist: llama-index-tools-google==0.5.0
39
39
  Requires-Dist: llama-index-tools-tavily_research==0.3.0
40
40
  Requires-Dist: llama_index.tools.brave_search==0.3.0
41
41
  Requires-Dist: llama-index-tools-neo4j==0.3.0
@@ -44,11 +44,11 @@ Requires-Dist: llama-index-graph-stores-kuzu==0.7.0
44
44
  Requires-Dist: llama-index-tools-salesforce==0.3.0
45
45
  Requires-Dist: llama-index-tools-slack==0.3.0
46
46
  Requires-Dist: llama-index-tools-exa==0.3.0
47
- Requires-Dist: llama-index-tools-wikipedia==0.3.0
47
+ Requires-Dist: llama-index-tools-wikipedia==0.3.1
48
48
  Requires-Dist: llama-index-tools-bing-search==0.3.0
49
- Requires-Dist: openai>=1.82.1
50
- Requires-Dist: tavily-python==0.7.3
51
- Requires-Dist: exa-py==1.13.1
49
+ Requires-Dist: openai>=1.96.1
50
+ Requires-Dist: tavily-python>=0.7.9
51
+ Requires-Dist: exa-py>=1.14.8
52
52
  Requires-Dist: openinference-instrumentation-llama-index==4.3.1
53
53
  Requires-Dist: opentelemetry-proto>=1.31.0
54
54
  Requires-Dist: arize-phoenix==10.9.1
@@ -56,9 +56,9 @@ Requires-Dist: arize-phoenix-otel==0.10.3
56
56
  Requires-Dist: protobuf==5.29.3
57
57
  Requires-Dist: tokenizers>=0.20
58
58
  Requires-Dist: pydantic==2.11.5
59
+ Requires-Dist: pandas==2.2.3
59
60
  Requires-Dist: retrying==1.3.4
60
61
  Requires-Dist: python-dotenv==1.0.1
61
- Requires-Dist: tiktoken==0.9.0
62
62
  Requires-Dist: cloudpickle>=3.1.1
63
63
  Requires-Dist: httpx==0.28.1
64
64
  Requires-Dist: commonmark==0.9.1
@@ -108,6 +108,7 @@ Dynamic: summary
108
108
  - [Using Tools](#using-tools)
109
109
  - [Advanced Usage: Workflows](#advanced-usage-workflows)
110
110
  - [Configuration](#️-configuration)
111
+ - [Migrating from v0.3.x](#-migrating-from-v03x)
111
112
  - [Contributing](#-contributing)
112
113
  - [License](#-license)
113
114
 
@@ -124,11 +125,11 @@ Dynamic: summary
124
125
  - **Rapid Tool Creation:**
125
126
  Build Vectara RAG tools or search tools with a single line of code.
126
127
  - **Agent Flexibility:**
127
- Supports multiple agent types including `ReAct`, `OpenAIAgent`, `LATS`, and `LLMCompiler`.
128
+ Supports multiple agent types including `ReAct`, `Function Calling`, `LATS`, and `LLMCompiler`.
128
129
  - **Pre-Built Domain Tools:**
129
130
  Tools tailored for finance, legal, and other verticals.
130
131
  - **Multi-LLM Integration:**
131
- Seamless integration with OpenAI, Anthropic, Gemini, GROQ, Together.AI, Cohere, Bedrock, and Fireworks.
132
+ Seamless integration with OpenAI, Anthropic, Gemini, GROQ, Together.AI, Cohere, and Bedrock.
132
133
  - **Observability:**
133
134
  Built-in support with Arize Phoenix for monitoring and feedback.
134
135
  - **Workflow Support:**
@@ -148,7 +149,7 @@ Check out our example AI assistants:
148
149
  - [Vectara account](https://console.vectara.com/signup/?utm_source=github&utm_medium=code&utm_term=DevRel&utm_content=vectara-agentic&utm_campaign=github-code-DevRel-vectara-agentic)
149
150
  - A Vectara corpus with an [API key](https://docs.vectara.com/docs/api-keys)
150
151
  - [Python 3.10 or higher](https://www.python.org/downloads/)
151
- - OpenAI API key (or API keys for Anthropic, TOGETHER.AI, Fireworks AI, Cohere, GEMINI or GROQ, if you choose to use them).
152
+ - OpenAI API key (or API keys for Anthropic, TOGETHER.AI, Cohere, GEMINI or GROQ, if you choose to use them).
152
153
  To use AWS Bedrock, make sure that
153
154
  * The Bedrock models you need are enabled on your account
154
155
  * Your environment includes `AWS_PROFILE` with your AWS profile name.
@@ -200,7 +201,8 @@ ask_finance = vec_factory.create_rag_tool(
200
201
  tool_description="Query financial reports for a company and year",
201
202
  tool_args_schema=QueryFinancialReportsArgs,
202
203
  lambda_val=0.005,
203
- summary_num_results=7,
204
+ summary_num_results=7,
205
+ vhc_eligible=True, # RAG tools participate in VHC by default
204
206
  # Additional Vectara query arguments...
205
207
  )
206
208
  ```
@@ -480,6 +482,30 @@ def mult_func(x, y):
480
482
  mult_tool = ToolsFactory().create_tool(mult_func)
481
483
  ```
482
484
 
485
+ #### VHC Eligibility
486
+
487
+ When creating tools, you can control whether they participate in Vectara Hallucination Correction, by using the `vhc_eligible` parameter:
488
+
489
+ ```python
490
+ # Tool that provides factual data - should participate in VHC
491
+ data_tool = ToolsFactory().create_tool(get_company_data, vhc_eligible=True)
492
+
493
+ # Utility tool that doesn't provide context - should not participate in VHC
494
+ summary_tool = ToolsFactory().create_tool(summarize_text, vhc_eligible=False)
495
+ ```
496
+
497
+ **VHC-eligible tools** (default: `True`) are those that provide factual context for responses, such as:
498
+ - Data retrieval tools
499
+ - Search tools
500
+ - API calls that return factual information
501
+
502
+ **Non-VHC-eligible tools** (`vhc_eligible=False`) are utility tools that don't contribute factual context:
503
+ - Text summarization tools
504
+ - Text rephrasing tools
505
+ - Formatting or processing tools
506
+
507
+ Built-in utility tools like `summarize_text`, `rephrase_text`, and `get_bad_topics` are automatically marked as non-VHC-eligible.
508
+
483
509
  #### Human-Readable Tool Output
484
510
 
485
511
  Tools can provide both raw data and human-readable formatted output using the `create_human_readable_output` utility:
@@ -504,7 +530,7 @@ Built-in formatters include `format_as_table`, `format_as_json`, and `format_as_
504
530
  > and not as nested functions. Nested functions are not supported if you use serialization
505
531
  > (dumps/loads or from_dict/to_dict).
506
532
 
507
- The human-readable format, if available, is used when computing the factual consistency score.
533
+ The human-readable format, if available, is used when using Vectara Hallucination Correction.
508
534
 
509
535
  ### Tool Validation
510
536
 
@@ -719,12 +745,13 @@ agent = Agent(
719
745
  ```
720
746
 
721
747
  The `AgentConfig` object may include the following items:
722
- - `agent_type`: the agent type. Valid values are `REACT`, `LLMCOMPILER`, `LATS` or `OPENAI` (default: `OPENAI`).
723
- - `main_llm_provider` and `tool_llm_provider`: the LLM provider for main agent and for the tools. Valid values are `OPENAI`, `ANTHROPIC`, `TOGETHER`, `GROQ`, `COHERE`, `BEDROCK`, `GEMINI` or `FIREWORKS` (default: `OPENAI`).
724
- - `main_llm_model_name` and `tool_llm_model_name`: agent model name for agent and tools (default depends on provider).
748
+ - `agent_type`: the agent type. Valid values are `REACT`, `LLMCOMPILER`, `LATS` or `FUNCTION_CALLING` (default: `FUNCTION_CALLING`).
749
+ - `main_llm_provider` and `tool_llm_provider`: the LLM provider for main agent and for the tools. Valid values are `OPENAI`, `ANTHROPIC`, `TOGETHER`, `GROQ`, `COHERE`, `BEDROCK`, `GEMINI` (default: `OPENAI`).
750
+
751
+ > **Note:** Fireworks AI support has been removed. If you were using Fireworks, please migrate to one of the supported providers listed above.
752
+ - `main_llm_model_name` and `tool_llm_model_name`: agent model name for agent and tools (default depends on provider: OpenAI uses gpt-4.1, Gemini uses gemini-2.5-flash).
725
753
  - `observer`: the observer type; should be `ARIZE_PHOENIX` or if undefined no observation framework will be used.
726
754
  - `endpoint_api_key`: a secret key if using the API endpoint option (defaults to `dev-api-key`)
727
- - `max_reasoning_steps`: the maximum number of reasoning steps (iterations for React and function calls for OpenAI agent, respectively). Defaults to 50.
728
755
 
729
756
  If any of these are not provided, `AgentConfig` first tries to read the values from the OS environment.
730
757
 
@@ -759,3 +786,15 @@ agent = Agent(
759
786
  )
760
787
  ```
761
788
 
789
+ ## 🚀 Migrating from v0.3.x
790
+
791
+ If you're upgrading from v0.3.x, please note the following breaking changes in v0.4.0:
792
+
793
+ - **Fireworks LLM removed**: Migrate to OpenAI, Anthropic, Together.AI, GROQ, Cohere, Bedrock, or Gemini
794
+ - **OPENAI AgentType removed**: Use the FUNCTION_CALLING AgentType instead, when using OpenAI for main_llm_provider
795
+ - **StructuredPlanning deprecated**: Use standard Agent workflows or create custom workflows
796
+ - **Token counting and compact_docstring removed**: Remove these from your configuration
797
+ - **update_func removed**: This functionality is no longer available
798
+
799
+ For detailed migration instructions, see [CHANGELOG.md](CHANGELOG.md).
800
+
@@ -31,6 +31,7 @@
31
31
  - [Using Tools](#using-tools)
32
32
  - [Advanced Usage: Workflows](#advanced-usage-workflows)
33
33
  - [Configuration](#️-configuration)
34
+ - [Migrating from v0.3.x](#-migrating-from-v03x)
34
35
  - [Contributing](#-contributing)
35
36
  - [License](#-license)
36
37
 
@@ -47,11 +48,11 @@
47
48
  - **Rapid Tool Creation:**
48
49
  Build Vectara RAG tools or search tools with a single line of code.
49
50
  - **Agent Flexibility:**
50
- Supports multiple agent types including `ReAct`, `OpenAIAgent`, `LATS`, and `LLMCompiler`.
51
+ Supports multiple agent types including `ReAct`, `Function Calling`, `LATS`, and `LLMCompiler`.
51
52
  - **Pre-Built Domain Tools:**
52
53
  Tools tailored for finance, legal, and other verticals.
53
54
  - **Multi-LLM Integration:**
54
- Seamless integration with OpenAI, Anthropic, Gemini, GROQ, Together.AI, Cohere, Bedrock, and Fireworks.
55
+ Seamless integration with OpenAI, Anthropic, Gemini, GROQ, Together.AI, Cohere, and Bedrock.
55
56
  - **Observability:**
56
57
  Built-in support with Arize Phoenix for monitoring and feedback.
57
58
  - **Workflow Support:**
@@ -71,7 +72,7 @@ Check out our example AI assistants:
71
72
  - [Vectara account](https://console.vectara.com/signup/?utm_source=github&utm_medium=code&utm_term=DevRel&utm_content=vectara-agentic&utm_campaign=github-code-DevRel-vectara-agentic)
72
73
  - A Vectara corpus with an [API key](https://docs.vectara.com/docs/api-keys)
73
74
  - [Python 3.10 or higher](https://www.python.org/downloads/)
74
- - OpenAI API key (or API keys for Anthropic, TOGETHER.AI, Fireworks AI, Cohere, GEMINI or GROQ, if you choose to use them).
75
+ - OpenAI API key (or API keys for Anthropic, TOGETHER.AI, Cohere, GEMINI or GROQ, if you choose to use them).
75
76
  To use AWS Bedrock, make sure that
76
77
  * The Bedrock models you need are enabled on your account
77
78
  * Your environment includes `AWS_PROFILE` with your AWS profile name.
@@ -123,7 +124,8 @@ ask_finance = vec_factory.create_rag_tool(
123
124
  tool_description="Query financial reports for a company and year",
124
125
  tool_args_schema=QueryFinancialReportsArgs,
125
126
  lambda_val=0.005,
126
- summary_num_results=7,
127
+ summary_num_results=7,
128
+ vhc_eligible=True, # RAG tools participate in VHC by default
127
129
  # Additional Vectara query arguments...
128
130
  )
129
131
  ```
@@ -403,6 +405,30 @@ def mult_func(x, y):
403
405
  mult_tool = ToolsFactory().create_tool(mult_func)
404
406
  ```
405
407
 
408
+ #### VHC Eligibility
409
+
410
+ When creating tools, you can control whether they participate in Vectara Hallucination Correction, by using the `vhc_eligible` parameter:
411
+
412
+ ```python
413
+ # Tool that provides factual data - should participate in VHC
414
+ data_tool = ToolsFactory().create_tool(get_company_data, vhc_eligible=True)
415
+
416
+ # Utility tool that doesn't provide context - should not participate in VHC
417
+ summary_tool = ToolsFactory().create_tool(summarize_text, vhc_eligible=False)
418
+ ```
419
+
420
+ **VHC-eligible tools** (default: `True`) are those that provide factual context for responses, such as:
421
+ - Data retrieval tools
422
+ - Search tools
423
+ - API calls that return factual information
424
+
425
+ **Non-VHC-eligible tools** (`vhc_eligible=False`) are utility tools that don't contribute factual context:
426
+ - Text summarization tools
427
+ - Text rephrasing tools
428
+ - Formatting or processing tools
429
+
430
+ Built-in utility tools like `summarize_text`, `rephrase_text`, and `get_bad_topics` are automatically marked as non-VHC-eligible.
431
+
406
432
  #### Human-Readable Tool Output
407
433
 
408
434
  Tools can provide both raw data and human-readable formatted output using the `create_human_readable_output` utility:
@@ -427,7 +453,7 @@ Built-in formatters include `format_as_table`, `format_as_json`, and `format_as_
427
453
  > and not as nested functions. Nested functions are not supported if you use serialization
428
454
  > (dumps/loads or from_dict/to_dict).
429
455
 
430
- The human-readable format, if available, is used when computing the factual consistency score.
456
+ The human-readable format, if available, is used when using Vectara Hallucination Correction.
431
457
 
432
458
  ### Tool Validation
433
459
 
@@ -642,12 +668,13 @@ agent = Agent(
642
668
  ```
643
669
 
644
670
  The `AgentConfig` object may include the following items:
645
- - `agent_type`: the agent type. Valid values are `REACT`, `LLMCOMPILER`, `LATS` or `OPENAI` (default: `OPENAI`).
646
- - `main_llm_provider` and `tool_llm_provider`: the LLM provider for main agent and for the tools. Valid values are `OPENAI`, `ANTHROPIC`, `TOGETHER`, `GROQ`, `COHERE`, `BEDROCK`, `GEMINI` or `FIREWORKS` (default: `OPENAI`).
647
- - `main_llm_model_name` and `tool_llm_model_name`: agent model name for agent and tools (default depends on provider).
671
+ - `agent_type`: the agent type. Valid values are `REACT`, `LLMCOMPILER`, `LATS` or `FUNCTION_CALLING` (default: `FUNCTION_CALLING`).
672
+ - `main_llm_provider` and `tool_llm_provider`: the LLM provider for main agent and for the tools. Valid values are `OPENAI`, `ANTHROPIC`, `TOGETHER`, `GROQ`, `COHERE`, `BEDROCK`, `GEMINI` (default: `OPENAI`).
673
+
674
+ > **Note:** Fireworks AI support has been removed. If you were using Fireworks, please migrate to one of the supported providers listed above.
675
+ - `main_llm_model_name` and `tool_llm_model_name`: agent model name for agent and tools (default depends on provider: OpenAI uses gpt-4.1, Gemini uses gemini-2.5-flash).
648
676
  - `observer`: the observer type; should be `ARIZE_PHOENIX` or if undefined no observation framework will be used.
649
677
  - `endpoint_api_key`: a secret key if using the API endpoint option (defaults to `dev-api-key`)
650
- - `max_reasoning_steps`: the maximum number of reasoning steps (iterations for React and function calls for OpenAI agent, respectively). Defaults to 50.
651
678
 
652
679
  If any of these are not provided, `AgentConfig` first tries to read the values from the OS environment.
653
680
 
@@ -682,3 +709,15 @@ agent = Agent(
682
709
  )
683
710
  ```
684
711
 
712
+ ## 🚀 Migrating from v0.3.x
713
+
714
+ If you're upgrading from v0.3.x, please note the following breaking changes in v0.4.0:
715
+
716
+ - **Fireworks LLM removed**: Migrate to OpenAI, Anthropic, Together.AI, GROQ, Cohere, Bedrock, or Gemini
717
+ - **OPENAI AgentType removed**: Use the FUNCTION_CALLING AgentType instead, when using OpenAI for main_llm_provider
718
+ - **StructuredPlanning deprecated**: Use standard Agent workflows or create custom workflows
719
+ - **Token counting and compact_docstring removed**: Remove these from your configuration
720
+ - **update_func removed**: This functionality is no longer available
721
+
722
+ For detailed migration instructions, see [CHANGELOG.md](CHANGELOG.md).
723
+
@@ -1,23 +1,23 @@
1
- llama-index==0.12.37
2
- llama-index-core==0.12.37
3
- llama-index-cli==0.4.1
1
+ llama-index==0.12.49
2
+ llama-index-core==0.12.49
3
+ llama-index-workflow==1.0.1
4
+ llama-index-cli==0.4.4
4
5
  llama-index-indices-managed-vectara==0.4.5
5
- llama-index-agent-llm-compiler==0.3.1
6
- llama-index-agent-lats==0.3.0
7
- llama-index-agent-openai==0.4.8
8
- llama-index-llms-openai==0.3.44
9
- llama-index-llms-openai-like==0.3.5
10
- llama-index-llms-anthropic==0.6.19
11
- llama-index-llms-together==0.3.1
12
- llama-index-llms-groq==0.3.1
13
- llama-index-llms-fireworks==0.3.2
6
+ llama-index-agent-llm-compiler==0.3.2
7
+ llama-index-agent-lats==0.3.2
8
+ llama-index-agent-openai==0.4.12
9
+ llama-index-llms-openai==0.4.7
10
+ llama-index-llms-openai-like==0.4.0
11
+ llama-index-llms-anthropic==0.7.6
12
+ llama-index-llms-together==0.3.2
13
+ llama-index-llms-groq==0.3.2
14
14
  llama-index-llms-cohere==0.5.0
15
- llama-index-llms-google-genai==0.2.1
16
- llama-index-llms-bedrock-converse==0.7.1
15
+ llama-index-llms-google-genai==0.2.5
16
+ llama-index-llms-bedrock-converse==0.7.6
17
17
  llama-index-tools-yahoo-finance==0.3.0
18
18
  llama-index-tools-arxiv==0.3.0
19
19
  llama-index-tools-database==0.3.0
20
- llama-index-tools-google==0.3.1
20
+ llama-index-tools-google==0.5.0
21
21
  llama-index-tools-tavily_research==0.3.0
22
22
  llama_index.tools.brave_search==0.3.0
23
23
  llama-index-tools-neo4j==0.3.0
@@ -26,11 +26,11 @@ llama-index-graph-stores-kuzu==0.7.0
26
26
  llama-index-tools-salesforce==0.3.0
27
27
  llama-index-tools-slack==0.3.0
28
28
  llama-index-tools-exa==0.3.0
29
- llama-index-tools-wikipedia==0.3.0
29
+ llama-index-tools-wikipedia==0.3.1
30
30
  llama-index-tools-bing-search==0.3.0
31
- openai>=1.82.1
32
- tavily-python==0.7.3
33
- exa-py==1.13.1
31
+ openai>=1.96.1
32
+ tavily-python>=0.7.9
33
+ exa-py>=1.14.8
34
34
  openinference-instrumentation-llama-index==4.3.1
35
35
  opentelemetry-proto>=1.31.0
36
36
  arize-phoenix==10.9.1
@@ -38,9 +38,9 @@ arize-phoenix-otel==0.10.3
38
38
  protobuf==5.29.3
39
39
  tokenizers>=0.20
40
40
  pydantic==2.11.5
41
+ pandas==2.2.3
41
42
  retrying==1.3.4
42
43
  python-dotenv==1.0.1
43
- tiktoken==0.9.0
44
44
  cloudpickle>=3.1.1
45
45
  httpx==0.28.1
46
46
  commonmark==0.9.1
@@ -0,0 +1,7 @@
1
+ """
2
+ Tests package for vectara_agentic.
3
+ """
4
+
5
+ # Suppress external dependency warnings globally for all tests
6
+ import warnings
7
+ warnings.simplefilter("ignore", DeprecationWarning)
@@ -0,0 +1,312 @@
1
+ # Suppress external dependency warnings before any other imports
2
+ import warnings
3
+
4
+ warnings.simplefilter("ignore", DeprecationWarning)
5
+
6
+ """
7
+ Common test utilities, configurations, and fixtures for the vectara-agentic test suite.
8
+ """
9
+
10
+ import unittest
11
+ from contextlib import contextmanager
12
+ from typing import Any
13
+
14
+ from vectara_agentic.agent_config import AgentConfig
15
+ from vectara_agentic.types import AgentType, ModelProvider
16
+
17
+
18
+ # ========================================
19
+ # Common Test Functions
20
+ # ========================================
21
+
22
+ def mult(x: float, y: float) -> float:
23
+ """Multiply two numbers - common test function used across multiple test files."""
24
+ return x * y
25
+
26
+
27
+ def add(x: float, y: float) -> float:
28
+ """Add two numbers - common test function used in workflow tests."""
29
+ return x + y
30
+
31
+
32
+ # ========================================
33
+ # Common Test Data
34
+ # ========================================
35
+
36
+ # Standard test topic used across most tests
37
+ STANDARD_TEST_TOPIC = "AI topic"
38
+
39
+ # Standard test instructions used across most tests
40
+ STANDARD_TEST_INSTRUCTIONS = "Always do as your father tells you, if your mother agrees!"
41
+
42
+ # Alternative instructions for specific tests
43
+ WORKFLOW_TEST_INSTRUCTIONS = "You are a helpful AI assistant."
44
+ MATH_AGENT_INSTRUCTIONS = "you are an agent specializing in math, assisting a user."
45
+
46
+
47
+ # ========================================
48
+ # Agent Configuration Objects
49
+ # ========================================
50
+
51
+ # Default configurations
52
+ default_config = AgentConfig()
53
+
54
+ # Function Calling configurations for all providers
55
+ fc_config_anthropic = AgentConfig(
56
+ agent_type=AgentType.FUNCTION_CALLING,
57
+ main_llm_provider=ModelProvider.ANTHROPIC,
58
+ tool_llm_provider=ModelProvider.ANTHROPIC,
59
+ )
60
+
61
+ fc_config_gemini = AgentConfig(
62
+ agent_type=AgentType.FUNCTION_CALLING,
63
+ main_llm_provider=ModelProvider.GEMINI,
64
+ tool_llm_provider=ModelProvider.GEMINI,
65
+ )
66
+
67
+ fc_config_together = AgentConfig(
68
+ agent_type=AgentType.FUNCTION_CALLING,
69
+ main_llm_provider=ModelProvider.TOGETHER,
70
+ tool_llm_provider=ModelProvider.TOGETHER,
71
+ )
72
+
73
+ fc_config_openai = AgentConfig(
74
+ agent_type=AgentType.FUNCTION_CALLING,
75
+ main_llm_provider=ModelProvider.OPENAI,
76
+ tool_llm_provider=ModelProvider.OPENAI,
77
+ )
78
+
79
+ fc_config_groq = AgentConfig(
80
+ agent_type=AgentType.FUNCTION_CALLING,
81
+ main_llm_provider=ModelProvider.GROQ,
82
+ tool_llm_provider=ModelProvider.GROQ,
83
+ )
84
+
85
+ fc_config_bedrock = AgentConfig(
86
+ agent_type=AgentType.FUNCTION_CALLING,
87
+ main_llm_provider=ModelProvider.BEDROCK,
88
+ tool_llm_provider=ModelProvider.BEDROCK,
89
+ )
90
+
91
+ # ReAct configurations for all providers
92
+ react_config_anthropic = AgentConfig(
93
+ agent_type=AgentType.REACT,
94
+ main_llm_provider=ModelProvider.ANTHROPIC,
95
+ tool_llm_provider=ModelProvider.ANTHROPIC,
96
+ )
97
+
98
+ react_config_gemini = AgentConfig(
99
+ agent_type=AgentType.REACT,
100
+ main_llm_provider=ModelProvider.GEMINI,
101
+ main_llm_model_name="models/gemini-2.5-flash",
102
+ tool_llm_provider=ModelProvider.GEMINI,
103
+ tool_llm_model_name="models/gemini-2.5-flash",
104
+ )
105
+
106
+ react_config_together = AgentConfig(
107
+ agent_type=AgentType.REACT,
108
+ main_llm_provider=ModelProvider.TOGETHER,
109
+ tool_llm_provider=ModelProvider.TOGETHER,
110
+ )
111
+
112
+ react_config_groq = AgentConfig(
113
+ agent_type=AgentType.REACT,
114
+ main_llm_provider=ModelProvider.GROQ,
115
+ tool_llm_provider=ModelProvider.GROQ,
116
+ )
117
+
118
+ # Private LLM configurations
119
+ private_llm_react_config = AgentConfig(
120
+ agent_type=AgentType.REACT,
121
+ main_llm_provider=ModelProvider.PRIVATE,
122
+ main_llm_model_name="gpt-4o",
123
+ private_llm_api_base="http://localhost:8000/v1",
124
+ tool_llm_provider=ModelProvider.PRIVATE,
125
+ tool_llm_model_name="gpt-4o",
126
+ )
127
+
128
+ private_llm_fc_config = AgentConfig(
129
+ agent_type=AgentType.FUNCTION_CALLING,
130
+ main_llm_provider=ModelProvider.PRIVATE,
131
+ main_llm_model_name="gpt-4.1",
132
+ private_llm_api_base="http://localhost:8000/v1",
133
+ tool_llm_provider=ModelProvider.PRIVATE,
134
+ tool_llm_model_name="gpt-4.1",
135
+ )
136
+
137
+
138
+ # ========================================
139
+ # Error Detection and Testing Utilities
140
+ # ========================================
141
+
142
+ def is_rate_limited(response_text: str) -> bool:
143
+ """
144
+ Check if a response indicates a rate limit error from any LLM provider.
145
+
146
+ Args:
147
+ response_text: The response text from the agent
148
+
149
+ Returns:
150
+ bool: True if the response indicates rate limiting
151
+ """
152
+ rate_limit_indicators = [
153
+ # Generic indicators
154
+ "Error code: 429",
155
+ "rate_limit_exceeded",
156
+ "Rate limit reached",
157
+ "rate limit",
158
+ "quota exceeded",
159
+ "usage limit",
160
+ # GROQ-specific
161
+ "tokens per day",
162
+ "TPD",
163
+ "service tier",
164
+ "on_demand",
165
+ "deepseek-r1-distill-llama-70b",
166
+ "Upgrade to Dev Tier",
167
+ "console.groq.com/settings/billing",
168
+ # OpenAI-specific
169
+ "requests per minute",
170
+ "RPM",
171
+ "tokens per minute",
172
+ "TPM",
173
+ # Anthropic-specific
174
+ "overloaded_error",
175
+ "Overloaded",
176
+ "APIStatusError",
177
+ "anthropic.APIStatusError",
178
+ "usage_limit_exceeded",
179
+ # General API limit indicators
180
+ "try again in",
181
+ "Please wait",
182
+ "Too many requests",
183
+ "throttled",
184
+ # Additional rate limit patterns
185
+ "Limit.*Used.*Requested",
186
+ "Need more tokens",
187
+ ]
188
+
189
+ response_lower = response_text.lower()
190
+ return any(
191
+ indicator.lower() in response_lower for indicator in rate_limit_indicators
192
+ )
193
+
194
+
195
+ def is_api_key_error(response_text: str) -> bool:
196
+ """
197
+ Check if a response indicates an API key authentication error.
198
+
199
+ Args:
200
+ response_text: The response text from the agent
201
+
202
+ Returns:
203
+ bool: True if the response indicates API key issues
204
+ """
205
+ api_key_indicators = [
206
+ "Error code: 401",
207
+ "Invalid API Key",
208
+ "authentication",
209
+ "unauthorized",
210
+ "invalid_api_key",
211
+ "missing api key",
212
+ "api key not found",
213
+ ]
214
+
215
+ response_lower = response_text.lower()
216
+ return any(indicator.lower() in response_lower for indicator in api_key_indicators)
217
+
218
+
219
+ def skip_if_rate_limited(
220
+ test_instance: unittest.TestCase, response_text: str, provider: str = "LLM"
221
+ ) -> None:
222
+ """
223
+ Skip a test if the response indicates rate limiting.
224
+
225
+ Args:
226
+ test_instance: The test case instance
227
+ response_text: The response text to check
228
+ provider: The name of the provider (for clearer skip messages)
229
+ """
230
+ if is_rate_limited(response_text):
231
+ test_instance.skipTest(f"{provider} rate limit reached - skipping test")
232
+
233
+
234
+ def skip_if_api_key_error(
235
+ test_instance: unittest.TestCase, response_text: str, provider: str = "LLM"
236
+ ) -> None:
237
+ """
238
+ Skip a test if the response indicates API key issues.
239
+
240
+ Args:
241
+ test_instance: The test case instance
242
+ response_text: The response text to check
243
+ provider: The name of the provider (for clearer skip messages)
244
+ """
245
+ if is_api_key_error(response_text):
246
+ test_instance.skipTest(f"{provider} API key invalid/missing - skipping test")
247
+
248
+
249
+ def skip_if_provider_error(
250
+ test_instance: unittest.TestCase, response_text: str, provider: str = "LLM"
251
+ ) -> None:
252
+ """
253
+ Skip a test if the response indicates common provider errors (rate limiting or API key issues).
254
+
255
+ Args:
256
+ test_instance: The test case instance
257
+ response_text: The response text to check
258
+ provider: The name of the provider (for clearer skip messages)
259
+ """
260
+ skip_if_rate_limited(test_instance, response_text, provider)
261
+ skip_if_api_key_error(test_instance, response_text, provider)
262
+
263
+
264
+ class AgentTestMixin:
265
+ """
266
+ Mixin class providing utility methods for agent testing.
267
+ """
268
+
269
+ @contextmanager
270
+ def with_provider_fallback(self, provider: str = "LLM"):
271
+ """
272
+ Context manager that catches and handles provider errors from any agent method.
273
+
274
+ Args:
275
+ provider: Provider name for error messages
276
+
277
+ Usage:
278
+ with self.with_provider_fallback("GROQ"):
279
+ response = agent.chat("test")
280
+
281
+ with self.with_provider_fallback("GROQ"):
282
+ async for chunk in agent.astream_chat("test"):
283
+ pass
284
+
285
+ Raises:
286
+ unittest.SkipTest: If rate limiting or API key errors occur
287
+ """
288
+ try:
289
+ yield
290
+ except Exception as e:
291
+ error_text = str(e)
292
+ if is_rate_limited(error_text) or is_api_key_error(error_text):
293
+ self.skipTest(f"{provider} error: {error_text}")
294
+ raise
295
+
296
+ def check_response_and_skip(self, response: Any, provider: str = "LLM") -> Any:
297
+ """
298
+ Check response content and skip test if provider errors are detected.
299
+
300
+ Args:
301
+ response: The response object from agent method
302
+ provider: Provider name for error messages
303
+
304
+ Returns:
305
+ The response object if no errors detected
306
+
307
+ Raises:
308
+ unittest.SkipTest: If rate limiting or API key errors detected in response
309
+ """
310
+ response_text = getattr(response, "response", str(response))
311
+ skip_if_provider_error(self, response_text, provider)
312
+ return response