vectara-agentic 0.3.3__tar.gz → 0.4.1__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.
Potentially problematic release.
This version of vectara-agentic might be problematic. Click here for more details.
- {vectara_agentic-0.3.3/vectara_agentic.egg-info → vectara_agentic-0.4.1}/PKG-INFO +111 -31
- {vectara_agentic-0.3.3 → vectara_agentic-0.4.1}/README.md +91 -9
- {vectara_agentic-0.3.3 → vectara_agentic-0.4.1}/requirements.txt +19 -21
- vectara_agentic-0.4.1/tests/__init__.py +7 -0
- vectara_agentic-0.4.1/tests/conftest.py +316 -0
- vectara_agentic-0.4.1/tests/endpoint.py +84 -0
- vectara_agentic-0.4.1/tests/run_tests.py +112 -0
- {vectara_agentic-0.3.3 → vectara_agentic-0.4.1}/tests/test_agent.py +35 -33
- vectara_agentic-0.4.1/tests/test_agent_fallback_memory.py +270 -0
- vectara_agentic-0.4.1/tests/test_agent_memory_consistency.py +229 -0
- vectara_agentic-0.4.1/tests/test_agent_type.py +143 -0
- {vectara_agentic-0.3.3 → vectara_agentic-0.4.1}/tests/test_api_endpoint.py +4 -0
- vectara_agentic-0.4.1/tests/test_bedrock.py +61 -0
- {vectara_agentic-0.3.3 → vectara_agentic-0.4.1}/tests/test_fallback.py +4 -0
- vectara_agentic-0.4.1/tests/test_gemini.py +83 -0
- vectara_agentic-0.4.1/tests/test_groq.py +61 -0
- {vectara_agentic-0.3.3 → vectara_agentic-0.4.1}/tests/test_private_llm.py +11 -2
- {vectara_agentic-0.3.3 → vectara_agentic-0.4.1}/tests/test_return_direct.py +6 -2
- {vectara_agentic-0.3.3 → vectara_agentic-0.4.1}/tests/test_serialization.py +7 -6
- vectara_agentic-0.4.1/tests/test_session_memory.py +252 -0
- vectara_agentic-0.4.1/tests/test_streaming.py +109 -0
- vectara_agentic-0.4.1/tests/test_together.py +62 -0
- {vectara_agentic-0.3.3 → vectara_agentic-0.4.1}/tests/test_tools.py +10 -82
- {vectara_agentic-0.3.3 → vectara_agentic-0.4.1}/tests/test_vectara_llms.py +4 -0
- vectara_agentic-0.4.1/tests/test_vhc.py +67 -0
- {vectara_agentic-0.3.3 → vectara_agentic-0.4.1}/tests/test_workflow.py +13 -28
- {vectara_agentic-0.3.3 → vectara_agentic-0.4.1}/vectara_agentic/__init__.py +27 -4
- {vectara_agentic-0.3.3 → vectara_agentic-0.4.1}/vectara_agentic/_callback.py +65 -67
- {vectara_agentic-0.3.3 → vectara_agentic-0.4.1}/vectara_agentic/_observability.py +30 -30
- {vectara_agentic-0.3.3 → vectara_agentic-0.4.1}/vectara_agentic/_version.py +1 -1
- vectara_agentic-0.4.1/vectara_agentic/agent.py +1104 -0
- {vectara_agentic-0.3.3 → vectara_agentic-0.4.1}/vectara_agentic/agent_config.py +15 -14
- vectara_agentic-0.4.1/vectara_agentic/agent_core/__init__.py +22 -0
- vectara_agentic-0.4.1/vectara_agentic/agent_core/factory.py +383 -0
- vectara_agentic-0.3.3/vectara_agentic/_prompts.py → vectara_agentic-0.4.1/vectara_agentic/agent_core/prompts.py +21 -46
- vectara_agentic-0.4.1/vectara_agentic/agent_core/serialization.py +348 -0
- vectara_agentic-0.4.1/vectara_agentic/agent_core/streaming.py +483 -0
- vectara_agentic-0.4.1/vectara_agentic/agent_core/utils/__init__.py +29 -0
- vectara_agentic-0.4.1/vectara_agentic/agent_core/utils/hallucination.py +157 -0
- vectara_agentic-0.4.1/vectara_agentic/agent_core/utils/logging.py +52 -0
- vectara_agentic-0.4.1/vectara_agentic/agent_core/utils/schemas.py +87 -0
- vectara_agentic-0.4.1/vectara_agentic/agent_core/utils/tools.py +125 -0
- {vectara_agentic-0.3.3 → vectara_agentic-0.4.1}/vectara_agentic/agent_endpoint.py +4 -6
- {vectara_agentic-0.3.3 → vectara_agentic-0.4.1}/vectara_agentic/db_tools.py +37 -12
- {vectara_agentic-0.3.3 → vectara_agentic-0.4.1}/vectara_agentic/llm_utils.py +42 -43
- {vectara_agentic-0.3.3 → vectara_agentic-0.4.1}/vectara_agentic/sub_query_workflow.py +9 -14
- {vectara_agentic-0.3.3 → vectara_agentic-0.4.1}/vectara_agentic/tool_utils.py +138 -83
- {vectara_agentic-0.3.3 → vectara_agentic-0.4.1}/vectara_agentic/tools.py +36 -21
- {vectara_agentic-0.3.3 → vectara_agentic-0.4.1}/vectara_agentic/tools_catalog.py +16 -16
- vectara_agentic-0.4.1/vectara_agentic/types.py +189 -0
- {vectara_agentic-0.3.3 → vectara_agentic-0.4.1/vectara_agentic.egg-info}/PKG-INFO +111 -31
- {vectara_agentic-0.3.3 → vectara_agentic-0.4.1}/vectara_agentic.egg-info/SOURCES.txt +19 -5
- {vectara_agentic-0.3.3 → vectara_agentic-0.4.1}/vectara_agentic.egg-info/requires.txt +19 -21
- vectara_agentic-0.3.3/tests/__init__.py +0 -0
- vectara_agentic-0.3.3/tests/endpoint.py +0 -47
- vectara_agentic-0.3.3/tests/test_agent_planning.py +0 -64
- vectara_agentic-0.3.3/tests/test_agent_type.py +0 -200
- vectara_agentic-0.3.3/tests/test_bedrock.py +0 -42
- vectara_agentic-0.3.3/tests/test_gemini.py +0 -115
- vectara_agentic-0.3.3/tests/test_groq.py +0 -42
- vectara_agentic-0.3.3/tests/test_hhem.py +0 -100
- vectara_agentic-0.3.3/vectara_agentic/agent.py +0 -1398
- vectara_agentic-0.3.3/vectara_agentic/hhem.py +0 -82
- vectara_agentic-0.3.3/vectara_agentic/types.py +0 -91
- {vectara_agentic-0.3.3 → vectara_agentic-0.4.1}/LICENSE +0 -0
- {vectara_agentic-0.3.3 → vectara_agentic-0.4.1}/MANIFEST.in +0 -0
- {vectara_agentic-0.3.3 → vectara_agentic-0.4.1}/setup.cfg +0 -0
- {vectara_agentic-0.3.3 → vectara_agentic-0.4.1}/setup.py +0 -0
- {vectara_agentic-0.3.3 → vectara_agentic-0.4.1}/vectara_agentic/utils.py +0 -0
- {vectara_agentic-0.3.3 → vectara_agentic-0.4.1}/vectara_agentic.egg-info/dependency_links.txt +0 -0
- {vectara_agentic-0.3.3 → vectara_agentic-0.4.1}/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
|
+
Version: 0.4.1
|
|
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,24 @@ 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.
|
|
20
|
-
Requires-Dist: llama-index-core==0.12.
|
|
21
|
-
Requires-Dist: llama-index-
|
|
19
|
+
Requires-Dist: llama-index==0.12.52
|
|
20
|
+
Requires-Dist: llama-index-core==0.12.52.post1
|
|
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-
|
|
24
|
-
Requires-Dist: llama-index-
|
|
25
|
-
Requires-Dist: llama-index-
|
|
26
|
-
Requires-Dist: llama-index-llms-
|
|
27
|
-
Requires-Dist: llama-index-llms-
|
|
28
|
-
Requires-Dist: llama-index-llms-
|
|
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-openai==0.4.12
|
|
25
|
+
Requires-Dist: llama-index-llms-openai==0.4.7
|
|
26
|
+
Requires-Dist: llama-index-llms-openai-like==0.4.0
|
|
27
|
+
Requires-Dist: llama-index-llms-anthropic==0.7.6
|
|
28
|
+
Requires-Dist: llama-index-llms-together==0.3.2
|
|
29
|
+
Requires-Dist: llama-index-llms-groq==0.3.2
|
|
32
30
|
Requires-Dist: llama-index-llms-cohere==0.5.0
|
|
33
|
-
Requires-Dist: llama-index-llms-google-genai==0.2.
|
|
34
|
-
Requires-Dist: llama-index-llms-bedrock-converse==0.7.
|
|
31
|
+
Requires-Dist: llama-index-llms-google-genai==0.2.5
|
|
32
|
+
Requires-Dist: llama-index-llms-bedrock-converse==0.7.6
|
|
35
33
|
Requires-Dist: llama-index-tools-yahoo-finance==0.3.0
|
|
36
34
|
Requires-Dist: llama-index-tools-arxiv==0.3.0
|
|
37
35
|
Requires-Dist: llama-index-tools-database==0.3.0
|
|
38
|
-
Requires-Dist: llama-index-tools-google==0.
|
|
36
|
+
Requires-Dist: llama-index-tools-google==0.5.0
|
|
39
37
|
Requires-Dist: llama-index-tools-tavily_research==0.3.0
|
|
40
38
|
Requires-Dist: llama_index.tools.brave_search==0.3.0
|
|
41
39
|
Requires-Dist: llama-index-tools-neo4j==0.3.0
|
|
@@ -44,21 +42,21 @@ Requires-Dist: llama-index-graph-stores-kuzu==0.7.0
|
|
|
44
42
|
Requires-Dist: llama-index-tools-salesforce==0.3.0
|
|
45
43
|
Requires-Dist: llama-index-tools-slack==0.3.0
|
|
46
44
|
Requires-Dist: llama-index-tools-exa==0.3.0
|
|
47
|
-
Requires-Dist: llama-index-tools-wikipedia==0.3.
|
|
45
|
+
Requires-Dist: llama-index-tools-wikipedia==0.3.1
|
|
48
46
|
Requires-Dist: llama-index-tools-bing-search==0.3.0
|
|
49
|
-
Requires-Dist: openai>=1.
|
|
50
|
-
Requires-Dist: tavily-python
|
|
51
|
-
Requires-Dist: exa-py
|
|
47
|
+
Requires-Dist: openai>=1.96.1
|
|
48
|
+
Requires-Dist: tavily-python>=0.7.9
|
|
49
|
+
Requires-Dist: exa-py>=1.14.8
|
|
52
50
|
Requires-Dist: openinference-instrumentation-llama-index==4.3.1
|
|
53
51
|
Requires-Dist: opentelemetry-proto>=1.31.0
|
|
54
52
|
Requires-Dist: arize-phoenix==10.9.1
|
|
55
53
|
Requires-Dist: arize-phoenix-otel==0.10.3
|
|
56
|
-
Requires-Dist: protobuf==5.29.
|
|
54
|
+
Requires-Dist: protobuf==5.29.5
|
|
57
55
|
Requires-Dist: tokenizers>=0.20
|
|
58
56
|
Requires-Dist: pydantic==2.11.5
|
|
57
|
+
Requires-Dist: pandas==2.2.3
|
|
59
58
|
Requires-Dist: retrying==1.3.4
|
|
60
59
|
Requires-Dist: python-dotenv==1.0.1
|
|
61
|
-
Requires-Dist: tiktoken==0.9.0
|
|
62
60
|
Requires-Dist: cloudpickle>=3.1.1
|
|
63
61
|
Requires-Dist: httpx==0.28.1
|
|
64
62
|
Requires-Dist: commonmark==0.9.1
|
|
@@ -108,6 +106,7 @@ Dynamic: summary
|
|
|
108
106
|
- [Using Tools](#using-tools)
|
|
109
107
|
- [Advanced Usage: Workflows](#advanced-usage-workflows)
|
|
110
108
|
- [Configuration](#️-configuration)
|
|
109
|
+
- [Migrating from v0.3.x](#-migrating-from-v03x)
|
|
111
110
|
- [Contributing](#-contributing)
|
|
112
111
|
- [License](#-license)
|
|
113
112
|
|
|
@@ -124,11 +123,11 @@ Dynamic: summary
|
|
|
124
123
|
- **Rapid Tool Creation:**
|
|
125
124
|
Build Vectara RAG tools or search tools with a single line of code.
|
|
126
125
|
- **Agent Flexibility:**
|
|
127
|
-
Supports multiple agent types including `ReAct
|
|
126
|
+
Supports multiple agent types including `ReAct` and `Function Calling`.
|
|
128
127
|
- **Pre-Built Domain Tools:**
|
|
129
128
|
Tools tailored for finance, legal, and other verticals.
|
|
130
129
|
- **Multi-LLM Integration:**
|
|
131
|
-
Seamless integration with OpenAI, Anthropic, Gemini, GROQ, Together.AI, Cohere,
|
|
130
|
+
Seamless integration with OpenAI, Anthropic, Gemini, GROQ, Together.AI, Cohere, and Bedrock.
|
|
132
131
|
- **Observability:**
|
|
133
132
|
Built-in support with Arize Phoenix for monitoring and feedback.
|
|
134
133
|
- **Workflow Support:**
|
|
@@ -148,7 +147,7 @@ Check out our example AI assistants:
|
|
|
148
147
|
- [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
148
|
- A Vectara corpus with an [API key](https://docs.vectara.com/docs/api-keys)
|
|
150
149
|
- [Python 3.10 or higher](https://www.python.org/downloads/)
|
|
151
|
-
- OpenAI API key (or API keys for Anthropic, TOGETHER.AI,
|
|
150
|
+
- OpenAI API key (or API keys for Anthropic, TOGETHER.AI, Cohere, GEMINI or GROQ, if you choose to use them).
|
|
152
151
|
To use AWS Bedrock, make sure that
|
|
153
152
|
* The Bedrock models you need are enabled on your account
|
|
154
153
|
* Your environment includes `AWS_PROFILE` with your AWS profile name.
|
|
@@ -200,7 +199,8 @@ ask_finance = vec_factory.create_rag_tool(
|
|
|
200
199
|
tool_description="Query financial reports for a company and year",
|
|
201
200
|
tool_args_schema=QueryFinancialReportsArgs,
|
|
202
201
|
lambda_val=0.005,
|
|
203
|
-
summary_num_results=7,
|
|
202
|
+
summary_num_results=7,
|
|
203
|
+
vhc_eligible=True, # RAG tools participate in VHC by default
|
|
204
204
|
# Additional Vectara query arguments...
|
|
205
205
|
)
|
|
206
206
|
```
|
|
@@ -480,6 +480,30 @@ def mult_func(x, y):
|
|
|
480
480
|
mult_tool = ToolsFactory().create_tool(mult_func)
|
|
481
481
|
```
|
|
482
482
|
|
|
483
|
+
#### VHC Eligibility
|
|
484
|
+
|
|
485
|
+
When creating tools, you can control whether they participate in Vectara Hallucination Correction, by using the `vhc_eligible` parameter:
|
|
486
|
+
|
|
487
|
+
```python
|
|
488
|
+
# Tool that provides factual data - should participate in VHC
|
|
489
|
+
data_tool = ToolsFactory().create_tool(get_company_data, vhc_eligible=True)
|
|
490
|
+
|
|
491
|
+
# Utility tool that doesn't provide context - should not participate in VHC
|
|
492
|
+
summary_tool = ToolsFactory().create_tool(summarize_text, vhc_eligible=False)
|
|
493
|
+
```
|
|
494
|
+
|
|
495
|
+
**VHC-eligible tools** (default: `True`) are those that provide factual context for responses, such as:
|
|
496
|
+
- Data retrieval tools
|
|
497
|
+
- Search tools
|
|
498
|
+
- API calls that return factual information
|
|
499
|
+
|
|
500
|
+
**Non-VHC-eligible tools** (`vhc_eligible=False`) are utility tools that don't contribute factual context:
|
|
501
|
+
- Text summarization tools
|
|
502
|
+
- Text rephrasing tools
|
|
503
|
+
- Formatting or processing tools
|
|
504
|
+
|
|
505
|
+
Built-in utility tools like `summarize_text`, `rephrase_text`, and `get_bad_topics` are automatically marked as non-VHC-eligible.
|
|
506
|
+
|
|
483
507
|
#### Human-Readable Tool Output
|
|
484
508
|
|
|
485
509
|
Tools can provide both raw data and human-readable formatted output using the `create_human_readable_output` utility:
|
|
@@ -504,7 +528,50 @@ Built-in formatters include `format_as_table`, `format_as_json`, and `format_as_
|
|
|
504
528
|
> and not as nested functions. Nested functions are not supported if you use serialization
|
|
505
529
|
> (dumps/loads or from_dict/to_dict).
|
|
506
530
|
|
|
507
|
-
The human-readable format, if available, is used when
|
|
531
|
+
The human-readable format, if available, is used when using Vectara Hallucination Correction.
|
|
532
|
+
|
|
533
|
+
## 🔍 Vectara Hallucination Correction (VHC)
|
|
534
|
+
|
|
535
|
+
`vectara-agentic` provides built-in support for Vectara Hallucination Correction (VHC), which analyzes agent responses and corrects any detected hallucinations based on the factual content retrieved by VHC-eligible tools.
|
|
536
|
+
|
|
537
|
+
### Computing VHC
|
|
538
|
+
|
|
539
|
+
After a chat interaction, you can compute VHC to analyze and correct the agent's response:
|
|
540
|
+
|
|
541
|
+
```python
|
|
542
|
+
# Chat with the agent
|
|
543
|
+
response = agent.chat("What was Apple's revenue in 2022?")
|
|
544
|
+
print(response.response)
|
|
545
|
+
|
|
546
|
+
# Compute VHC analysis
|
|
547
|
+
vhc_result = agent.compute_vhc()
|
|
548
|
+
|
|
549
|
+
# Access corrected text and corrections
|
|
550
|
+
if vhc_result["corrected_text"]:
|
|
551
|
+
print("Original:", response.response)
|
|
552
|
+
print("Corrected:", vhc_result["corrected_text"])
|
|
553
|
+
print("Corrections:", vhc_result["corrections"])
|
|
554
|
+
else:
|
|
555
|
+
print("No corrections needed or VHC not available")
|
|
556
|
+
```
|
|
557
|
+
|
|
558
|
+
### Async VHC Computation
|
|
559
|
+
|
|
560
|
+
For async applications, use `acompute_vhc()`:
|
|
561
|
+
|
|
562
|
+
```python
|
|
563
|
+
# Async chat
|
|
564
|
+
response = await agent.achat("What was Apple's revenue in 2022?")
|
|
565
|
+
|
|
566
|
+
# Async VHC computation
|
|
567
|
+
vhc_result = await agent.acompute_vhc()
|
|
568
|
+
```
|
|
569
|
+
|
|
570
|
+
### VHC Requirements
|
|
571
|
+
|
|
572
|
+
- VHC requires a valid `VECTARA_API_KEY` environment variable
|
|
573
|
+
- Only VHC-eligible tools (those marked with `vhc_eligible=True`) contribute to the analysis
|
|
574
|
+
- VHC results are cached for each query/response pair to avoid redundant computation
|
|
508
575
|
|
|
509
576
|
### Tool Validation
|
|
510
577
|
|
|
@@ -719,12 +786,13 @@ agent = Agent(
|
|
|
719
786
|
```
|
|
720
787
|
|
|
721
788
|
The `AgentConfig` object may include the following items:
|
|
722
|
-
- `agent_type`: the agent type. Valid values are `REACT
|
|
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`
|
|
724
|
-
|
|
789
|
+
- `agent_type`: the agent type. Valid values are `REACT` or `FUNCTION_CALLING` (default: `FUNCTION_CALLING`).
|
|
790
|
+
- `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`).
|
|
791
|
+
|
|
792
|
+
> **Note:** Fireworks AI support has been removed. If you were using Fireworks, please migrate to one of the supported providers listed above.
|
|
793
|
+
- `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
794
|
- `observer`: the observer type; should be `ARIZE_PHOENIX` or if undefined no observation framework will be used.
|
|
726
795
|
- `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
796
|
|
|
729
797
|
If any of these are not provided, `AgentConfig` first tries to read the values from the OS environment.
|
|
730
798
|
|
|
@@ -759,3 +827,15 @@ agent = Agent(
|
|
|
759
827
|
)
|
|
760
828
|
```
|
|
761
829
|
|
|
830
|
+
## 🚀 Migrating from v0.3.x
|
|
831
|
+
|
|
832
|
+
If you're upgrading from v0.3.x, please note the following breaking changes in v0.4.0:
|
|
833
|
+
|
|
834
|
+
- **Fireworks LLM removed**: Migrate to OpenAI, Anthropic, Together.AI, GROQ, Cohere, Bedrock, or Gemini
|
|
835
|
+
- **OPENAI AgentType removed**: Use the FUNCTION_CALLING AgentType instead, when using OpenAI for main_llm_provider
|
|
836
|
+
- **StructuredPlanning deprecated**: Use standard Agent workflows or create custom workflows
|
|
837
|
+
- **Token counting and compact_docstring removed**: Remove these from your configuration
|
|
838
|
+
- **update_func removed**: This functionality is no longer available
|
|
839
|
+
|
|
840
|
+
For detailed migration instructions, see [CHANGELOG.md](CHANGELOG.md).
|
|
841
|
+
|
|
@@ -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
|
|
51
|
+
Supports multiple agent types including `ReAct` and `Function Calling`.
|
|
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,
|
|
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,
|
|
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,50 @@ 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
|
|
456
|
+
The human-readable format, if available, is used when using Vectara Hallucination Correction.
|
|
457
|
+
|
|
458
|
+
## 🔍 Vectara Hallucination Correction (VHC)
|
|
459
|
+
|
|
460
|
+
`vectara-agentic` provides built-in support for Vectara Hallucination Correction (VHC), which analyzes agent responses and corrects any detected hallucinations based on the factual content retrieved by VHC-eligible tools.
|
|
461
|
+
|
|
462
|
+
### Computing VHC
|
|
463
|
+
|
|
464
|
+
After a chat interaction, you can compute VHC to analyze and correct the agent's response:
|
|
465
|
+
|
|
466
|
+
```python
|
|
467
|
+
# Chat with the agent
|
|
468
|
+
response = agent.chat("What was Apple's revenue in 2022?")
|
|
469
|
+
print(response.response)
|
|
470
|
+
|
|
471
|
+
# Compute VHC analysis
|
|
472
|
+
vhc_result = agent.compute_vhc()
|
|
473
|
+
|
|
474
|
+
# Access corrected text and corrections
|
|
475
|
+
if vhc_result["corrected_text"]:
|
|
476
|
+
print("Original:", response.response)
|
|
477
|
+
print("Corrected:", vhc_result["corrected_text"])
|
|
478
|
+
print("Corrections:", vhc_result["corrections"])
|
|
479
|
+
else:
|
|
480
|
+
print("No corrections needed or VHC not available")
|
|
481
|
+
```
|
|
482
|
+
|
|
483
|
+
### Async VHC Computation
|
|
484
|
+
|
|
485
|
+
For async applications, use `acompute_vhc()`:
|
|
486
|
+
|
|
487
|
+
```python
|
|
488
|
+
# Async chat
|
|
489
|
+
response = await agent.achat("What was Apple's revenue in 2022?")
|
|
490
|
+
|
|
491
|
+
# Async VHC computation
|
|
492
|
+
vhc_result = await agent.acompute_vhc()
|
|
493
|
+
```
|
|
494
|
+
|
|
495
|
+
### VHC Requirements
|
|
496
|
+
|
|
497
|
+
- VHC requires a valid `VECTARA_API_KEY` environment variable
|
|
498
|
+
- Only VHC-eligible tools (those marked with `vhc_eligible=True`) contribute to the analysis
|
|
499
|
+
- VHC results are cached for each query/response pair to avoid redundant computation
|
|
431
500
|
|
|
432
501
|
### Tool Validation
|
|
433
502
|
|
|
@@ -642,12 +711,13 @@ agent = Agent(
|
|
|
642
711
|
```
|
|
643
712
|
|
|
644
713
|
The `AgentConfig` object may include the following items:
|
|
645
|
-
- `agent_type`: the agent type. Valid values are `REACT
|
|
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`
|
|
647
|
-
|
|
714
|
+
- `agent_type`: the agent type. Valid values are `REACT` or `FUNCTION_CALLING` (default: `FUNCTION_CALLING`).
|
|
715
|
+
- `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`).
|
|
716
|
+
|
|
717
|
+
> **Note:** Fireworks AI support has been removed. If you were using Fireworks, please migrate to one of the supported providers listed above.
|
|
718
|
+
- `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
719
|
- `observer`: the observer type; should be `ARIZE_PHOENIX` or if undefined no observation framework will be used.
|
|
649
720
|
- `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
721
|
|
|
652
722
|
If any of these are not provided, `AgentConfig` first tries to read the values from the OS environment.
|
|
653
723
|
|
|
@@ -682,3 +752,15 @@ agent = Agent(
|
|
|
682
752
|
)
|
|
683
753
|
```
|
|
684
754
|
|
|
755
|
+
## 🚀 Migrating from v0.3.x
|
|
756
|
+
|
|
757
|
+
If you're upgrading from v0.3.x, please note the following breaking changes in v0.4.0:
|
|
758
|
+
|
|
759
|
+
- **Fireworks LLM removed**: Migrate to OpenAI, Anthropic, Together.AI, GROQ, Cohere, Bedrock, or Gemini
|
|
760
|
+
- **OPENAI AgentType removed**: Use the FUNCTION_CALLING AgentType instead, when using OpenAI for main_llm_provider
|
|
761
|
+
- **StructuredPlanning deprecated**: Use standard Agent workflows or create custom workflows
|
|
762
|
+
- **Token counting and compact_docstring removed**: Remove these from your configuration
|
|
763
|
+
- **update_func removed**: This functionality is no longer available
|
|
764
|
+
|
|
765
|
+
For detailed migration instructions, see [CHANGELOG.md](CHANGELOG.md).
|
|
766
|
+
|
|
@@ -1,23 +1,21 @@
|
|
|
1
|
-
llama-index==0.12.
|
|
2
|
-
llama-index-core==0.12.
|
|
3
|
-
llama-index-
|
|
1
|
+
llama-index==0.12.52
|
|
2
|
+
llama-index-core==0.12.52.post1
|
|
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-
|
|
6
|
-
llama-index-
|
|
7
|
-
llama-index-
|
|
8
|
-
llama-index-llms-
|
|
9
|
-
llama-index-llms-
|
|
10
|
-
llama-index-llms-
|
|
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-openai==0.4.12
|
|
7
|
+
llama-index-llms-openai==0.4.7
|
|
8
|
+
llama-index-llms-openai-like==0.4.0
|
|
9
|
+
llama-index-llms-anthropic==0.7.6
|
|
10
|
+
llama-index-llms-together==0.3.2
|
|
11
|
+
llama-index-llms-groq==0.3.2
|
|
14
12
|
llama-index-llms-cohere==0.5.0
|
|
15
|
-
llama-index-llms-google-genai==0.2.
|
|
16
|
-
llama-index-llms-bedrock-converse==0.7.
|
|
13
|
+
llama-index-llms-google-genai==0.2.5
|
|
14
|
+
llama-index-llms-bedrock-converse==0.7.6
|
|
17
15
|
llama-index-tools-yahoo-finance==0.3.0
|
|
18
16
|
llama-index-tools-arxiv==0.3.0
|
|
19
17
|
llama-index-tools-database==0.3.0
|
|
20
|
-
llama-index-tools-google==0.
|
|
18
|
+
llama-index-tools-google==0.5.0
|
|
21
19
|
llama-index-tools-tavily_research==0.3.0
|
|
22
20
|
llama_index.tools.brave_search==0.3.0
|
|
23
21
|
llama-index-tools-neo4j==0.3.0
|
|
@@ -26,21 +24,21 @@ llama-index-graph-stores-kuzu==0.7.0
|
|
|
26
24
|
llama-index-tools-salesforce==0.3.0
|
|
27
25
|
llama-index-tools-slack==0.3.0
|
|
28
26
|
llama-index-tools-exa==0.3.0
|
|
29
|
-
llama-index-tools-wikipedia==0.3.
|
|
27
|
+
llama-index-tools-wikipedia==0.3.1
|
|
30
28
|
llama-index-tools-bing-search==0.3.0
|
|
31
|
-
openai>=1.
|
|
32
|
-
tavily-python
|
|
33
|
-
exa-py
|
|
29
|
+
openai>=1.96.1
|
|
30
|
+
tavily-python>=0.7.9
|
|
31
|
+
exa-py>=1.14.8
|
|
34
32
|
openinference-instrumentation-llama-index==4.3.1
|
|
35
33
|
opentelemetry-proto>=1.31.0
|
|
36
34
|
arize-phoenix==10.9.1
|
|
37
35
|
arize-phoenix-otel==0.10.3
|
|
38
|
-
protobuf==5.29.
|
|
36
|
+
protobuf==5.29.5
|
|
39
37
|
tokenizers>=0.20
|
|
40
38
|
pydantic==2.11.5
|
|
39
|
+
pandas==2.2.3
|
|
41
40
|
retrying==1.3.4
|
|
42
41
|
python-dotenv==1.0.1
|
|
43
|
-
tiktoken==0.9.0
|
|
44
42
|
cloudpickle>=3.1.1
|
|
45
43
|
httpx==0.28.1
|
|
46
44
|
commonmark==0.9.1
|