LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
    • Overview
    • Caches
    • Callbacks
    • Documents
    • Document loaders
    • Embeddings
    • Exceptions
    • Language models
    • Serialization
    • Output parsers
    • Prompts
    • Rate limiters
    • Retrievers
    • Runnables
    • Utilities
    • Vector stores
    MCP Adapters
    Standard Tests
    Text Splitters
    ⌘I

    LangChain Assistant

    Ask a question to get started

    Enter to send•Shift+Enter new line

    Menu

    OverviewCachesCallbacksDocumentsDocument loadersEmbeddingsExceptionsLanguage modelsSerializationOutput parsersPromptsRate limitersRetrieversRunnablesUtilitiesVector stores
    MCP Adapters
    Standard Tests
    Text Splitters
    Language
    Theme
    Pythonlangchain-coremessagescontentCitation
    Class●Since v1.0

    Citation

    Annotation for citing data from a document.

    Note

    start/end indices refer to the response text, not the source text. This means that the indices are relative to the model's response, not the original document (as specified in the url).

    Factory function

    create_citation may also be used as a factory to create a Citation. Benefits include:

    • Automatic ID generation (when not provided)
    • Required arguments strictly validated at creation time
    Copy
    Citation()

    Bases

    TypedDict

    Constructors

    constructor
    __init__
    NameType
    typeLiteral['citation']
    idNotRequired[str]
    urlNotRequired[str]
    titleNotRequired[str]
    start_indexNotRequired[int]
    end_indexNotRequired[int]
    cited_textNotRequired[str]
    extrasNotRequired[dict[str, Any]]

    Attributes

    attribute
    type: Literal['citation']

    Type of the content block. Used for discrimination.

    attribute
    id: NotRequired[str]

    Unique identifier for this content block.

    Either:

    • Generated by the provider
    • Generated by LangChain upon creation (UUID4 prefixed with 'lc_'))
    attribute
    url: NotRequired[str]

    URL of the document source.

    attribute
    title: NotRequired[str]

    Source document title.

    For example, the page title for a web page or the title of a paper.

    attribute
    start_index: NotRequired[int]

    Start index of the response text (TextContentBlock.text).

    attribute
    end_index: NotRequired[int]

    End index of the response text (TextContentBlock.text)

    attribute
    cited_text: NotRequired[str]

    Excerpt of source text being cited.

    attribute
    extras: NotRequired[dict[str, Any]]

    Provider-specific metadata.

    View source on GitHub