Metadata-Version: 2.5
Name: langchain-suprsonic
Version: 0.1.0
Summary: Load source pages and find official updates with Suprsonic tools for LangChain.
Project-URL: Homepage, https://suprsonic.ai
Project-URL: Documentation, https://github.com/founden-bot/langchain-suprsonic#readme
Project-URL: Repository, https://github.com/founden-bot/langchain-suprsonic
License-Expression: MIT
License-File: LICENSE
Requires-Python: >=3.10
Requires-Dist: langchain-core<2,>=1
Requires-Dist: suprsonic<1,>=0.3.3
Description-Content-Type: text/markdown

# Suprsonic tools for LangChain

Load source pages for a documentation assistant, or find official release notes for a recurring software update check. Both examples make a real Suprsonic request using your own API key. You can run them without a language model.

## Load a source page for a documentation assistant

1. [Get your Suprsonic API key](https://suprsonic.ai/app/api?utm_source=langchain&utm_medium=example&utm_campaign=source-page-loader). Sign in and copy a key from the dashboard. If you open a new account, confirm your email to use its welcome credits.
2. Install the package and set `SUPRSONIC_API_KEY` in your shell or secret manager.
3. Run the example with a public page your assistant needs to read, such as the Python release schedule.

```bash
python -m pip install langchain-suprsonic
python -m langchain_suprsonic source-page https://www.python.org/downloads/
```

The response contains the title and Markdown under `data`, plus `source_url`, `request_id`, and `credits_used`. Use `source_url` with the text when you cite it. The example uses Fast mode for static HTML.

```python
from langchain_suprsonic import source_page_tool

load_source_page = source_page_tool()
result = load_source_page.invoke({"url": "https://www.python.org/downloads/"})
print(result["data"]["title"], result["request_id"], result["credits_used"])
```

For recurring production requests, sign in to the same account and [choose a plan with API credits](https://suprsonic.ai/plans?utm_source=langchain&utm_medium=example&utm_campaign=source-page-loader). Once the plan is active, rerun the command with the same key. Check the request and its credit charge in your API dashboard.

## Find official release notes for an update monitor

[Get your Suprsonic API key](https://suprsonic.ai/app/api?utm_source=langchain&utm_medium=example&utm_campaign=release-note-search), install the same package, and search a publisher's official domain.

```bash
python -m langchain_suprsonic search-sources 'site:docs.python.org Python release notes' --num-results 5
```

The results in `data.organic_results` include titles, links, and snippets. The search uses SERP mode, so your monitor can use the underlying sources directly.

```python
from langchain_suprsonic import source_search_tool

search_sources = source_search_tool()
result = search_sources.invoke({"query": "site:docs.python.org Python release notes"})
for source in result["data"].get("organic_results", []):
    print(source["title"], source["url"])
```

[Choose a plan with API credits](https://suprsonic.ai/plans?utm_source=langchain&utm_medium=example&utm_campaign=release-note-search) when you are ready to run this on a schedule. Keep the same key in your deployment's secret manager.

Both factories return a LangChain `StructuredTool` you can add to an existing agent's `tools` list. Each invocation makes one API request. See the [Suprsonic API reference](https://suprsonic.ai/docs/api) for current modes, credit costs, and error details.
