Skip to main content

**Problem:**

Project description

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

Project details


Download files

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

Source Distribution

smartcite_site-2025.12.20175753.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

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

smartcite_site-2025.12.20175753-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file smartcite_site-2025.12.20175753.tar.gz.

File metadata

File hashes

Hashes for smartcite_site-2025.12.20175753.tar.gz
Algorithm Hash digest
SHA256 720ce8c15dd8a2fa284add7907f39aefd79670faeef7217d5cb876c0d69a7aff
MD5 5b201b5591917ca46be9aa4e7ecf69c6
BLAKE2b-256 d27f87b04d6eb0de83eeb848328a2838a7dfc05b0cd592251dfb86481a78b2a0

See more details on using hashes here.

File details

Details for the file smartcite_site-2025.12.20175753-py3-none-any.whl.

File metadata

File hashes

Hashes for smartcite_site-2025.12.20175753-py3-none-any.whl
Algorithm Hash digest
SHA256 1f0cbf565beb1ac636ca52c95c5829f039f5a37dd8d89dca3f30958804502834
MD5 df0551c77a634269e3c8f648d02cb18f
BLAKE2b-256 3f7efb78fd30827c7b78f3a58425bd3528181be63d00a2e10f725f5dc91b128d

See more details on using hashes here.

Supported by

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