From 772e35abcb58596bf7b7a3f9ca6ad3347305cbb7 Mon Sep 17 00:00:00 2001 From: Erick Friis Date: Sat, 21 Dec 2024 13:45:00 -0500 Subject: [PATCH 1/6] docs: sorted by downloads [wip] --- docs/scripts/packages_yml_get_downloads.py | 19 +++ docs/scripts/partner_pkg_table.py | 131 ++++++++++++++------- 2 files changed, 108 insertions(+), 42 deletions(-) create mode 100644 docs/scripts/packages_yml_get_downloads.py diff --git a/docs/scripts/packages_yml_get_downloads.py b/docs/scripts/packages_yml_get_downloads.py new file mode 100644 index 0000000000000..db427b92bb7d8 --- /dev/null +++ b/docs/scripts/packages_yml_get_downloads.py @@ -0,0 +1,19 @@ +import requests +from pathlib import Path +import yaml + +PACKAGE_YML = Path(__file__).parents[2] / "libs" / "packages.yml" + +def _get_downloads(p: dict) -> int: + url = f"https://pypistats.org/api/packages/{p['name']}/recent?period=month" + r = requests.get(url) + r.raise_for_status() + return r.json()["data"]["last_month"] + +with open(PACKAGE_YML) as f: + data = yaml.safe_load(f) + for p in data["packages"]: + p["downloads"] = _get_downloads(p) + +with open(PACKAGE_YML, "w") as f: + yaml.dump(data, f) \ No newline at end of file diff --git a/docs/scripts/partner_pkg_table.py b/docs/scripts/partner_pkg_table.py index 6dfdcecbbf2bb..6e178fc83149e 100644 --- a/docs/scripts/partner_pkg_table.py +++ b/docs/scripts/partner_pkg_table.py @@ -2,32 +2,25 @@ import sys from pathlib import Path +import requests import yaml -DOCS_DIR = Path(__file__).parents[1] -PACKAGE_YML = Path(__file__).parents[2] / "libs" / "packages.yml" -IGNORE_PACKGAGES = {"langchain-experimental"} - -# for now, only include packages that are in the langchain-ai org -# because we don't have a policy for inclusion in this table yet, -# and including all packages will make the list too long -with open(PACKAGE_YML) as f: - data = yaml.safe_load(f) - EXTERNAL_PACKAGES = set( - p["name"][10:] - for p in data["packages"] - if p["repo"].startswith("langchain-ai/") - and p["repo"] != "langchain-ai/langchain" - and p["name"] not in IGNORE_PACKGAGES - ) - IN_REPO_PACKAGES = set( - p["name"][10:] - for p in data["packages"] - if p["repo"] == "langchain-ai/langchain" - and p["path"].startswith("libs/partners") - and p["name"] not in IGNORE_PACKGAGES - ) +################# +# CONFIGURATION # +################# + +# packages to ignore / exclude from the table +IGNORE_PACKGAGES = { + "langchain-core", + "langchain-text-splitters", + "langchain", + "langchain-community", + "langchain-experimental", + "langchain-cli", + "langchain-tests", +} +# list of js packages to look up corresponding ones JS_PACKAGES = { "google-gauth", "openai", @@ -60,13 +53,14 @@ "ibm", } -ALL_PACKAGES = IN_REPO_PACKAGES.union(EXTERNAL_PACKAGES) - +# custom names for packages CUSTOM_NAME = { "google-genai": "Google Generative AI", "aws": "AWS", "ibm": "IBM", } + +# custom provider pages CUSTOM_PROVIDER_PAGES = { "azure-dynamic-sessions": "/docs/integrations/providers/microsoft/", "prompty": "/docs/integrations/providers/microsoft/", @@ -80,32 +74,85 @@ "sema4": "/docs/integrations/providers/robocorp/", "postgres": "/docs/integrations/providers/pgvector/", } -PROVIDER_PAGES = { - name: f"/docs/integrations/providers/{name}/" - for name in ALL_PACKAGES - if glob.glob(str(DOCS_DIR / f"docs/integrations/providers/{name}.*")) -} -PROVIDER_PAGES = { - **PROVIDER_PAGES, - **CUSTOM_PROVIDER_PAGES, -} + +##################### +# END CONFIGURATION # +##################### + +DOCS_DIR = Path(__file__).parents[1] +PACKAGE_YML = Path(__file__).parents[2] / "libs" / "packages.yml" + +# for now, only include packages that are in the langchain-ai org +# because we don't have a policy for inclusion in this table yet, +# and including all packages will make the list too long + + +def _get_type(package: dict) -> str: + if package["name"] in IGNORE_PACKGAGES: + return "ignore" + if package["repo"] == "langchain-ai/langchain": + return "B" + if package["repo"].startswith("langchain-ai/"): + return "C" + return "D" + + +def _enrich_package(p: dict) -> dict | None: + p["name_short"] = ( + p["name"][10:] if p["name"].startswith("langchain-") else p["name"] + ) + p["name_title"] = CUSTOM_NAME.get(p["name_short"]) or p[ + "name_short" + ].title().replace("-", " ").replace("db", "DB").replace("Db", "DB").replace( + "ai", "AI" + ).replace("Ai", "AI") + p["type"] = _get_type(p) + + if p["type"] == "ignore": + return None + + p["js_exists"] = p["name_short"] in JS_PACKAGES + custom_provider_page = CUSTOM_PROVIDER_PAGES.get(p["name_short"]) + default_provider_page = f"/docs/integrations/providers/{p['name_short']}/" + default_provider_page_exists = bool( + glob.glob(str(DOCS_DIR / f"docs/integrations/providers/{p['name_short']}.*")) + ) + p["provider_page"] = custom_provider_page or ( + default_provider_page if default_provider_page_exists else None + ) + if p["provider_page"] is None: + msg = ( + f"Provider page not found for {p['name_short']}. " + f"Please add one at docs/integrations/providers/{p['name_short']}.{{mdx,ipynb}}" + ) + raise ValueError(msg) + + return p + + +with open(PACKAGE_YML) as f: + data = yaml.safe_load(f) + +packages_n = [_enrich_package(p) for p in data["packages"]] +packages = [p for p in packages_n if p is not None] + +# sort by downloads +packages_sorted = [t[1] for t in sorted((p["downloads"], p) for p in packages)] -def package_row(name: str) -> str: - js = "✅" if name in JS_PACKAGES else "❌" - link = PROVIDER_PAGES.get(name) - title = CUSTOM_NAME.get(name) or name.title().replace("-", " ").replace( - "db", "DB" - ).replace("Db", "DB").replace("ai", "AI").replace("Ai", "AI") +def package_row(p: dict) -> str: + js = "✅" if p["js_exists"] else "❌" + link = p["provider_page"] + title = p["name_title"] provider = f"[{title}]({link})" if link else title - return f"| {provider} | [langchain-{name}](https://python.langchain.com/api_reference/{name.replace('-', '_')}/) | ![PyPI - Downloads](https://img.shields.io/pypi/dm/langchain-{name}?style=flat-square&label=%20&color=blue) | ![PyPI - Version](https://img.shields.io/pypi/v/langchain-{name}?style=flat-square&label=%20&color=orange) | {js} |" + return f"| {provider} | [{p['name']}](https://python.langchain.com/api_reference/{p['name_short'].replace('-', '_')}/) | ![PyPI - Downloads](https://img.shields.io/pypi/dm/{p['name']}?style=flat-square&label=%20&color=blue) | ![PyPI - Version](https://img.shields.io/pypi/v/{p['name']}?style=flat-square&label=%20&color=orange) | {js} |" def table() -> str: header = """| Provider | Package | Downloads | Latest | [JS](https://js.langchain.com/docs/integrations/providers/) | | :--- | :---: | :---: | :---: | :---: | """ - return header + "\n".join(package_row(name) for name in sorted(ALL_PACKAGES)) + return header + "\n".join(package_row(p) for p in packages_sorted) def doc() -> str: From 5a3f4fc8428c13fde6ea5d2b74405740e51703ed Mon Sep 17 00:00:00 2001 From: Erick Friis Date: Mon, 23 Dec 2024 15:13:13 -0500 Subject: [PATCH 2/6] x --- docs/scripts/packages_yml_get_downloads.py | 21 +- libs/packages.yml | 443 +++++++++++++-------- 2 files changed, 293 insertions(+), 171 deletions(-) diff --git a/docs/scripts/packages_yml_get_downloads.py b/docs/scripts/packages_yml_get_downloads.py index db427b92bb7d8..43fdddccff6c0 100644 --- a/docs/scripts/packages_yml_get_downloads.py +++ b/docs/scripts/packages_yml_get_downloads.py @@ -1,6 +1,7 @@ import requests from pathlib import Path import yaml +from datetime import datetime, timezone, timedelta PACKAGE_YML = Path(__file__).parents[2] / "libs" / "packages.yml" @@ -10,10 +11,24 @@ def _get_downloads(p: dict) -> int: r.raise_for_status() return r.json()["data"]["last_month"] +current_datetime = datetime.now(timezone.utc) +yesterday = current_datetime - timedelta(days=1) + with open(PACKAGE_YML) as f: data = yaml.safe_load(f) - for p in data["packages"]: - p["downloads"] = _get_downloads(p) +for p in data["packages"]: + downloads_updated_at = datetime.fromisoformat(p["downloads_updated_at"]) + + if downloads_updated_at > yesterday: + print(f"done: {p['name']}: {p['downloads']}") + continue + + p["downloads"] = _get_downloads(p) + p['downloads_updated_at'] = current_datetime.isoformat() + with open(PACKAGE_YML, "w") as f: + yaml.dump(data, f) + print(f"{p['name']}: {p['downloads']}") + with open(PACKAGE_YML, "w") as f: - yaml.dump(data, f) \ No newline at end of file + yaml.dump(data, f) diff --git a/libs/packages.yml b/libs/packages.yml index da26ed6f0cfb8..ddb5b61900b4c 100644 --- a/libs/packages.yml +++ b/libs/packages.yml @@ -1,169 +1,276 @@ -# this file is used to define the packages that are used in the project -# it is EXPERIMENTAL and may be removed in the future - packages: - - name: langchain-core - repo: langchain-ai/langchain - path: libs/core - - name: langchain-text-splitters - repo: langchain-ai/langchain - path: libs/text-splitters - - name: langchain - repo: langchain-ai/langchain - path: libs/langchain - - name: langchain-community - repo: langchain-ai/langchain - path: libs/community - - name: langchain-experimental - repo: langchain-ai/langchain-experimental - path: libs/experimental - - name: langchain-cli - repo: langchain-ai/langchain - path: libs/cli - - name: langchain-ai21 - repo: langchain-ai/langchain-ai21 - path: libs/ai21 - - name: langchain-anthropic - repo: langchain-ai/langchain - path: libs/partners/anthropic - - name: langchain-chroma - repo: langchain-ai/langchain - path: libs/partners/chroma - - name: langchain-exa - repo: langchain-ai/langchain - path: libs/partners/exa - - name: langchain-fireworks - repo: langchain-ai/langchain - path: libs/partners/fireworks - - name: langchain-groq - repo: langchain-ai/langchain - path: libs/partners/groq - - name: langchain-huggingface - repo: langchain-ai/langchain - path: libs/partners/huggingface - - name: langchain-ibm - repo: langchain-ai/langchain-ibm - path: libs/ibm - - name: langchain-localai - repo: mkhludnev/langchain-localai - path: libs/localai - - name: langchain-milvus - repo: langchain-ai/langchain-milvus - path: libs/milvus - - name: langchain-mistralai - repo: langchain-ai/langchain - path: libs/partners/mistralai - - name: langchain-mongodb - repo: langchain-ai/langchain-mongodb - path: libs/mongodb - - name: langchain-nomic - repo: langchain-ai/langchain - path: libs/partners/nomic - - name: langchain-openai - repo: langchain-ai/langchain - path: libs/partners/openai - - name: langchain-pinecone - repo: langchain-ai/langchain - path: libs/partners/pinecone - - name: langchain-prompty - repo: langchain-ai/langchain - path: libs/partners/prompty - - name: langchain-qdrant - repo: langchain-ai/langchain - path: libs/partners/qdrant - - name: langchain-scrapegraph - repo: ScrapeGraphAI/langchain-scrapegraph - path: . - - name: langchain-sema4 - repo: langchain-ai/langchain-sema4 - path: libs/sema4 - - name: langchain-together - repo: langchain-ai/langchain-together - path: libs/together - - name: langchain-upstage - repo: langchain-ai/langchain-upstage - path: libs/upstage - - name: langchain-voyageai - repo: langchain-ai/langchain - path: libs/partners/voyageai - - name: langchain-aws - repo: langchain-ai/langchain-aws - path: libs/aws - - name: langchain-astradb - repo: langchain-ai/langchain-datastax - path: libs/astradb - - name: langchain-google-genai - repo: langchain-ai/langchain-google - path: libs/genai - - name: langchain-google-vertexai - repo: langchain-ai/langchain-google - path: libs/vertexai - - name: langchain-google-community - repo: langchain-ai/langchain-google - path: libs/community - - name: langchain-weaviate - repo: langchain-ai/langchain-weaviate - path: libs/weaviate - - name: langchain-cohere - repo: langchain-ai/langchain-cohere - path: libs/cohere - - name: langchain-elasticsearch - repo: langchain-ai/langchain-elastic - path: libs/elasticsearch - - name: langchain-nvidia-ai-endpoints - repo: langchain-ai/langchain-nvidia - path: libs/ai-endpoints - - name: langchain-postgres - repo: langchain-ai/langchain-postgres - path: . - - name: langchain-redis - repo: langchain-ai/langchain-redis - path: libs/redis - - name: langchain-unstructured - repo: langchain-ai/langchain-unstructured - path: libs/unstructured - - name: langchain-azure-dynamic-sessions - repo: langchain-ai/langchain-azure - path: libs/azure-dynamic-sessions - - name: langchain-sqlserver - repo: langchain-ai/langchain-azure - path: libs/sqlserver - - name: langchain-cerebras - repo: langchain-ai/langchain-cerebras - path: libs/cerebras - - name: langchain-snowflake - repo: langchain-ai/langchain-snowflake - path: libs/snowflake - - name: langchain-databricks - repo: langchain-ai/langchain-databricks - path: libs/databricks - - name: langchain-ibm - repo: langchain-ai/langchain-ibm - path: libs/ibm - - name: langchain-couchbase - repo: langchain-ai/langchain - path: libs/partners/couchbase - - name: langchain-ollama - repo: langchain-ai/langchain - path: libs/partners/ollama - - name: langchain-box - repo: langchain-ai/langchain-box - path: libs/box - - name: langchain-tests - repo: langchain-ai/langchain - path: libs/standard-tests - - name: langchain-neo4j - repo: langchain-ai/langchain-neo4j - path: libs/neo4j - - name: langchain-linkup - repo: LinkupPlatform/langchain-linkup - path: . - - name: langchain-yt-dlp - repo: aqib0770/langchain-yt-dlp - path: . - - name: langchain-oceanbase - repo: oceanbase/langchain-oceanbase - path: . - - name: langchain-predictionguard - repo: predictionguard/langchain-predictionguard - path: . \ No newline at end of file +- downloads: 27728892 + downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' + name: langchain-core + path: libs/core + repo: langchain-ai/langchain +- downloads: 10343427 + downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' + name: langchain-text-splitters + path: libs/text-splitters + repo: langchain-ai/langchain +- downloads: 27515102 + downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' + name: langchain + path: libs/langchain + repo: langchain-ai/langchain +- downloads: 17505668 + downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' + name: langchain-community + path: libs/community + repo: langchain-ai/langchain +- downloads: 1710421 + downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' + name: langchain-experimental + path: libs/experimental + repo: langchain-ai/langchain-experimental +- downloads: 55505 + downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' + name: langchain-cli + path: libs/cli + repo: langchain-ai/langchain +- downloads: 3453 + downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' + name: langchain-ai21 + path: libs/ai21 + repo: langchain-ai/langchain-ai21 +- downloads: 1163020 + downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' + name: langchain-anthropic + path: libs/partners/anthropic + repo: langchain-ai/langchain +- downloads: 450092 + downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' + name: langchain-chroma + path: libs/partners/chroma + repo: langchain-ai/langchain +- downloads: 4560 + downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' + name: langchain-exa + path: libs/partners/exa + repo: langchain-ai/langchain +- downloads: 73179 + downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' + name: langchain-fireworks + path: libs/partners/fireworks + repo: langchain-ai/langchain +- downloads: 370373 + downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' + name: langchain-groq + path: libs/partners/groq + repo: langchain-ai/langchain +- downloads: 375151 + downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' + name: langchain-huggingface + path: libs/partners/huggingface + repo: langchain-ai/langchain +- downloads: 261091 + downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' + name: langchain-ibm + path: libs/ibm + repo: langchain-ai/langchain-ibm +- downloads: 510 + downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' + name: langchain-localai + path: libs/localai + repo: mkhludnev/langchain-localai +- downloads: 111126 + downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' + name: langchain-milvus + path: libs/milvus + repo: langchain-ai/langchain-milvus +- downloads: 232463 + downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' + name: langchain-mistralai + path: libs/partners/mistralai + repo: langchain-ai/langchain +- downloads: 113328 + downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' + name: langchain-mongodb + path: libs/mongodb + repo: langchain-ai/langchain-mongodb +- downloads: 10175 + downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' + name: langchain-nomic + path: libs/partners/nomic + repo: langchain-ai/langchain +- downloads: 7994138 + downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' + name: langchain-openai + path: libs/partners/openai + repo: langchain-ai/langchain +- downloads: 345657 + downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' + name: langchain-pinecone + path: libs/partners/pinecone + repo: langchain-ai/langchain +- downloads: 976 + downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' + name: langchain-prompty + path: libs/partners/prompty + repo: langchain-ai/langchain +- downloads: 77743 + downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' + name: langchain-qdrant + path: libs/partners/qdrant + repo: langchain-ai/langchain +- downloads: 907 + downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' + name: langchain-scrapegraph + path: . + repo: ScrapeGraphAI/langchain-scrapegraph +- downloads: 987 + downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' + name: langchain-sema4 + path: libs/sema4 + repo: langchain-ai/langchain-sema4 +- downloads: 44887 + downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' + name: langchain-together + path: libs/together + repo: langchain-ai/langchain-together +- downloads: 20951 + downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' + name: langchain-upstage + path: libs/upstage + repo: langchain-ai/langchain-upstage +- downloads: 11253 + downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' + name: langchain-voyageai + path: libs/partners/voyageai + repo: langchain-ai/langchain +- downloads: 1507701 + downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' + name: langchain-aws + path: libs/aws + repo: langchain-ai/langchain-aws +- downloads: 64185 + downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' + name: langchain-astradb + path: libs/astradb + repo: langchain-ai/langchain-datastax +- downloads: 732265 + downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' + name: langchain-google-genai + path: libs/genai + repo: langchain-ai/langchain-google +- downloads: 7668881 + downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' + name: langchain-google-vertexai + path: libs/vertexai + repo: langchain-ai/langchain-google +- downloads: 3055901 + downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' + name: langchain-google-community + path: libs/community + repo: langchain-ai/langchain-google +- downloads: 26639 + downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' + name: langchain-weaviate + path: libs/weaviate + repo: langchain-ai/langchain-weaviate +- downloads: 513053 + downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' + name: langchain-cohere + path: libs/cohere + repo: langchain-ai/langchain-cohere +- downloads: 108874 + downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' + name: langchain-elasticsearch + path: libs/elasticsearch + repo: langchain-ai/langchain-elastic +- downloads: 129677 + downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' + name: langchain-nvidia-ai-endpoints + path: libs/ai-endpoints + repo: langchain-ai/langchain-nvidia +- downloads: 293866 + downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' + name: langchain-postgres + path: . + repo: langchain-ai/langchain-postgres +- downloads: 17549 + downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' + name: langchain-redis + path: libs/redis + repo: langchain-ai/langchain-redis +- downloads: 88721 + downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' + name: langchain-unstructured + path: libs/unstructured + repo: langchain-ai/langchain-unstructured +- downloads: 7285 + downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' + name: langchain-azure-dynamic-sessions + path: libs/azure-dynamic-sessions + repo: langchain-ai/langchain-azure +- downloads: 1489 + downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' + name: langchain-sqlserver + path: libs/sqlserver + repo: langchain-ai/langchain-azure +- downloads: 9426 + downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' + name: langchain-cerebras + path: libs/cerebras + repo: langchain-ai/langchain-cerebras +- downloads: 2374 + downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' + name: langchain-snowflake + path: libs/snowflake + repo: langchain-ai/langchain-snowflake +- downloads: 35495 + downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' + name: langchain-databricks + path: libs/databricks + repo: langchain-ai/langchain-databricks +- downloads: 261091 + downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' + name: langchain-ibm + path: libs/ibm + repo: langchain-ai/langchain-ibm +- downloads: 347 + downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' + name: langchain-couchbase + path: libs/partners/couchbase + repo: langchain-ai/langchain +- downloads: 310741 + downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' + name: langchain-ollama + path: libs/partners/ollama + repo: langchain-ai/langchain +- downloads: 2749 + downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' + name: langchain-box + path: libs/box + repo: langchain-ai/langchain-box +- downloads: 3691 + downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' + name: langchain-tests + path: libs/standard-tests + repo: langchain-ai/langchain +- downloads: 8871 + downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' + name: langchain-neo4j + path: libs/neo4j + repo: langchain-ai/langchain-neo4j +- downloads: 818 + downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' + name: langchain-linkup + path: . + repo: LinkupPlatform/langchain-linkup +- downloads: 776 + downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' + name: langchain-yt-dlp + path: . + repo: aqib0770/langchain-yt-dlp +- downloads: 322 + downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' + name: langchain-oceanbase + path: . + repo: oceanbase/langchain-oceanbase +- downloads: 156 + downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' + name: langchain-predictionguard + path: . + repo: predictionguard/langchain-predictionguard From 0712a147bf852f442232351b245b5d3bbbf0979e Mon Sep 17 00:00:00 2001 From: Erick Friis Date: Mon, 23 Dec 2024 15:37:00 -0500 Subject: [PATCH 3/6] x --- docs/scripts/packages_yml_get_downloads.py | 24 +++++++- docs/scripts/partner_pkg_table.py | 68 ++++------------------ libs/packages.yml | 35 +++++++++++ 3 files changed, 67 insertions(+), 60 deletions(-) diff --git a/docs/scripts/packages_yml_get_downloads.py b/docs/scripts/packages_yml_get_downloads.py index 43fdddccff6c0..8ec2d578eef4b 100644 --- a/docs/scripts/packages_yml_get_downloads.py +++ b/docs/scripts/packages_yml_get_downloads.py @@ -1,7 +1,10 @@ import requests from pathlib import Path -import yaml +from ruamel.yaml import YAML from datetime import datetime, timezone, timedelta +from ruamel.yaml.comments import CommentedMap + +yaml = YAML() PACKAGE_YML = Path(__file__).parents[2] / "libs" / "packages.yml" @@ -15,7 +18,24 @@ def _get_downloads(p: dict) -> int: yesterday = current_datetime - timedelta(days=1) with open(PACKAGE_YML) as f: - data = yaml.safe_load(f) + data = yaml.load(f) + +def _reorder_keys(p): + keys = p.keys() + key_order = [ + # "name", + "name_title", + "repo", + "type", + "provider_page", + "js", + "downloads", + "downloads_updated_at", + ] + if set(keys) - set(key_order): + raise ValueError(f"Unexpected keys: {set(keys) - set(key_order)}") + return CommentedMap((k, p[k]) for k in key_order if k in p) +data["packages"] = [CommentedMap(p) for p in data["packages"]] for p in data["packages"]: downloads_updated_at = datetime.fromisoformat(p["downloads_updated_at"]) diff --git a/docs/scripts/partner_pkg_table.py b/docs/scripts/partner_pkg_table.py index 6e178fc83149e..664ac0157c92a 100644 --- a/docs/scripts/partner_pkg_table.py +++ b/docs/scripts/partner_pkg_table.py @@ -11,6 +11,7 @@ # packages to ignore / exclude from the table IGNORE_PACKGAGES = { + # top-level packages "langchain-core", "langchain-text-splitters", "langchain", @@ -18,61 +19,12 @@ "langchain-experimental", "langchain-cli", "langchain-tests", -} - -# list of js packages to look up corresponding ones -JS_PACKAGES = { - "google-gauth", - "openai", - "anthropic", - "google-genai", - "pinecone", - "aws", - "google-vertexai", - "qdrant", - "azure-dynamic-sessions", - "google-vertexai-web", - "redis", - "azure-openai", - "google-webauth", - "baidu-qianfan", - "groq", - "standard-tests", - "cloudflare", - "mistralai", - "textsplitters", - "cohere", - "mixedbread-ai", - "weaviate", - "mongodb", - "yandex", - "exa", - "nomic", - "google-common", - "ollama", - "ibm", -} - -# custom names for packages -CUSTOM_NAME = { - "google-genai": "Google Generative AI", - "aws": "AWS", - "ibm": "IBM", -} -# custom provider pages -CUSTOM_PROVIDER_PAGES = { - "azure-dynamic-sessions": "/docs/integrations/providers/microsoft/", - "prompty": "/docs/integrations/providers/microsoft/", - "sqlserver": "/docs/integrations/providers/microsoft/", - "google-community": "/docs/integrations/providers/google/", - "google-genai": "/docs/integrations/providers/google/", - "google-vertexai": "/docs/integrations/providers/google/", - "nvidia-ai-endpoints": "/docs/integrations/providers/nvidia/", - "exa": "/docs/integrations/providers/exa_search/", - "mongodb": "/docs/integrations/providers/mongodb_atlas/", - "sema4": "/docs/integrations/providers/robocorp/", - "postgres": "/docs/integrations/providers/pgvector/", + # integration packages that don't have a provider index + # do NOT add to these. These were merged before having a + # provider index was required + # can remove these once they have a provider index + "langchain-yt-dlp", } ##################### @@ -101,7 +53,7 @@ def _enrich_package(p: dict) -> dict | None: p["name_short"] = ( p["name"][10:] if p["name"].startswith("langchain-") else p["name"] ) - p["name_title"] = CUSTOM_NAME.get(p["name_short"]) or p[ + p["name_title"] = p.get("name_title") or p[ "name_short" ].title().replace("-", " ").replace("db", "DB").replace("Db", "DB").replace( "ai", "AI" @@ -111,8 +63,8 @@ def _enrich_package(p: dict) -> dict | None: if p["type"] == "ignore": return None - p["js_exists"] = p["name_short"] in JS_PACKAGES - custom_provider_page = CUSTOM_PROVIDER_PAGES.get(p["name_short"]) + p["js_exists"] = bool(p.get("js")) + custom_provider_page = p.get("provider_page") default_provider_page = f"/docs/integrations/providers/{p['name_short']}/" default_provider_page_exists = bool( glob.glob(str(DOCS_DIR / f"docs/integrations/providers/{p['name_short']}.*")) @@ -137,7 +89,7 @@ def _enrich_package(p: dict) -> dict | None: packages = [p for p in packages_n if p is not None] # sort by downloads -packages_sorted = [t[1] for t in sorted((p["downloads"], p) for p in packages)] +packages_sorted = sorted(packages, key=lambda p: p["downloads"], reverse=True) def package_row(p: dict) -> str: diff --git a/libs/packages.yml b/libs/packages.yml index ddb5b61900b4c..4c326d96eccbb 100644 --- a/libs/packages.yml +++ b/libs/packages.yml @@ -1,3 +1,6 @@ +# this file is used to definet he packages that are used in the project +# it is EXPERIMENTAL and may be removed in the future + packages: - downloads: 27728892 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' @@ -39,6 +42,7 @@ packages: name: langchain-anthropic path: libs/partners/anthropic repo: langchain-ai/langchain + js: '@langchain/anthropic' - downloads: 450092 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' name: langchain-chroma @@ -49,6 +53,8 @@ packages: name: langchain-exa path: libs/partners/exa repo: langchain-ai/langchain + js: '@langchain/exa' + provider_page: exa_search - downloads: 73179 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' name: langchain-fireworks @@ -59,6 +65,7 @@ packages: name: langchain-groq path: libs/partners/groq repo: langchain-ai/langchain + js: '@langchain/groq' - downloads: 375151 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' name: langchain-huggingface @@ -69,6 +76,7 @@ packages: name: langchain-ibm path: libs/ibm repo: langchain-ai/langchain-ibm + js: '@langchain/ibm' - downloads: 510 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' name: langchain-localai @@ -84,36 +92,44 @@ packages: name: langchain-mistralai path: libs/partners/mistralai repo: langchain-ai/langchain + js: '@langchain/mistralai' - downloads: 113328 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' name: langchain-mongodb path: libs/mongodb repo: langchain-ai/langchain-mongodb + js: '@langchain/mongodb' + provider_page: mongodb_atlas - downloads: 10175 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' name: langchain-nomic path: libs/partners/nomic repo: langchain-ai/langchain + js: '@langchain/nomic' - downloads: 7994138 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' name: langchain-openai path: libs/partners/openai repo: langchain-ai/langchain + js: '@langchain/openai' - downloads: 345657 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' name: langchain-pinecone path: libs/partners/pinecone repo: langchain-ai/langchain + js: '@langchain/pinecone' - downloads: 976 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' name: langchain-prompty path: libs/partners/prompty repo: langchain-ai/langchain + provider_page: microsoft - downloads: 77743 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' name: langchain-qdrant path: libs/partners/qdrant repo: langchain-ai/langchain + js: '@langchain/qdrant' - downloads: 907 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' name: langchain-scrapegraph @@ -124,6 +140,7 @@ packages: name: langchain-sema4 path: libs/sema4 repo: langchain-ai/langchain-sema4 + provider_page: robocorp - downloads: 44887 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' name: langchain-together @@ -142,8 +159,10 @@ packages: - downloads: 1507701 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' name: langchain-aws + name_title: AWS path: libs/aws repo: langchain-ai/langchain-aws + js: '@langchain/aws' - downloads: 64185 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' name: langchain-astradb @@ -152,28 +171,36 @@ packages: - downloads: 732265 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' name: langchain-google-genai + name_title: Google Generative AI path: libs/genai repo: langchain-ai/langchain-google + js: '@langchain/google-genai' + provider_page: google - downloads: 7668881 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' name: langchain-google-vertexai path: libs/vertexai repo: langchain-ai/langchain-google + js: '@langchain/google-vertexai' + provider_page: google - downloads: 3055901 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' name: langchain-google-community path: libs/community repo: langchain-ai/langchain-google + provider_page: google - downloads: 26639 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' name: langchain-weaviate path: libs/weaviate repo: langchain-ai/langchain-weaviate + js: '@langchain/weaviate' - downloads: 513053 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' name: langchain-cohere path: libs/cohere repo: langchain-ai/langchain-cohere + js: '@langchain/cohere' - downloads: 108874 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' name: langchain-elasticsearch @@ -184,16 +211,19 @@ packages: name: langchain-nvidia-ai-endpoints path: libs/ai-endpoints repo: langchain-ai/langchain-nvidia + provider_page: nvidia - downloads: 293866 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' name: langchain-postgres path: . repo: langchain-ai/langchain-postgres + provider_page: pgvector - downloads: 17549 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' name: langchain-redis path: libs/redis repo: langchain-ai/langchain-redis + js: '@langchain/redis' - downloads: 88721 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' name: langchain-unstructured @@ -204,11 +234,14 @@ packages: name: langchain-azure-dynamic-sessions path: libs/azure-dynamic-sessions repo: langchain-ai/langchain-azure + js: '@langchain/azure-dynamic-sessions' + provider_page: microsoft - downloads: 1489 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' name: langchain-sqlserver path: libs/sqlserver repo: langchain-ai/langchain-azure + provider_page: microsoft - downloads: 9426 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' name: langchain-cerebras @@ -227,6 +260,7 @@ packages: - downloads: 261091 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' name: langchain-ibm + name_title: IBM path: libs/ibm repo: langchain-ai/langchain-ibm - downloads: 347 @@ -239,6 +273,7 @@ packages: name: langchain-ollama path: libs/partners/ollama repo: langchain-ai/langchain + js: '@langchain/ollama' - downloads: 2749 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' name: langchain-box From 7c30cd6f41c3a6322d6a24382c10f4ab09410863 Mon Sep 17 00:00:00 2001 From: Erick Friis Date: Mon, 23 Dec 2024 15:40:34 -0500 Subject: [PATCH 4/6] x --- docs/scripts/packages_yml_get_downloads.py | 11 +- libs/packages.yml | 234 ++++++++++----------- 2 files changed, 123 insertions(+), 122 deletions(-) diff --git a/docs/scripts/packages_yml_get_downloads.py b/docs/scripts/packages_yml_get_downloads.py index 8ec2d578eef4b..6c7f97cb11ea0 100644 --- a/docs/scripts/packages_yml_get_downloads.py +++ b/docs/scripts/packages_yml_get_downloads.py @@ -23,8 +23,9 @@ def _get_downloads(p: dict) -> int: def _reorder_keys(p): keys = p.keys() key_order = [ - # "name", + "name", "name_title", + "path", "repo", "type", "provider_page", @@ -35,8 +36,14 @@ def _reorder_keys(p): if set(keys) - set(key_order): raise ValueError(f"Unexpected keys: {set(keys) - set(key_order)}") return CommentedMap((k, p[k]) for k in key_order if k in p) -data["packages"] = [CommentedMap(p) for p in data["packages"]] + +data["packages"] = [_reorder_keys(p) for p in data["packages"]] + +seen = set() for p in data["packages"]: + if p["name"] in seen: + raise ValueError(f"Duplicate package: {p['name']}") + seen.add(p["name"]) downloads_updated_at = datetime.fromisoformat(p["downloads_updated_at"]) if downloads_updated_at > yesterday: diff --git a/libs/packages.yml b/libs/packages.yml index 4c326d96eccbb..d381b0a385ca1 100644 --- a/libs/packages.yml +++ b/libs/packages.yml @@ -2,310 +2,304 @@ # it is EXPERIMENTAL and may be removed in the future packages: -- downloads: 27728892 - downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' - name: langchain-core +- name: langchain-core path: libs/core repo: langchain-ai/langchain -- downloads: 10343427 + downloads: 27728892 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' - name: langchain-text-splitters +- name: langchain-text-splitters path: libs/text-splitters repo: langchain-ai/langchain -- downloads: 27515102 + downloads: 10343427 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' - name: langchain +- name: langchain path: libs/langchain repo: langchain-ai/langchain -- downloads: 17505668 + downloads: 27515102 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' - name: langchain-community +- name: langchain-community path: libs/community repo: langchain-ai/langchain -- downloads: 1710421 + downloads: 17505668 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' - name: langchain-experimental +- name: langchain-experimental path: libs/experimental repo: langchain-ai/langchain-experimental -- downloads: 55505 + downloads: 1710421 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' - name: langchain-cli +- name: langchain-cli path: libs/cli repo: langchain-ai/langchain -- downloads: 3453 + downloads: 55505 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' - name: langchain-ai21 +- name: langchain-ai21 path: libs/ai21 repo: langchain-ai/langchain-ai21 -- downloads: 1163020 + downloads: 3453 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' - name: langchain-anthropic +- name: langchain-anthropic path: libs/partners/anthropic repo: langchain-ai/langchain js: '@langchain/anthropic' -- downloads: 450092 + downloads: 1163020 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' - name: langchain-chroma +- name: langchain-chroma path: libs/partners/chroma repo: langchain-ai/langchain -- downloads: 4560 + downloads: 450092 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' - name: langchain-exa +- name: langchain-exa path: libs/partners/exa repo: langchain-ai/langchain - js: '@langchain/exa' provider_page: exa_search -- downloads: 73179 + js: '@langchain/exa' + downloads: 4560 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' - name: langchain-fireworks +- name: langchain-fireworks path: libs/partners/fireworks repo: langchain-ai/langchain -- downloads: 370373 + downloads: 73179 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' - name: langchain-groq +- name: langchain-groq path: libs/partners/groq repo: langchain-ai/langchain js: '@langchain/groq' -- downloads: 375151 + downloads: 370373 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' - name: langchain-huggingface +- name: langchain-huggingface path: libs/partners/huggingface repo: langchain-ai/langchain -- downloads: 261091 + downloads: 375151 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' - name: langchain-ibm +- name: langchain-ibm path: libs/ibm repo: langchain-ai/langchain-ibm js: '@langchain/ibm' -- downloads: 510 + downloads: 261091 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' - name: langchain-localai +- name: langchain-localai path: libs/localai repo: mkhludnev/langchain-localai -- downloads: 111126 + downloads: 510 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' - name: langchain-milvus +- name: langchain-milvus path: libs/milvus repo: langchain-ai/langchain-milvus -- downloads: 232463 + downloads: 111126 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' - name: langchain-mistralai +- name: langchain-mistralai path: libs/partners/mistralai repo: langchain-ai/langchain js: '@langchain/mistralai' -- downloads: 113328 + downloads: 232463 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' - name: langchain-mongodb +- name: langchain-mongodb path: libs/mongodb repo: langchain-ai/langchain-mongodb - js: '@langchain/mongodb' provider_page: mongodb_atlas -- downloads: 10175 + js: '@langchain/mongodb' + downloads: 113328 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' - name: langchain-nomic +- name: langchain-nomic path: libs/partners/nomic repo: langchain-ai/langchain js: '@langchain/nomic' -- downloads: 7994138 + downloads: 10175 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' - name: langchain-openai +- name: langchain-openai path: libs/partners/openai repo: langchain-ai/langchain js: '@langchain/openai' -- downloads: 345657 + downloads: 7994138 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' - name: langchain-pinecone +- name: langchain-pinecone path: libs/partners/pinecone repo: langchain-ai/langchain js: '@langchain/pinecone' -- downloads: 976 + downloads: 345657 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' - name: langchain-prompty +- name: langchain-prompty path: libs/partners/prompty repo: langchain-ai/langchain provider_page: microsoft -- downloads: 77743 + downloads: 976 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' - name: langchain-qdrant +- name: langchain-qdrant path: libs/partners/qdrant repo: langchain-ai/langchain js: '@langchain/qdrant' -- downloads: 907 + downloads: 77743 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' - name: langchain-scrapegraph +- name: langchain-scrapegraph path: . repo: ScrapeGraphAI/langchain-scrapegraph -- downloads: 987 + downloads: 907 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' - name: langchain-sema4 +- name: langchain-sema4 path: libs/sema4 repo: langchain-ai/langchain-sema4 provider_page: robocorp -- downloads: 44887 + downloads: 987 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' - name: langchain-together +- name: langchain-together path: libs/together repo: langchain-ai/langchain-together -- downloads: 20951 + downloads: 44887 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' - name: langchain-upstage +- name: langchain-upstage path: libs/upstage repo: langchain-ai/langchain-upstage -- downloads: 11253 + downloads: 20951 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' - name: langchain-voyageai +- name: langchain-voyageai path: libs/partners/voyageai repo: langchain-ai/langchain -- downloads: 1507701 + downloads: 11253 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' - name: langchain-aws +- name: langchain-aws name_title: AWS path: libs/aws repo: langchain-ai/langchain-aws js: '@langchain/aws' -- downloads: 64185 + downloads: 1507701 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' - name: langchain-astradb +- name: langchain-astradb path: libs/astradb repo: langchain-ai/langchain-datastax -- downloads: 732265 + downloads: 64185 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' - name: langchain-google-genai +- name: langchain-google-genai name_title: Google Generative AI path: libs/genai repo: langchain-ai/langchain-google - js: '@langchain/google-genai' provider_page: google -- downloads: 7668881 + js: '@langchain/google-genai' + downloads: 732265 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' - name: langchain-google-vertexai +- name: langchain-google-vertexai path: libs/vertexai repo: langchain-ai/langchain-google - js: '@langchain/google-vertexai' provider_page: google -- downloads: 3055901 + js: '@langchain/google-vertexai' + downloads: 7668881 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' - name: langchain-google-community +- name: langchain-google-community path: libs/community repo: langchain-ai/langchain-google provider_page: google -- downloads: 26639 + downloads: 3055901 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' - name: langchain-weaviate +- name: langchain-weaviate path: libs/weaviate repo: langchain-ai/langchain-weaviate js: '@langchain/weaviate' -- downloads: 513053 + downloads: 26639 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' - name: langchain-cohere +- name: langchain-cohere path: libs/cohere repo: langchain-ai/langchain-cohere js: '@langchain/cohere' -- downloads: 108874 + downloads: 513053 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' - name: langchain-elasticsearch +- name: langchain-elasticsearch path: libs/elasticsearch repo: langchain-ai/langchain-elastic -- downloads: 129677 + downloads: 108874 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' - name: langchain-nvidia-ai-endpoints +- name: langchain-nvidia-ai-endpoints path: libs/ai-endpoints repo: langchain-ai/langchain-nvidia provider_page: nvidia -- downloads: 293866 + downloads: 129677 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' - name: langchain-postgres +- name: langchain-postgres path: . repo: langchain-ai/langchain-postgres provider_page: pgvector -- downloads: 17549 + downloads: 293866 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' - name: langchain-redis +- name: langchain-redis path: libs/redis repo: langchain-ai/langchain-redis js: '@langchain/redis' -- downloads: 88721 + downloads: 17549 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' - name: langchain-unstructured +- name: langchain-unstructured path: libs/unstructured repo: langchain-ai/langchain-unstructured -- downloads: 7285 + downloads: 88721 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' - name: langchain-azure-dynamic-sessions +- name: langchain-azure-dynamic-sessions path: libs/azure-dynamic-sessions repo: langchain-ai/langchain-azure - js: '@langchain/azure-dynamic-sessions' provider_page: microsoft -- downloads: 1489 + js: '@langchain/azure-dynamic-sessions' + downloads: 7285 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' - name: langchain-sqlserver +- name: langchain-sqlserver path: libs/sqlserver repo: langchain-ai/langchain-azure provider_page: microsoft -- downloads: 9426 + downloads: 1489 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' - name: langchain-cerebras +- name: langchain-cerebras path: libs/cerebras repo: langchain-ai/langchain-cerebras -- downloads: 2374 + downloads: 9426 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' - name: langchain-snowflake +- name: langchain-snowflake path: libs/snowflake repo: langchain-ai/langchain-snowflake -- downloads: 35495 + downloads: 2374 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' - name: langchain-databricks +- name: langchain-databricks path: libs/databricks repo: langchain-ai/langchain-databricks -- downloads: 261091 + downloads: 35495 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' - name: langchain-ibm - name_title: IBM - path: libs/ibm - repo: langchain-ai/langchain-ibm -- downloads: 347 - downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' - name: langchain-couchbase +- name: langchain-couchbase path: libs/partners/couchbase repo: langchain-ai/langchain -- downloads: 310741 + downloads: 347 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' - name: langchain-ollama +- name: langchain-ollama path: libs/partners/ollama repo: langchain-ai/langchain js: '@langchain/ollama' -- downloads: 2749 + downloads: 310741 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' - name: langchain-box +- name: langchain-box path: libs/box repo: langchain-ai/langchain-box -- downloads: 3691 + downloads: 2749 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' - name: langchain-tests +- name: langchain-tests path: libs/standard-tests repo: langchain-ai/langchain -- downloads: 8871 + downloads: 3691 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' - name: langchain-neo4j +- name: langchain-neo4j path: libs/neo4j repo: langchain-ai/langchain-neo4j -- downloads: 818 + downloads: 8871 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' - name: langchain-linkup +- name: langchain-linkup path: . repo: LinkupPlatform/langchain-linkup -- downloads: 776 + downloads: 818 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' - name: langchain-yt-dlp +- name: langchain-yt-dlp path: . repo: aqib0770/langchain-yt-dlp -- downloads: 322 + downloads: 776 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' - name: langchain-oceanbase +- name: langchain-oceanbase path: . repo: oceanbase/langchain-oceanbase -- downloads: 156 + downloads: 322 downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' - name: langchain-predictionguard +- name: langchain-predictionguard path: . repo: predictionguard/langchain-predictionguard + downloads: 156 + downloads_updated_at: '2024-12-23T20:10:11.816059+00:00' From 777c0e45b376d28e7bd9d333d7b0b5b202faa3d3 Mon Sep 17 00:00:00 2001 From: Erick Friis Date: Mon, 23 Dec 2024 15:40:54 -0500 Subject: [PATCH 5/6] x --- docs/scripts/packages_yml_get_downloads.py | 11 ++++++++--- docs/scripts/partner_pkg_table.py | 9 +++------ 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/docs/scripts/packages_yml_get_downloads.py b/docs/scripts/packages_yml_get_downloads.py index 6c7f97cb11ea0..e0f9d72268dd6 100644 --- a/docs/scripts/packages_yml_get_downloads.py +++ b/docs/scripts/packages_yml_get_downloads.py @@ -1,25 +1,29 @@ -import requests +from datetime import datetime, timedelta, timezone from pathlib import Path + +import requests from ruamel.yaml import YAML -from datetime import datetime, timezone, timedelta from ruamel.yaml.comments import CommentedMap yaml = YAML() PACKAGE_YML = Path(__file__).parents[2] / "libs" / "packages.yml" + def _get_downloads(p: dict) -> int: url = f"https://pypistats.org/api/packages/{p['name']}/recent?period=month" r = requests.get(url) r.raise_for_status() return r.json()["data"]["last_month"] + current_datetime = datetime.now(timezone.utc) yesterday = current_datetime - timedelta(days=1) with open(PACKAGE_YML) as f: data = yaml.load(f) + def _reorder_keys(p): keys = p.keys() key_order = [ @@ -37,6 +41,7 @@ def _reorder_keys(p): raise ValueError(f"Unexpected keys: {set(keys) - set(key_order)}") return CommentedMap((k, p[k]) for k in key_order if k in p) + data["packages"] = [_reorder_keys(p) for p in data["packages"]] seen = set() @@ -51,7 +56,7 @@ def _reorder_keys(p): continue p["downloads"] = _get_downloads(p) - p['downloads_updated_at'] = current_datetime.isoformat() + p["downloads_updated_at"] = current_datetime.isoformat() with open(PACKAGE_YML, "w") as f: yaml.dump(data, f) print(f"{p['name']}: {p['downloads']}") diff --git a/docs/scripts/partner_pkg_table.py b/docs/scripts/partner_pkg_table.py index 664ac0157c92a..04a605235ff78 100644 --- a/docs/scripts/partner_pkg_table.py +++ b/docs/scripts/partner_pkg_table.py @@ -19,7 +19,6 @@ "langchain-experimental", "langchain-cli", "langchain-tests", - # integration packages that don't have a provider index # do NOT add to these. These were merged before having a # provider index was required @@ -53,11 +52,9 @@ def _enrich_package(p: dict) -> dict | None: p["name_short"] = ( p["name"][10:] if p["name"].startswith("langchain-") else p["name"] ) - p["name_title"] = p.get("name_title") or p[ - "name_short" - ].title().replace("-", " ").replace("db", "DB").replace("Db", "DB").replace( - "ai", "AI" - ).replace("Ai", "AI") + p["name_title"] = p.get("name_title") or p["name_short"].title().replace( + "-", " " + ).replace("db", "DB").replace("Db", "DB").replace("ai", "AI").replace("Ai", "AI") p["type"] = _get_type(p) if p["type"] == "ignore": From fe1c02ff840d8753a69e67b2c0cf6514af5e5efc Mon Sep 17 00:00:00 2001 From: Erick Friis Date: Mon, 23 Dec 2024 15:53:45 -0500 Subject: [PATCH 6/6] x --- docs/scripts/packages_yml_get_downloads.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/scripts/packages_yml_get_downloads.py b/docs/scripts/packages_yml_get_downloads.py index 548f61894864b..07525194b39c5 100644 --- a/docs/scripts/packages_yml_get_downloads.py +++ b/docs/scripts/packages_yml_get_downloads.py @@ -50,7 +50,11 @@ def _reorder_keys(p): raise ValueError(f"Duplicate package: {p['name']}") seen.add(p["name"]) downloads_updated_at_str = p.get("downloads_updated_at") - downloads_updated_at = datetime.fromisoformat(downloads_updated_at_str) if downloads_updated_at_str else None + downloads_updated_at = ( + datetime.fromisoformat(downloads_updated_at_str) + if downloads_updated_at_str + else None + ) if downloads_updated_at is not None and downloads_updated_at > yesterday: print(f"done: {p['name']}: {p['downloads']}")