INTEGRATIONS · LLAMAINDEX
LlamaIndex search tool integration
Use Annolux as a search tool or external retrieval reader in LlamaIndex Python & TS for temporal RAG pipelines.
Python FunctionTool setup
Wrap the Annolux Search API as a LlamaIndex FunctionTool for use in AgentRunner, FunctionCallingAgent, and RAG QueryEngine.
import os
import requests
from llama_index.core.tools import FunctionTool
def search_web(query: str, limit: int = 10) -> str:
"""Search curated English and Chinese technical web pages with timestamps."""
api_key = os.environ.get("ANNOLUX_API_KEY", "")
res = requests.post(
"https://api.annolux.com/api/v1/search",
headers={"Authorization": f"Bearer {api_key}"},
json={"query": query, "limit": limit, "deduplicate": True},
timeout=30,
)
return res.text if res.ok else f"Error: {res.status_code}"
annolux_tool = FunctionTool.from_defaults(
fn=search_web,
name="annolux_search",
description="Search curated English and Chinese technical web pages with verified fetched_at timestamps."
)
Using search in RAG pipelines
In dynamic RAG pipelines, the agent invokes search_web when internal vector embeddings return low similarity. Results carry fetched_at timestamps so answers reflect verified doc dates.
Boundaries and credits
search_web queries a curated bilingual index. Exactly 1 credit per successful 2xx query; errors and timeouts cost zero. New accounts receive 1,000 free permanent credits.