vectara-agentic 0.4.0__py3-none-any.whl → 0.4.2__py3-none-any.whl

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.

Files changed (38) hide show
  1. tests/benchmark_models.py +945 -0
  2. tests/conftest.py +9 -5
  3. tests/run_tests.py +3 -0
  4. tests/test_agent.py +57 -29
  5. tests/test_agent_fallback_memory.py +270 -0
  6. tests/test_agent_memory_consistency.py +229 -0
  7. tests/test_agent_type.py +4 -0
  8. tests/test_bedrock.py +46 -31
  9. tests/test_fallback.py +1 -1
  10. tests/test_gemini.py +7 -22
  11. tests/test_groq.py +46 -31
  12. tests/test_private_llm.py +1 -1
  13. tests/test_serialization.py +3 -6
  14. tests/test_session_memory.py +252 -0
  15. tests/test_streaming.py +58 -37
  16. tests/test_together.py +62 -0
  17. tests/test_vhc.py +3 -2
  18. tests/test_workflow.py +9 -28
  19. vectara_agentic/_observability.py +19 -0
  20. vectara_agentic/_version.py +1 -1
  21. vectara_agentic/agent.py +246 -37
  22. vectara_agentic/agent_core/factory.py +34 -153
  23. vectara_agentic/agent_core/prompts.py +19 -13
  24. vectara_agentic/agent_core/serialization.py +17 -8
  25. vectara_agentic/agent_core/streaming.py +27 -43
  26. vectara_agentic/agent_core/utils/__init__.py +0 -5
  27. vectara_agentic/agent_core/utils/hallucination.py +54 -99
  28. vectara_agentic/llm_utils.py +4 -2
  29. vectara_agentic/sub_query_workflow.py +3 -2
  30. vectara_agentic/tools.py +0 -19
  31. vectara_agentic/types.py +9 -3
  32. {vectara_agentic-0.4.0.dist-info → vectara_agentic-0.4.2.dist-info}/METADATA +79 -39
  33. vectara_agentic-0.4.2.dist-info/RECORD +54 -0
  34. vectara_agentic/agent_core/utils/prompt_formatting.py +0 -56
  35. vectara_agentic-0.4.0.dist-info/RECORD +0 -50
  36. {vectara_agentic-0.4.0.dist-info → vectara_agentic-0.4.2.dist-info}/WHEEL +0 -0
  37. {vectara_agentic-0.4.0.dist-info → vectara_agentic-0.4.2.dist-info}/licenses/LICENSE +0 -0
  38. {vectara_agentic-0.4.0.dist-info → vectara_agentic-0.4.2.dist-info}/top_level.txt +0 -0
@@ -1,11 +1,12 @@
1
1
  """Vectara Hallucination Detection and Correction client."""
2
2
 
3
3
  import logging
4
- from typing import List, Dict, Optional, Tuple
4
+ from typing import List, Optional, Tuple
5
5
  import requests
6
6
 
7
7
  from llama_index.core.llms import MessageRole
8
8
 
9
+
9
10
  class Hallucination:
10
11
  """Vectara Hallucination Correction."""
11
12
 
@@ -46,80 +47,19 @@ class Hallucination:
46
47
  corrected_text = data.get("corrected_text", "")
47
48
  corrections = data.get("corrections", [])
48
49
 
49
- logging.debug(
50
- f"VHC: query={query}\n"
51
- )
52
- logging.debug(
53
- f"VHC: response={hypothesis}\n"
54
- )
55
- logging.debug("VHC: Context:")
50
+ logging.info(f"VHC: query={query}\n")
51
+ logging.info(f"VHC: response={hypothesis}\n")
52
+ logging.info("VHC: Context:")
56
53
  for i, ctx in enumerate(context):
57
- logging.info(f"VHC: context {i}: {ctx}\n\n")
54
+ logging.info(f"VHC: context {i}: {ctx[:200]}\n\n")
58
55
 
59
- logging.debug(
60
- f"VHC: outputs: {len(corrections)} corrections"
61
- )
62
- logging.debug(
63
- f"VHC: corrected_text: {corrected_text}\n"
64
- )
56
+ logging.info(f"VHC: outputs: {len(corrections)} corrections")
57
+ logging.info(f"VHC: corrected_text: {corrected_text}\n")
65
58
  for correction in corrections:
66
- logging.debug(f"VHC: correction: {correction}\n")
59
+ logging.info(f"VHC: correction: {correction}\n")
67
60
 
68
61
  return corrected_text, corrections
69
62
 
70
- def extract_tool_call_mapping(chat_history) -> Dict[str, str]:
71
- """Extract tool_call_id to tool_name mapping from chat history."""
72
- tool_call_id_to_name = {}
73
- for msg in chat_history:
74
- if (
75
- msg.role == MessageRole.ASSISTANT
76
- and hasattr(msg, "additional_kwargs")
77
- and msg.additional_kwargs
78
- ):
79
- tool_calls = msg.additional_kwargs.get("tool_calls", [])
80
- for tool_call in tool_calls:
81
- if (
82
- isinstance(tool_call, dict)
83
- and "id" in tool_call
84
- and "function" in tool_call
85
- ):
86
- tool_call_id = tool_call["id"]
87
- tool_name = tool_call["function"].get("name")
88
- if tool_call_id and tool_name:
89
- tool_call_id_to_name[tool_call_id] = tool_name
90
-
91
- return tool_call_id_to_name
92
-
93
-
94
- def identify_tool_name(msg, tool_call_id_to_name: Dict[str, str]) -> Optional[str]:
95
- """Identify tool name from message using multiple strategies."""
96
- tool_name = None
97
-
98
- # First try: standard tool_name attribute (for backwards compatibility)
99
- tool_name = getattr(msg, "tool_name", None)
100
-
101
- # Second try: additional_kwargs (LlamaIndex standard location)
102
- if (
103
- tool_name is None
104
- and hasattr(msg, "additional_kwargs")
105
- and msg.additional_kwargs
106
- ):
107
- tool_name = msg.additional_kwargs.get("name") or msg.additional_kwargs.get(
108
- "tool_name"
109
- )
110
-
111
- # If no direct tool name, try to map from tool_call_id
112
- if tool_name is None:
113
- tool_call_id = msg.additional_kwargs.get("tool_call_id")
114
- if tool_call_id and tool_call_id in tool_call_id_to_name:
115
- tool_name = tool_call_id_to_name[tool_call_id]
116
-
117
- # Third try: extract from content if it's a ToolOutput object
118
- if tool_name is None and hasattr(msg.content, "tool_name"):
119
- tool_name = msg.content.tool_name
120
-
121
- return tool_name
122
-
123
63
 
124
64
  def check_tool_eligibility(tool_name: Optional[str], tools: List) -> bool:
125
65
  """Check if a tool output is eligible to be included in VHC, by looking up in tools list."""
@@ -140,51 +80,66 @@ def check_tool_eligibility(tool_name: Optional[str], tools: List) -> bool:
140
80
 
141
81
  return True
142
82
 
83
+
143
84
  def analyze_hallucinations(
144
- query: str, chat_history: List,
145
- agent_response: str, tools: List, vectara_api_key: str
85
+ query: str,
86
+ chat_history: List,
87
+ agent_response: str,
88
+ tools: List,
89
+ vectara_api_key: str,
90
+ tool_outputs: Optional[List[dict]] = None,
146
91
  ) -> Tuple[Optional[str], List[str]]:
147
- """Use VHC to compute corrected_text and corrections."""
92
+ """Use VHC to compute corrected_text and corrections using provided tool data."""
93
+
148
94
  if not vectara_api_key:
149
- logging.debug("No Vectara API key - returning None")
95
+ logging.warning("VHC: No Vectara API key - returning None")
150
96
  return None, []
151
97
 
152
- # Build a mapping from tool_call_id to tool_name for better tool identification
153
- tool_call_id_to_name = extract_tool_call_mapping(chat_history)
154
-
155
98
  context = []
99
+
100
+ # Process tool outputs if provided
101
+ if tool_outputs:
102
+ tool_output_count = 0
103
+ for tool_output in tool_outputs:
104
+ if tool_output.get("status_type") == "TOOL_OUTPUT" and tool_output.get(
105
+ "content"
106
+ ):
107
+ tool_output_count += 1
108
+ tool_name = tool_output.get("tool_name")
109
+ is_vhc_eligible = check_tool_eligibility(tool_name, tools)
110
+
111
+ if is_vhc_eligible:
112
+ content = str(tool_output["content"])
113
+ if content and content.strip():
114
+ context.append(content)
115
+
116
+ logging.info(
117
+ f"VHC: Processed {tool_output_count} tool outputs, added {len(context)} to context so far"
118
+ )
119
+ else:
120
+ logging.info("VHC: No tool outputs provided")
121
+
122
+ # Add user messages and previous assistant messages from chat_history for context
156
123
  last_assistant_index = -1
157
124
  for i, msg in enumerate(chat_history):
158
125
  if msg.role == MessageRole.ASSISTANT and msg.content:
159
126
  last_assistant_index = i
160
127
 
161
128
  for i, msg in enumerate(chat_history):
162
- if msg.role == MessageRole.TOOL:
163
- tool_name = identify_tool_name(msg, tool_call_id_to_name)
164
- is_vhc_eligible = check_tool_eligibility(tool_name, tools)
165
-
166
- # Only count tool calls from VHC-eligible tools
167
- if is_vhc_eligible:
168
- content = msg.content
169
-
170
- # Since tools with human-readable output now convert to formatted strings immediately
171
- # in VectaraTool._format_tool_output(), we just use the content directly
172
- content = str(content) if content is not None else ""
173
-
174
- # Only add non-empty content to context
175
- if content and content.strip():
176
- context.append(content)
177
-
178
- elif msg.role == MessageRole.USER and msg.content:
179
- context.append(msg.content)
129
+ if msg.role == MessageRole.USER and msg.content:
130
+ # Don't include the current query in context since it's passed separately as query parameter
131
+ if msg.content != query:
132
+ context.append(msg.content)
180
133
 
181
134
  elif msg.role == MessageRole.ASSISTANT and msg.content:
182
- if i == last_assistant_index: # do not include the last assistant message
183
- continue
184
- context.append(msg.content)
135
+ if i != last_assistant_index: # do not include the last assistant message
136
+ context.append(msg.content)
137
+
138
+ logging.info(f"VHC: Final VHC context has {len(context)} items")
185
139
 
186
- # If no context or no tool calls, we cannot compute VHC
140
+ # If no context, we cannot compute VHC
187
141
  if len(context) == 0:
142
+ logging.info("VHC: No context available for VHC - returning None")
188
143
  return None, []
189
144
 
190
145
  try:
@@ -195,7 +150,7 @@ def analyze_hallucinations(
195
150
  return corrected_text, corrections
196
151
 
197
152
  except Exception as e:
198
- logging.error(
153
+ logging.warning(
199
154
  f"VHC call failed: {e}. "
200
155
  "Ensure you have a valid Vectara API key and the Hallucination Correction service is available."
201
156
  )
@@ -17,10 +17,10 @@ from .types import LLMRole, ModelProvider
17
17
  from .agent_config import AgentConfig
18
18
 
19
19
  provider_to_default_model_name = {
20
- ModelProvider.OPENAI: "gpt-4.1",
20
+ ModelProvider.OPENAI: "gpt-4.1-mini",
21
21
  ModelProvider.ANTHROPIC: "claude-sonnet-4-20250514",
22
22
  ModelProvider.TOGETHER: "deepseek-ai/DeepSeek-V3",
23
- ModelProvider.GROQ: "deepseek-r1-distill-llama-70b",
23
+ ModelProvider.GROQ: "openai/gpt-oss-20b",
24
24
  ModelProvider.BEDROCK: "us.anthropic.claude-sonnet-4-20250514-v1:0",
25
25
  ModelProvider.COHERE: "command-a-03-2025",
26
26
  ModelProvider.GEMINI: "models/gemini-2.5-flash",
@@ -104,6 +104,7 @@ def get_llm(role: LLMRole, config: Optional[AgentConfig] = None) -> LLM:
104
104
  else 8192
105
105
  )
106
106
  if model_provider == ModelProvider.OPENAI:
107
+ additional_kwargs = {"reasoning_effort": "minimal"} if model_name.startswith("gpt-5") else {}
107
108
  llm = OpenAI(
108
109
  model=model_name,
109
110
  temperature=0,
@@ -111,6 +112,7 @@ def get_llm(role: LLMRole, config: Optional[AgentConfig] = None) -> LLM:
111
112
  strict=False,
112
113
  max_tokens=max_tokens,
113
114
  pydantic_program_mode="openai",
115
+ additional_kwargs=additional_kwargs
114
116
  )
115
117
  elif model_provider == ModelProvider.ANTHROPIC:
116
118
  llm = Anthropic(
@@ -6,6 +6,7 @@ that takes a user question and a list of tools, and outputs a list of sub-questi
6
6
  import re
7
7
  import json
8
8
  import logging
9
+ from typing import List, Tuple
9
10
 
10
11
  from pydantic import BaseModel, Field
11
12
 
@@ -44,7 +45,7 @@ class SubQuestionQueryWorkflow(Workflow):
44
45
  Outputs for the workflow when it fails.
45
46
  """
46
47
 
47
- qna: list[tuple[str,str]] = Field(default_factory=list, description="List of question-answer pairs")
48
+ qna: List[Tuple[str, str]] = Field(default_factory=list, description="List of question-answer pairs")
48
49
 
49
50
  # Workflow Event types
50
51
  class QueryEvent(Event):
@@ -220,7 +221,7 @@ class SequentialSubQuestionsWorkflow(Workflow):
220
221
  Outputs for the workflow when it fails.
221
222
  """
222
223
 
223
- qna: list[tuple[str,str]] = Field(
224
+ qna: List[Tuple[str, str]] = Field(
224
225
  default_factory=list, description="List of question-answer pairs"
225
226
  )
226
227
 
vectara_agentic/tools.py CHANGED
@@ -567,25 +567,6 @@ class VectaraToolFactory:
567
567
  # Create human-readable output with citation formatting
568
568
  def format_rag_response(result):
569
569
  text = result["text"]
570
-
571
- # Format citations if present
572
- metadata = result["metadata"]
573
- citation_info = []
574
- for key, value in metadata.items():
575
- if key.isdigit():
576
- doc = value.get("document", {})
577
- doc_metadata = f"{key}: " + "; ".join(
578
- [f"{k}='{v}'" for k, v in doc.items()]
579
- + [
580
- f"{k}='{v}'"
581
- for k, v in value.items()
582
- if k not in ["document"] + keys_to_ignore
583
- ]
584
- )
585
- citation_info.append(doc_metadata)
586
- if citation_info:
587
- text += "\n\nCitations:\n" + "\n".join(citation_info)
588
-
589
570
  return text
590
571
 
591
572
  return create_human_readable_output(res, format_rag_response)
vectara_agentic/types.py CHANGED
@@ -18,8 +18,6 @@ class AgentType(Enum):
18
18
 
19
19
  REACT = "REACT"
20
20
  FUNCTION_CALLING = "FUNCTION_CALLING"
21
- LLMCOMPILER = "LLMCOMPILER"
22
- LATS = "LATS"
23
21
 
24
22
 
25
23
  class ObserverType(Enum):
@@ -142,8 +140,16 @@ class AgentStreamingResponse:
142
140
  resp = cast(AgentResponse, self.base.get_response())
143
141
  elif hasattr(self.base, "to_response"):
144
142
  resp = cast(AgentResponse, self.base.to_response())
145
- else:
143
+ elif hasattr(self.base, "get_final_response"):
146
144
  resp = cast(AgentResponse, self.base.get_final_response())
145
+ else:
146
+ # Fallback for StreamingAgentChatResponse objects that don't have standard methods
147
+ # Try to get the response directly from the object's response attribute
148
+ if hasattr(self.base, "response"):
149
+ response_text = self.base.response if isinstance(self.base.response, str) else str(self.base.response)
150
+ resp = AgentResponse(response=response_text, metadata=getattr(self.base, "metadata", {}))
151
+ else:
152
+ resp = AgentResponse(response="", metadata={})
147
153
 
148
154
  resp.metadata = (resp.metadata or {}) | self.metadata
149
155
  return resp
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: vectara_agentic
3
- Version: 0.4.0
3
+ Version: 0.4.2
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,46 +16,43 @@ 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.49
20
- Requires-Dist: llama-index-core==0.12.49
19
+ Requires-Dist: llama-index==0.13.1
20
+ Requires-Dist: llama-index-core==0.13.1
21
21
  Requires-Dist: llama-index-workflow==1.0.1
22
- Requires-Dist: llama-index-cli==0.4.4
23
- Requires-Dist: llama-index-indices-managed-vectara==0.4.5
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
- Requires-Dist: llama-index-llms-cohere==0.5.0
33
- Requires-Dist: llama-index-llms-google-genai==0.2.5
34
- Requires-Dist: llama-index-llms-bedrock-converse==0.7.6
35
- Requires-Dist: llama-index-tools-yahoo-finance==0.3.0
36
- Requires-Dist: llama-index-tools-arxiv==0.3.0
37
- Requires-Dist: llama-index-tools-database==0.3.0
38
- Requires-Dist: llama-index-tools-google==0.5.0
39
- Requires-Dist: llama-index-tools-tavily_research==0.3.0
40
- Requires-Dist: llama_index.tools.brave_search==0.3.0
41
- Requires-Dist: llama-index-tools-neo4j==0.3.0
42
- Requires-Dist: llama-index-tools-waii==0.3.0
43
- Requires-Dist: llama-index-graph-stores-kuzu==0.7.0
44
- Requires-Dist: llama-index-tools-salesforce==0.3.0
45
- Requires-Dist: llama-index-tools-slack==0.3.0
46
- Requires-Dist: llama-index-tools-exa==0.3.0
47
- Requires-Dist: llama-index-tools-wikipedia==0.3.1
48
- Requires-Dist: llama-index-tools-bing-search==0.3.0
49
- Requires-Dist: openai>=1.96.1
50
- Requires-Dist: tavily-python>=0.7.9
51
- Requires-Dist: exa-py>=1.14.8
52
- Requires-Dist: openinference-instrumentation-llama-index==4.3.1
22
+ Requires-Dist: llama-index-cli==0.5.0
23
+ Requires-Dist: llama-index-indices-managed-vectara==0.5.0
24
+ Requires-Dist: llama-index-llms-openai==0.5.2
25
+ Requires-Dist: llama-index-llms-openai-like==0.5.0
26
+ Requires-Dist: llama-index-llms-anthropic==0.8.2
27
+ Requires-Dist: llama-index-llms-together==0.4.0
28
+ Requires-Dist: llama-index-llms-groq==0.4.0
29
+ Requires-Dist: llama-index-llms-cohere==0.6.0
30
+ Requires-Dist: llama-index-llms-google-genai==0.3.0
31
+ Requires-Dist: llama-index-llms-bedrock-converse==0.8.0
32
+ Requires-Dist: llama-index-tools-yahoo-finance==0.4.0
33
+ Requires-Dist: llama-index-tools-arxiv==0.4.0
34
+ Requires-Dist: llama-index-tools-database==0.4.0
35
+ Requires-Dist: llama-index-tools-google==0.6.0
36
+ Requires-Dist: llama-index-tools-tavily_research==0.4.0
37
+ Requires-Dist: llama_index.tools.brave_search==0.4.0
38
+ Requires-Dist: llama-index-tools-neo4j==0.4.0
39
+ Requires-Dist: llama-index-tools-waii==0.4.0
40
+ Requires-Dist: llama-index-graph-stores-kuzu==0.9.0
41
+ Requires-Dist: llama-index-tools-salesforce==0.4.0
42
+ Requires-Dist: llama-index-tools-slack==0.4.0
43
+ Requires-Dist: llama-index-tools-exa==0.4.0
44
+ Requires-Dist: llama-index-tools-wikipedia==0.4.0
45
+ Requires-Dist: llama-index-tools-bing-search==0.4.0
46
+ Requires-Dist: openai>=1.99.3
47
+ Requires-Dist: tavily-python>=0.7.10
48
+ Requires-Dist: exa-py>=1.14.20
49
+ Requires-Dist: openinference-instrumentation-llama-index==4.3.4
53
50
  Requires-Dist: opentelemetry-proto>=1.31.0
54
51
  Requires-Dist: arize-phoenix==10.9.1
55
52
  Requires-Dist: arize-phoenix-otel==0.10.3
56
- Requires-Dist: protobuf==5.29.3
53
+ Requires-Dist: protobuf==5.29.5
57
54
  Requires-Dist: tokenizers>=0.20
58
- Requires-Dist: pydantic==2.11.5
55
+ Requires-Dist: pydantic>=2.11.5
59
56
  Requires-Dist: pandas==2.2.3
60
57
  Requires-Dist: retrying==1.3.4
61
58
  Requires-Dist: python-dotenv==1.0.1
@@ -125,7 +122,7 @@ Dynamic: summary
125
122
  - **Rapid Tool Creation:**
126
123
  Build Vectara RAG tools or search tools with a single line of code.
127
124
  - **Agent Flexibility:**
128
- Supports multiple agent types including `ReAct`, `Function Calling`, `LATS`, and `LLMCompiler`.
125
+ Supports multiple agent types including `ReAct` and `Function Calling`.
129
126
  - **Pre-Built Domain Tools:**
130
127
  Tools tailored for finance, legal, and other verticals.
131
128
  - **Multi-LLM Integration:**
@@ -532,6 +529,49 @@ Built-in formatters include `format_as_table`, `format_as_json`, and `format_as_
532
529
 
533
530
  The human-readable format, if available, is used when using Vectara Hallucination Correction.
534
531
 
532
+ ## 🔍 Vectara Hallucination Correction (VHC)
533
+
534
+ `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.
535
+
536
+ ### Computing VHC
537
+
538
+ After a chat interaction, you can compute VHC to analyze and correct the agent's response:
539
+
540
+ ```python
541
+ # Chat with the agent
542
+ response = agent.chat("What was Apple's revenue in 2022?")
543
+ print(response.response)
544
+
545
+ # Compute VHC analysis
546
+ vhc_result = agent.compute_vhc()
547
+
548
+ # Access corrected text and corrections
549
+ if vhc_result["corrected_text"]:
550
+ print("Original:", response.response)
551
+ print("Corrected:", vhc_result["corrected_text"])
552
+ print("Corrections:", vhc_result["corrections"])
553
+ else:
554
+ print("No corrections needed or VHC not available")
555
+ ```
556
+
557
+ ### Async VHC Computation
558
+
559
+ For async applications, use `acompute_vhc()`:
560
+
561
+ ```python
562
+ # Async chat
563
+ response = await agent.achat("What was Apple's revenue in 2022?")
564
+
565
+ # Async VHC computation
566
+ vhc_result = await agent.acompute_vhc()
567
+ ```
568
+
569
+ ### VHC Requirements
570
+
571
+ - VHC requires a valid `VECTARA_API_KEY` environment variable
572
+ - Only VHC-eligible tools (those marked with `vhc_eligible=True`) contribute to the analysis
573
+ - VHC results are cached for each query/response pair to avoid redundant computation
574
+
535
575
  ### Tool Validation
536
576
 
537
577
  When creating an agent, you can enable tool validation by setting `validate_tools=True`. This will check that any tools mentioned in your custom instructions actually exist in the agent's tool set:
@@ -745,11 +785,11 @@ agent = Agent(
745
785
  ```
746
786
 
747
787
  The `AgentConfig` object may include the following items:
748
- - `agent_type`: the agent type. Valid values are `REACT`, `LLMCOMPILER`, `LATS` or `FUNCTION_CALLING` (default: `FUNCTION_CALLING`).
788
+ - `agent_type`: the agent type. Valid values are `REACT` or `FUNCTION_CALLING` (default: `FUNCTION_CALLING`).
749
789
  - `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
790
 
751
791
  > **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).
792
+ - `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-mini, Gemini uses gemini-2.5-flash).
753
793
  - `observer`: the observer type; should be `ARIZE_PHOENIX` or if undefined no observation framework will be used.
754
794
  - `endpoint_api_key`: a secret key if using the API endpoint option (defaults to `dev-api-key`)
755
795
 
@@ -0,0 +1,54 @@
1
+ tests/__init__.py,sha256=vXhQJCyD1Uhx2NP8b8vIUG3RUhkXyvn7oOir2bmctQU,175
2
+ tests/benchmark_models.py,sha256=RSdgnGFA7s2mOIRvi50ChZXwk677QMLbJ1glsv1lcDg,38454
3
+ tests/conftest.py,sha256=KjX0iDJIjbj7tsCUXLojZg5lA0PXWLTiuo0ij1Ckew8,9308
4
+ tests/endpoint.py,sha256=0URgtz8uydhP_rtpGn_59P1LiWkd3idNlI85LzXnlUE,2744
5
+ tests/run_tests.py,sha256=HL7JfRtQHBWj44tbs-WL7vEiehIaAynHO1KmhjqLmpw,3337
6
+ tests/test_agent.py,sha256=ntnVDATF3b6mRE9edWeLTexAndW09Kje2SYCo1fn56Q,6775
7
+ tests/test_agent_fallback_memory.py,sha256=dWk_lFLEwDUE4moeoJB5ecPUKZSiFt4RryCcKgq1XtQ,10878
8
+ tests/test_agent_memory_consistency.py,sha256=bnBEpoT1XIVOfd45PVRtRe5ts2kBYKc0Jk0XSjhNMMo,8982
9
+ tests/test_agent_type.py,sha256=d5Zs0iM12DxregfwkJ6UxERWcR5eLgy2ona1znwvK3I,5153
10
+ tests/test_api_endpoint.py,sha256=I2UDamPMSLLkgw0pZ5QMM0o_8vVga9-F6ql-S3zlMBs,5136
11
+ tests/test_bedrock.py,sha256=74M4k4MWFfZV-mD75R_27HQGTfWcPQ40ijLanT54y-E,1979
12
+ tests/test_fallback.py,sha256=SA1d8VymYl3d_tJlq-CSezf43PpBEKwnMTBMFFSe1HU,2969
13
+ tests/test_gemini.py,sha256=pvCcfTf79-R49H_WVZou1xx-vVmZEY-19zRtxZeUdD4,2581
14
+ tests/test_groq.py,sha256=OmO-VBrKfZYUc11QfZH25jT3FySQrSpv_FS488IqSik,1970
15
+ tests/test_private_llm.py,sha256=kVwRUR9gHCiQcTNg01zf50GVvGHuniL6D1xvYWGr0eg,2625
16
+ tests/test_return_direct.py,sha256=QsCw-ZGp06cutLkyrLh1U1rggoH7iBiFz4SQ9MIx-Xk,1521
17
+ tests/test_serialization.py,sha256=wdVRoy6hoPqCF7SGpYbC2TM7iR2o_IKIRKOBZFAChp0,4824
18
+ tests/test_session_memory.py,sha256=lw9SNuLSXDG6MNOBu_4kTPP0XgfZH6E8XCOT-Vrs78I,9786
19
+ tests/test_streaming.py,sha256=EBihBb_ZQiGCCvv7Us7YqHN4CxDIQy-XsUSDVO1n5wU,3302
20
+ tests/test_together.py,sha256=s0ywOxL-XT_iq970ucamVAPR_CIS9OT72vJB7degNdc,1983
21
+ tests/test_tools.py,sha256=869Fl54kmLc44ijykO2QpfcXyAWLDqJ9Niq3XNzhzv8,13621
22
+ tests/test_vectara_llms.py,sha256=H1M9OaDvD8_GCFRBm6IdvWejYKn-zm3-Rzt_noCBbiQ,2496
23
+ tests/test_vhc.py,sha256=MXyFxckQzfdXcULqwoao4taoQ93qLDvkcf-h2LwUQnE,1974
24
+ tests/test_workflow.py,sha256=dwQnHSxvRMVqUtFV8O2KvuyaSKJXFDkVhcffn8mSuJs,3555
25
+ vectara_agentic/__init__.py,sha256=CfS3QR4drKygcTcyH5zUUDuXXQ3WZtTCytz8W4-loeE,1077
26
+ vectara_agentic/_callback.py,sha256=ueckIfLNa9ykmmEyLqrrZwfDNWrEfyZzJeWktpnkwJQ,12970
27
+ vectara_agentic/_observability.py,sha256=rApfdndB2R021iM0xG4MumTSDX1Ba6qbNM0N_AOTbR0,4884
28
+ vectara_agentic/_version.py,sha256=AO7HR7HGdC4KVBKvdlO8C1VoiedQvDhEZLC7dDHiuJg,65
29
+ vectara_agentic/agent.py,sha256=7tXqdrUGZ0bGIpxoiM7K847o0ktiuwMZ-FmCb6N_4n0,47839
30
+ vectara_agentic/agent_config.py,sha256=njqEX2qHJjAp2KpNuJglgZhyWXPK74wjIjBPACD6w7w,4074
31
+ vectara_agentic/agent_endpoint.py,sha256=E_AF-YwxaKqd1-p43X62e1e4ugwOWKIyNq4RWOfsO7A,7402
32
+ vectara_agentic/db_tools.py,sha256=nVZkpGdG63ooGngjX9g7YWyBZRtYMDpvzNasbO696nM,11498
33
+ vectara_agentic/llm_utils.py,sha256=Ac14_lHGvog-hYGGX4e7yZMRnp2ZXcPrpOnnUy7oBZE,7604
34
+ vectara_agentic/sub_query_workflow.py,sha256=1y0fBoUem4i-R34QYlSzcMwM8YhmYgj6S_bWynUtL6w,13001
35
+ vectara_agentic/tool_utils.py,sha256=whnQlk9coeIt01sqUnKnzUorefgn96yWqhtRfHxNL84,25921
36
+ vectara_agentic/tools.py,sha256=pb828u-tDps98N_R3U3_bCcnD9L3w5jdmhScduai74I,34852
37
+ vectara_agentic/tools_catalog.py,sha256=p6eRram-diJyMz5dZI703auSAm97FfW5wLAMyz_2sB0,4634
38
+ vectara_agentic/types.py,sha256=qKkK8vRNiLvEcMInMyOClK2bD7iFlrWGTkl3fGC6Xic,6117
39
+ vectara_agentic/utils.py,sha256=R9HitEG5K3Q_p2M_teosT181OUxkhs1-hnj98qDYGbE,2545
40
+ vectara_agentic/agent_core/__init__.py,sha256=R3KGbSOiY21FOjbeQ_GyIi6uR9Rz7PTfudO9RjSuEZQ,722
41
+ vectara_agentic/agent_core/factory.py,sha256=Nmmhl98r2Op4qJwq9cgfy7DfrWI62JUfxFXHoBxKHBo,14158
42
+ vectara_agentic/agent_core/prompts.py,sha256=al7SF5pNzOG-KK0lCtTS-HCwVStB6yvE34dgHWJQ_bA,9989
43
+ vectara_agentic/agent_core/serialization.py,sha256=WwV40KGdN_cC6kACjdHuRCmyDBGhV5YOJ5KoHLXpSlg,12053
44
+ vectara_agentic/agent_core/streaming.py,sha256=ViCYos_08o-TQZtNORFs8gr5PNkN4X0hBTNVH32tNAw,17665
45
+ vectara_agentic/agent_core/utils/__init__.py,sha256=y5Xf0IH-5TRxMBRA9IyhmWnGZOVIyqV45P6lX4c2Qsc,762
46
+ vectara_agentic/agent_core/utils/hallucination.py,sha256=XmV7tW-MBN9BrzM79zu0T7zaWil7fIkNQjLfDZE43v4,5312
47
+ vectara_agentic/agent_core/utils/logging.py,sha256=-Ll8iUelml92WuhNWScuY6H-RheyZOTBHNxXQ1UGy0M,1701
48
+ vectara_agentic/agent_core/utils/schemas.py,sha256=e7xhJBevgK7IM8cRT5hoO67T-Ep_FhNGp72Zo0OC_Jo,2853
49
+ vectara_agentic/agent_core/utils/tools.py,sha256=k9Gm-UUQ3ZeGxrkjyrjmjcGxOkvnpylcm_Krnr-0fsY,4748
50
+ vectara_agentic-0.4.2.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
51
+ vectara_agentic-0.4.2.dist-info/METADATA,sha256=QeXPh5PCHd76YKrrs7rI6hCYFGEWtJCYhZtPneWM5Gg,35010
52
+ vectara_agentic-0.4.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
53
+ vectara_agentic-0.4.2.dist-info/top_level.txt,sha256=Y7TQTFdOYGYodQRltUGRieZKIYuzeZj2kHqAUpfCUfg,22
54
+ vectara_agentic-0.4.2.dist-info/RECORD,,
@@ -1,56 +0,0 @@
1
- """
2
- Prompt formatting and templating utilities.
3
-
4
- This module handles prompt template processing, placeholder replacement,
5
- and LLM-specific prompt formatting for different agent types.
6
- """
7
-
8
- from datetime import date
9
-
10
- def format_prompt(
11
- prompt_template: str,
12
- general_instructions: str,
13
- topic: str,
14
- custom_instructions: str,
15
- ) -> str:
16
- """
17
- Generate a prompt by replacing placeholders with topic and date.
18
-
19
- Args:
20
- prompt_template: The template for the prompt
21
- general_instructions: General instructions to be included in the prompt
22
- topic: The topic to be included in the prompt
23
- custom_instructions: The custom instructions to be included in the prompt
24
-
25
- Returns:
26
- str: The formatted prompt
27
- """
28
- return (
29
- prompt_template.replace("{chat_topic}", topic)
30
- .replace("{today}", date.today().strftime("%A, %B %d, %Y"))
31
- .replace("{custom_instructions}", custom_instructions)
32
- .replace("{INSTRUCTIONS}", general_instructions)
33
- )
34
-
35
-
36
- def format_llm_compiler_prompt(
37
- prompt: str, general_instructions: str, topic: str, custom_instructions: str
38
- ) -> str:
39
- """
40
- Add custom instructions to the prompt for LLM compiler agents.
41
-
42
- Args:
43
- prompt: The base prompt to which custom instructions should be added
44
- general_instructions: General instructions for the agent
45
- topic: Topic expertise for the agent
46
- custom_instructions: Custom user instructions
47
-
48
- Returns:
49
- str: The prompt with custom instructions added
50
- """
51
- prompt += "\nAdditional Instructions:\n"
52
- prompt += f"You have expertise in {topic}.\n"
53
- prompt += general_instructions
54
- prompt += custom_instructions
55
- prompt += f"Today is {date.today().strftime('%A, %B %d, %Y')}"
56
- return prompt
@@ -1,50 +0,0 @@
1
- tests/__init__.py,sha256=vXhQJCyD1Uhx2NP8b8vIUG3RUhkXyvn7oOir2bmctQU,175
2
- tests/conftest.py,sha256=WHK_SxlhU2EN55w8wXUMMHhks8yriOab5nK1y8HXe3g,9276
3
- tests/endpoint.py,sha256=0URgtz8uydhP_rtpGn_59P1LiWkd3idNlI85LzXnlUE,2744
4
- tests/run_tests.py,sha256=eZd50pV4FIbr8riDaqXvDheoW3mOcO3ZRGloGUNusAM,3197
5
- tests/test_agent.py,sha256=V5r7Cqe0iqV8VmeDJdE2lvB5tBLQUqcX182HIXTNYQQ,5721
6
- tests/test_agent_type.py,sha256=WNUwyUxC431BTtQPSfKpG42IxsPnexdbXQTM3P6itBk,5085
7
- tests/test_api_endpoint.py,sha256=I2UDamPMSLLkgw0pZ5QMM0o_8vVga9-F6ql-S3zlMBs,5136
8
- tests/test_bedrock.py,sha256=lXIHGtH0otjOqCkCSnanEUM6HavSkbail1900drfJiU,1358
9
- tests/test_fallback.py,sha256=6wkyiyAvsibIdr33aXdsuU9nzDeJt0XSz5yiyuisUEQ,2963
10
- tests/test_gemini.py,sha256=ksHd8JA7ZMuzs8W40Fb4RBoen1rniXDghSfQImw_3nk,3016
11
- tests/test_groq.py,sha256=m6HpJEeqmDQqYCQwg9_bCyGJ3ek1tK-aLBktxgRGGJ0,1346
12
- tests/test_private_llm.py,sha256=P6sldeAWcHg29u_Nu4FdHVUyNaRe5ULE-hjNJz6WKHc,2620
13
- tests/test_return_direct.py,sha256=QsCw-ZGp06cutLkyrLh1U1rggoH7iBiFz4SQ9MIx-Xk,1521
14
- tests/test_serialization.py,sha256=CsW7qEXgGE24oEqo85c-GEbzn_mZjbF3er_juL9JbF8,4896
15
- tests/test_streaming.py,sha256=e_XztBLCWf39HgfN1zsUz_vFNblzmMC2zfYHB8JM-zQ,2795
16
- tests/test_tools.py,sha256=869Fl54kmLc44ijykO2QpfcXyAWLDqJ9Niq3XNzhzv8,13621
17
- tests/test_vectara_llms.py,sha256=H1M9OaDvD8_GCFRBm6IdvWejYKn-zm3-Rzt_noCBbiQ,2496
18
- tests/test_vhc.py,sha256=oDZzx1AdtDO0K5MHpzrCegw7wfc3h9E0V7boVFoMWXs,1945
19
- tests/test_workflow.py,sha256=FXUM4hKh-La9FRJD0ir2sOiXsvkDFe2kI0r1faRAlMc,3873
20
- vectara_agentic/__init__.py,sha256=CfS3QR4drKygcTcyH5zUUDuXXQ3WZtTCytz8W4-loeE,1077
21
- vectara_agentic/_callback.py,sha256=ueckIfLNa9ykmmEyLqrrZwfDNWrEfyZzJeWktpnkwJQ,12970
22
- vectara_agentic/_observability.py,sha256=c_1WuP8rS9sPuMH6twzcz6CGLqfTT5y4fyOHvDVdxsg,4423
23
- vectara_agentic/_version.py,sha256=tSVqctgqLCPSvb0zkh8BNhEaR1d92yEJqmdCvwJzdKQ,65
24
- vectara_agentic/agent.py,sha256=ga-8Flc01EX6xUhEx-MHArjb8bUeAYlRK_cKioihxdk,38667
25
- vectara_agentic/agent_config.py,sha256=njqEX2qHJjAp2KpNuJglgZhyWXPK74wjIjBPACD6w7w,4074
26
- vectara_agentic/agent_endpoint.py,sha256=E_AF-YwxaKqd1-p43X62e1e4ugwOWKIyNq4RWOfsO7A,7402
27
- vectara_agentic/db_tools.py,sha256=nVZkpGdG63ooGngjX9g7YWyBZRtYMDpvzNasbO696nM,11498
28
- vectara_agentic/llm_utils.py,sha256=s0g04lqQkX27njAKPAM-H0ZFEmohaC0VO7hs_ByaGaQ,7460
29
- vectara_agentic/sub_query_workflow.py,sha256=wm2Lb2wbKrYx5bSq-npb3XbaxWzTcvK5BkW3NZ9vuIc,12968
30
- vectara_agentic/tool_utils.py,sha256=whnQlk9coeIt01sqUnKnzUorefgn96yWqhtRfHxNL84,25921
31
- vectara_agentic/tools.py,sha256=8gmC6UnHFTUr_hWWbuMyRNMMLkeY5Sb1FTgCsb7Hx1w,35689
32
- vectara_agentic/tools_catalog.py,sha256=p6eRram-diJyMz5dZI703auSAm97FfW5wLAMyz_2sB0,4634
33
- vectara_agentic/types.py,sha256=V04L8Man79qI9SmnKhlR3verJjm7yhcEE1RHPq9ADpc,5580
34
- vectara_agentic/utils.py,sha256=R9HitEG5K3Q_p2M_teosT181OUxkhs1-hnj98qDYGbE,2545
35
- vectara_agentic/agent_core/__init__.py,sha256=R3KGbSOiY21FOjbeQ_GyIi6uR9Rz7PTfudO9RjSuEZQ,722
36
- vectara_agentic/agent_core/factory.py,sha256=yIoA-GumyuoUu-tmfAp79v2kAujUj7D7a7d5vx3_kj8,17697
37
- vectara_agentic/agent_core/prompts.py,sha256=JGyAyZyLd__hTuEeBBuCHFdIS1nTIQJZJPGbxRpxY7A,9414
38
- vectara_agentic/agent_core/serialization.py,sha256=Kxa7irtaeOhw2NbPpPkT3R7rKe-imx13XCL1V63eRqI,11634
39
- vectara_agentic/agent_core/streaming.py,sha256=0mN5qpDP9evXOG_vj65GINhmUkbSQsWmGUsVDkNVPFE,18134
40
- vectara_agentic/agent_core/utils/__init__.py,sha256=kLdT0Idw0xhT1zOJIhx13T4qsWh01O3taNC7aN2SEI4,958
41
- vectara_agentic/agent_core/utils/hallucination.py,sha256=KG-ELY9ZzCwBjj4KMyncPkgvEg190Pw2D612O9fHE-Q,7037
42
- vectara_agentic/agent_core/utils/logging.py,sha256=-Ll8iUelml92WuhNWScuY6H-RheyZOTBHNxXQ1UGy0M,1701
43
- vectara_agentic/agent_core/utils/prompt_formatting.py,sha256=C0WqmSHZ-r_asRi2mkMsFOlqrOVrmADqNudidS6CU3s,1801
44
- vectara_agentic/agent_core/utils/schemas.py,sha256=e7xhJBevgK7IM8cRT5hoO67T-Ep_FhNGp72Zo0OC_Jo,2853
45
- vectara_agentic/agent_core/utils/tools.py,sha256=k9Gm-UUQ3ZeGxrkjyrjmjcGxOkvnpylcm_Krnr-0fsY,4748
46
- vectara_agentic-0.4.0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
47
- vectara_agentic-0.4.0.dist-info/METADATA,sha256=BAILIhLZFOZAo71UTsWlzDPnUGfmq8nhJDRfAwzEgEc,33857
48
- vectara_agentic-0.4.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
49
- vectara_agentic-0.4.0.dist-info/top_level.txt,sha256=Y7TQTFdOYGYodQRltUGRieZKIYuzeZj2kHqAUpfCUfg,22
50
- vectara_agentic-0.4.0.dist-info/RECORD,,