11# langchain-sourcey
22
33[ ![ PyPI - Version] ( https://img.shields.io/pypi/v/langchain-sourcey?label=%20 )] ( https://pypi.org/project/langchain-sourcey/ )
4- [ ![ PyPI - Downloads] ( https://img.shields.io/pepy/dt/langchain-sourcey )] ( https://pypistats.org/packages/langchain-sourcey )
54[ ![ PyPI - License] ( https://img.shields.io/pypi/l/langchain-sourcey )] ( https://pypi.org/project/langchain-sourcey/ )
65[ ![ CI] ( https://github.com/sourcey/langchain-sourcey/actions/workflows/ci.yml/badge.svg )] ( https://github.com/sourcey/langchain-sourcey/actions/workflows/ci.yml )
76
8- ` langchain-sourcey ` is the native LangChain retriever for Sourcey-generated
9- documentation sites.
7+ > Your docs retriever should not depend on somebody else's SaaS either.
108
11- It turns a published Sourcey docs root into a LangChain knowledge source
12- without a private indexing service or ingestion pipeline. The retriever works
13- directly against Sourcey's public artefacts :
9+ ` langchain-sourcey ` reads a published Sourcey docs site directly.
10+
11+ Sourcey already ships the files a retriever needs. This package uses them :
1412
1513- ` search-index.json ` for candidate discovery
1614- ` llms-full.txt ` for full-page hydration
1715- canonical page URLs for citations
1816
19- ## Why this integration is a good LangChain fit
20-
21- - No credentials required for public docs sites
22- - Retrieval works against static hosting, subpath deployments, and GitHub Pages
23- - Returned ` Document ` objects carry canonical ` metadata["source"] ` URLs
24- - ` llms-full.txt ` gives cleaner full-page content than scraping rendered HTML
25- - If ` llms-full.txt ` is missing, the retriever falls back to page HTML
17+ If ` llms-full.txt ` is missing, it falls back to the matched page HTML.
2618
2719## Install
2820
2921``` bash
3022pip install -U langchain-sourcey
3123```
3224
33- Point ` site_url ` at the root of a published Sourcey build, for example
34- ` https://sourcey.com/docs ` or ` https://sourcey.com/cheesestore ` .
25+ Point ` site_url ` at the root of a published Sourcey build:
26+
27+ - ` https://sourcey.com/docs `
28+ - ` https://sourcey.com/cheesestore `
29+ - ` https://cheesestore.github.io `
3530
3631## Quickstart
3732
@@ -54,6 +49,8 @@ for doc in docs:
5449
5550For a runnable script, see [ examples/live_quickstart.py] ( examples/live_quickstart.py ) .
5651
52+ Sourcey guide: ` https://sourcey.com/docs/guides/guide-langchain-retriever.html `
53+
5754## Use In A LangChain Chain
5855
5956Install a chat model integration of your choice. This example uses OpenAI:
@@ -93,17 +90,16 @@ print(answer)
9390
9491For a fuller example, see [ examples/rag_chain.py] ( examples/rag_chain.py ) .
9592
96- ## Sourcey Site Contract
93+ ## Sourcey Contract
9794
98- For best results, the published Sourcey site should :
95+ This package assumes the published Sourcey site exposes :
9996
10097- publish ` search-index.json `
10198- publish ` llms-full.txt `
10299- set ` siteUrl ` in ` sourcey.config.ts ` so citations are canonical
103100
104101` search-index.json ` is required. ` llms-full.txt ` is strongly recommended because
105- it lets the retriever return full page content instead of HTML-derived fallback
106- text.
102+ it gives the retriever full page content instead of HTML-derived fallback text.
107103
108104## Returned Metadata
109105
@@ -141,6 +137,4 @@ This repo includes draft docs ready to turn into a LangChain docs PR:
141137
142138## Scope
143139
144- This package intentionally ships ` SourceyRetriever ` only. A document loader is
145- deferred until the retriever proves enough demand to justify the maintenance
146- surface.
140+ This package ships ` SourceyRetriever ` only. No loader yet.
0 commit comments