{"id":37066049,"url":"https://github.com/superlinked/langchain-superlinked","last_synced_at":"2026-01-14T07:44:52.798Z","repository":{"id":309198939,"uuid":"1035432950","full_name":"superlinked/langchain-superlinked","owner":"superlinked","description":"Custom superlinked retriever in langchain","archived":false,"fork":false,"pushed_at":"2025-09-05T16:54:09.000Z","size":66,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-27T05:49:20.773Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/superlinked.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-08-10T11:45:04.000Z","updated_at":"2025-09-05T16:54:13.000Z","dependencies_parsed_at":"2025-08-10T14:53:57.039Z","dependency_job_id":null,"html_url":"https://github.com/superlinked/langchain-superlinked","commit_stats":null,"previous_names":["superlinked/langchain-superlinked"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/superlinked/langchain-superlinked","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/superlinked%2Flangchain-superlinked","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/superlinked%2Flangchain-superlinked/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/superlinked%2Flangchain-superlinked/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/superlinked%2Flangchain-superlinked/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/superlinked","download_url":"https://codeload.github.com/superlinked/langchain-superlinked/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/superlinked%2Flangchain-superlinked/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28413486,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T05:26:33.345Z","status":"ssl_error","status_checked_at":"2026-01-14T05:21:57.251Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-14T07:44:52.068Z","updated_at":"2026-01-14T07:44:52.785Z","avatar_url":"https://github.com/superlinked.png","language":"Python","readme":"## langchain-superlinked\n\u003cimg width=\"640\" height=\"400\" alt=\"image\" src=\"https://github.com/user-attachments/assets/f2435f45-403d-4e82-9237-faebe9746a06\" /\u003e\n\n\nIntegration package that exposes Superlinked retrieval capabilities via the standard LangChain retriever interface. It lets you plug a Superlinked-powered retriever into LangChain RAG pipelines while keeping your vector storage and schema choices flexible.\nIf you want to dive deeper into how Superlinked's mixture-of-encoders algorithm is different, [learn more here](https://links.superlinked.com/get_demo_langchain).\n\n### Install\n\n```bash\npip install -U langchain-superlinked superlinked\n```\n\n### Quickstart\n\n```python\nimport superlinked.framework as sl\nfrom langchain_superlinked import SuperlinkedRetriever\n\nclass DocumentSchema(sl.Schema):\n    id: sl.IdField\n    content: sl.String\n\ndoc_schema = DocumentSchema()\ntext_space = sl.TextSimilaritySpace(text=doc_schema.content, model=\"sentence-transformers/all-MiniLM-L6-v2\")\nindex = sl.Index([text_space])\nquery = (\n    sl.Query(index)\n    .find(doc_schema)\n    .similar(text_space.text, sl.Param(\"query_text\"))\n    .select([doc_schema.content])\n)\n\nsource = sl.InMemorySource(schema=doc_schema)\nexecutor = sl.InMemoryExecutor(sources=[source], indices=[index])\napp = executor.run()\nsource.put([\n    {\"id\": \"1\", \"content\": \"Machine learning processes data efficiently.\"},\n    {\"id\": \"2\", \"content\": \"NLP understands human language.\"},\n])\n\nretriever = SuperlinkedRetriever(sl_client=app, sl_query=query, page_content_field=\"content\")\ndocs = retriever.invoke(\"artificial intelligence\", k=2)\n```\n\nSee more end-to-end examples in `docs/`.\n\n---\n\n## Local development\n\nPrerequisites: Python 3.10–3.13, `uv` installed.\n\n- Setup: `uv sync --all-extras --dev \u0026\u0026 uv run pre-commit install`\n- Lint \u0026 type-check: `uv run ruff check . \u0026\u0026 uv run ruff format --check . \u0026\u0026 uv run mypy langchain_superlinked`\n- Unit tests: `make test`\n- Integration tests: `make integration_tests` (skips if `langchain_tests` isn’t installed)\n- Smoke test: `make smoke`\n- Run examples: `uv run python docs/quickstart_examples.py`\n\n---\n\n## CI/CD overview\n\nOn push/PR to `main`, GitHub Actions runs (matrix: 3.10/3.11/3.12):\n- Lint: `ruff check .` and `ruff format --check .`\n- Type-check: `mypy langchain_superlinked`\n- Tests: unit (network disabled) and integration (skips if standard tests unavailable)\n- Smoke test: imports the package and symbols\n- Build: `python -m build` to produce sdist and wheel (no publish)\n\nWorkflow file: `.github/workflows/ci.yml`.\n\n---\n\n## Releasing\n\n- Preferred: tag-based OIDC publish\n  - Ensure PyPI Trusted Publisher is configured for this repo.\n  - Bump version in `pyproject.toml` using semantic versioning.\n  - Tag and push: `git tag vX.Y.Z \u0026\u0026 git push origin vX.Y.Z`\n  - CI will build and publish automatically.\n- Manual (fallback):\n  - Build artifacts: `make dist`\n  - Validate: `uv run twine check dist/*`\n  - Publish to PyPI: `uv run twine upload -r pypi dist/*`\n\nAfter publish, open/refresh the docs PR in the LangChain monorepo to reference the new version if needed. See LangChain’s integration guide for the process: [How to contribute an integration](https://python.langchain.com/docs/contributing/how_to/integrations/#how-to-contribute-an-integration).\n\n---\n\n## Implementation overview\n\n- Primary entrypoint: `langchain_superlinked/retrievers.py` exposes `SuperlinkedRetriever`, a `BaseRetriever`.\n- Construction:\n  - `sl_client`: Superlinked App (e.g., from `InMemoryExecutor.run()`).\n  - `sl_query`: Superlinked `QueryDescriptor` built via `sl.Query(...).find(...).similar(...).select(...)`.\n  - `page_content_field`: field from Superlinked results mapped to `Document.page_content`.\n  - Optional `metadata_fields`: copied into `Document.metadata` in addition to the always-present `id`.\n- Behavior:\n  - Accepts runtime parameters (e.g., `k`, weights, filters) and forwards them to the Superlinked query.\n  - Handles missing fields gracefully; returns an empty list on upstream exceptions.\n\n---\n\n## Scope and non-goals\n\nThis package aims to be the minimal, well-typed LangChain integration layer for Superlinked retrievers. It intentionally does not include:\n\n- Dynamic schema inference or auto-generation for arbitrary datasets. Rationale: datasets vary widely; a robust solution requires additional assumptions (typing, transforms, index strategy), which goes beyond the minimal integration. We recommend implementing this in a separate helper package or cookbook code layered on top (e.g., “schema builders” that emit Superlinked schemas and indices for your domain). The examples in `docs/` illustrate patterns for composing spaces (text, categorical, numeric, recency) that such builders could automate.\n- Non-retriever integrations (custom LLMs, embeddings, caches, loaders). These can live in separate packages if needed.\n\nIf you have concrete requirements for dynamic schema construction, please open an issue with sample data and desired retrieval behavior so we can discuss an extensible approach that stays decoupled from the core integration.\n\n---\n\n## Links\n\n- Usage examples and scenarios: `docs/`\n- LangChain integration guide: [How to contribute an integration](https://python.langchain.com/docs/contributing/how_to/integrations/#how-to-contribute-an-integration)\n- Superlinked: `https://superlinked.com`\n\n## License\n\nMIT (see `LICENSE`)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuperlinked%2Flangchain-superlinked","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsuperlinked%2Flangchain-superlinked","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuperlinked%2Flangchain-superlinked/lists"}