Skip to main content

ihyee-langchain

LangChain tools for the ihyee web intelligence API.

Search the web, fetch specific URLs, and render JavaScript-heavy pages -- all as LangChain tools that plug directly into your agents and chains.

Installation

pip install ihyee-langchain

Quick start

from ihyee_langchain import IhyeeSearchTool

tool = IhyeeSearchTool(api_key="your-ihyee-api-key")
result = tool.invoke("transformer architecture explained")
print(result)

Tools

IhyeeSearchTool

Search the web and return extracted, summarized content from top results.

from ihyee_langchain import IhyeeSearchTool

tool = IhyeeSearchTool(
    api_key="your-key",   # or set IHYEE_API_KEY env var
    max_results=5,        # number of results (default: 5)
    content_mode="both",  # "text", "links", or "both" (default: "both")
)

result = tool.invoke("latest developments in quantum computing")

IhyeeFetchTool

Fetch and extract content from specific URLs.

from ihyee_langchain import IhyeeFetchTool

tool = IhyeeFetchTool(api_key="your-key")

# Single URL
result = tool.invoke("https://example.com/article")

# Multiple URLs (comma-separated)
result = tool.invoke("https://example.com/page1, https://example.com/page2")

IhyeeRenderTool

Render JavaScript-heavy pages (SPAs, dynamic content) using a headless browser.

from ihyee_langchain import IhyeeRenderTool

tool = IhyeeRenderTool(
    api_key="your-key",
    wait_for="networkidle",    # "networkidle", "domcontentloaded", or "load"
    timeout_ms=30000,          # max wait time in ms
)

result = tool.invoke("https://spa.example.com")

Configuration

All tools accept these parameters:

Parameter Description Default
api_key ihyee API key. Falls back to IHYEE_API_KEY env var. None
content_mode What to extract: "text", "links", or "both". "both"

IhyeeSearchTool additionally accepts:

Parameter Description Default
max_results Number of search results to return. 5

IhyeeRenderTool additionally accepts:

Parameter Description Default
wait_for Page load strategy: "networkidle", "domcontentloaded", or "load". "networkidle"
timeout_ms Maximum render wait time in milliseconds. 30000

Usage with LangChain agents

from langchain_openai import ChatOpenAI
from langchain.agents import AgentExecutor, create_tool_calling_agent
from langchain_core.prompts import ChatPromptTemplate
from ihyee_langchain import IhyeeSearchTool, IhyeeFetchTool

tools = [IhyeeSearchTool(), IhyeeFetchTool()]
llm = ChatOpenAI(model="gpt-4o")

prompt = ChatPromptTemplate.from_messages([
    ("system", "You are a helpful research assistant."),
    ("human", "{input}"),
    ("placeholder", "{agent_scratchpad}"),
])

agent = create_tool_calling_agent(llm, tools, prompt)
executor = AgentExecutor(agent=agent, tools=tools)

result = executor.invoke({"input": "What is the transformer architecture?"})
print(result["output"])

Usage with LangGraph

from langchain_openai import ChatOpenAI
from langgraph.prebuilt import create_react_agent
from ihyee_langchain import IhyeeSearchTool, IhyeeFetchTool

tools = [IhyeeSearchTool(), IhyeeFetchTool()]
agent = create_react_agent(ChatOpenAI(model="gpt-4o"), tools)

result = agent.invoke({
    "messages": [("user", "What is the transformer architecture?")]
})

for msg in result["messages"]:
    print(msg.content)

Environment variables

Variable Description
IHYEE_API_KEY Default API key for all tools when api_key is not passed explicitly.

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ihyee_langchain-1.2.0.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ihyee_langchain-1.2.0-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file ihyee_langchain-1.2.0.tar.gz.

File metadata

  • Download URL: ihyee_langchain-1.2.0.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for ihyee_langchain-1.2.0.tar.gz
Algorithm Hash digest
SHA256 e2629c0b7c0db6e2674f54c399dc372434a64724f3f22763da7b367be0ff280b
MD5 31bc0ac29e8cd512796aca411ab50782
BLAKE2b-256 eb16107875073f9c6a5db77c69f74e94f04dee27ff9f9fa6a1b08415dffb7ea0

See more details on using hashes here.

File details

Details for the file ihyee_langchain-1.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for ihyee_langchain-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c36bad404307f6bdee5acdd8437fa9a7ca3965192f45f110738d4a240f93a237
MD5 8d8e46c0859e88e45b96d153b118df44
BLAKE2b-256 61a7a79aacec68982e4700ff114db8ee5169d01690118f794f0a000385389268

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.2.0 This release

2 files

1.1.0

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page