This package integrates the AI Search API with LangChain.
You can use semantic search, conversational models, and AI agents in your LangChain projects with just one package.
πŸ‘‰ To start, create an account and get your API key:

Features

  • πŸ”‘ One Package Setup – pip install langchain-aisearchapi and you’re ready
  • πŸ€– LLM Interface – Use AI Search API as a LangChain LLM
  • πŸ’¬ Chat Model – Build conversational agents with memory
  • πŸ› οΈ Tools for Agents – Add AI Search directly into LangChain workflows
  • πŸ“š Prebuilt Chains – Research, Q&A, fact-checking out of the box

Installation

Install from PyPI:
pip install langchain-aisearchapi
That’s it β€” no extra setup needed.

Quick Start

1. Basic LLM Usage

from langchain_aisearchapi import AISearchLLM

llm = AISearchLLM(api_key="your-key")
response = llm("Explain semantic search in simple terms")
print(response)

2. Conversational Chat

from langchain_aisearchapi import AISearchChat
from langchain.schema import HumanMessage

chat = AISearchChat(api_key="your-key")

messages = [
    HumanMessage(content="What is LangChain?"),
    HumanMessage(content="Why do developers use it?")
]

response = chat(messages)
print(response.content)

3. AI Search as a Tool in Agents

from langchain_aisearchapi import AISearchTool, AISearchLLM
from langchain.agents import initialize_agent, AgentType

search_tool = AISearchTool(api_key="your-key")
llm = AISearchLLM(api_key="your-key")

agent = initialize_agent(
    tools=[search_tool],
    llm=llm,
    agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION,
    verbose=True
)

result = agent.run("Find the latest SpaceX launch details")
print(result)

4. Research Assistant

from langchain_aisearchapi import create_research_chain

research = create_research_chain(api_key="your-key")
result = research.run("Breakthroughs in AI search technology 2024")
print(result)

Components

ComponentDescriptionUse Case
AISearchLLMAI Search API as an LLMCompletions, text generation
AISearchChatChat model with contextConversational AI, assistants
AISearchToolSearch as LangChain toolAgents, workflows
create_research_chain()Ready-made research chainResearch and reporting

Troubleshooting

  • ❌ No API key? β†’ Sign up or log in.
  • πŸ”‘ Key issues? β†’ Check your dashboard.
  • ⏳ Rate limited? β†’ Use retry logic (e.g. with tenacity).

Resources


Start Now

Install the package, get your API key, and build powerful LangChain apps with the AI Search API:
pip install langchain-aisearchapi
πŸ‘‰ Join now to claim your free API key and start building!