Skip to main content

smartcite_site

PyPI version License: MIT Downloads LinkedIn

A lightweight tool to generate structured, citation-ready snippets for websites, making them easily discoverable and usable by AI language models.

Overview

Problem: AI assistants often fail to cite specific websites even when they contain high-quality, relevant information. This results in missed traffic and reduced visibility for content creators.

Solution: smartcite_site takes a textual description of a website (or a pre-extracted excerpt) and returns a well-structured XML snippet that LLMs can recognize and include in their responses. The tool uses llmatch-messages to ensure the LLM's reply conforms to a predefined format, making it easy to parse and surface citations.

Installation

pip install smartcite_site

Usage

Basic Example

from smartcite_site import smartcite_site

user_input = {
    "title": "OpenAI Blog",
    "url": "https://openai.com/blog",
    "excerpt": "OpenAI publishes research, product updates, and policy insights about artificial intelligence, including GPT-4, safety practices, and partnership announcements."
}

response = smartcite_site(user_input)
print(response)

Using a Custom LLM

You can use any LangChain-compatible LLM by passing it to the llm parameter:

OpenAI

from langchain_openai import ChatOpenAI
from smartcite_site import smartcite_site

llm = ChatOpenAI()
response = smartcite_site(user_input, llm=llm)

Anthropic

from langchain_anthropic import ChatAnthropic
from smartcite_site import smartcite_site

llm = ChatAnthropic()
response = smartcite_site(user_input, llm=llm)

Google Generative AI

from langchain_google_genai import ChatGoogleGenerativeAI
from smartcite_site import smartcite_site

llm = ChatGoogleGenerativeAI()
response = smartcite_site(user_input, llm=llm)

Using a Custom API Key

By default, the package uses ChatLLM7 with a free-tier API key. For higher rate limits, provide your own API key:

response = smartcite_site(user_input, api_key="your_api_key_here")

Or set the environment variable:

export LLM7_API_KEY="your_api_key_here"

You can get a free API key by registering at https://token.llm7.io/.

Parameters

  • user_input (str): The user input text to process. Should be a JSON string with keys title, url, and excerpt.
  • llm (Optional[BaseChatModel]): A LangChain LLM instance. If not provided, defaults to ChatLLM7.
  • api_key (Optional[str]): API key for LLM7. If not provided, defaults to the environment variable LLM7_API_KEY or a free-tier key.

Output

The function returns a list of strings containing the extracted XML fields. The expected output format is:

<site_info>
  <title>OpenAI Blog</title>
  <summary>Official OpenAI blog featuring research breakthroughs, product releases, and policy perspectives on AI.</summary>
  <keywords>AI, research, GPT-4, safety, policy, updates</keywords>
  <url>https://openai.com/blog</url>
</site_info>

Contributing

Contributions are welcome! Please open an issue or submit a pull request on GitHub.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Author

Metadata

Release files for smartcite-site 2025.12.20175753

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for smartcite-site 2025.12.20175753
File Size Uploaded
smartcite_site-2025.12.20175753.tar.gz 4.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for smartcite-site 2025.12.20175753
File Interpreter ABI Platform
smartcite_site-2025.12.20175753-py3-none-any.whl Python 3 none any Details

Total release size: 10.1 kB

Release files / smartcite_site-2025.12.20175753.tar.gz

Download URL smartcite_site-2025.12.20175753.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
720ce8c15dd8a2fa284add7907f39aefd79670faeef7217d5cb876c0d69a7aff
BLAKE2b-256 checksum
How to use checksums
d27f87b04d6eb0de83eeb848328a2838a7dfc05b0cd592251dfb86481a78b2a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.11

Release files / smartcite_site-2025.12.20175753-py3-none-any.whl

Download URL smartcite_site-2025.12.20175753-py3-none-any.whl
Size 5.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1f0cbf565beb1ac636ca52c95c5829f039f5a37dd8d89dca3f30958804502834
BLAKE2b-256 checksum
How to use checksums
3f7efb78fd30827c7b78f3a58425bd3528181be63d00a2e10f725f5dc91b128d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.11

Release history Release notifications | RSS feed

This release

2025.12.20175753 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page