File python-langchain.spec of Package python-langchain
#
# spec file for package python-langchain
#
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
# ignore the following submodules as the connectors are missing
%define skip_python313 1
%define versionexpr [0-9]*[0-9]
%{?sle15_python_module_pythons}
Name: python-langchain
Version: 0.2.16
Release: 0
Summary: Building applications with LLMs through composability
License: MIT
URL: https://github.com/langchain-ai/langchain
# upstream really made a bad decision to use == as seperator
Source: https://github.com/langchain-ai/langchain/archive/refs/tags/langchain==%{version}.tar.gz#/langchain-%{version}.tar.gz
BuildRequires: python-rpm-macros
BuildRequires: %{python_module pip}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module poetry}
BuildRequires: %{python_module poetry-core}
BuildRequires: %{python_module attrs}
BuildRequires: %{python_module rpds-py}
BuildRequires: %{python_module pycparser}
BuildRequires: %{python_module pipx}
BuildRequires: %{python_module PyYAML}
BuildRequires: ca-certificates
BuildRequires: fdupes
Requires: python-PyYAML >= 5.3
Requires: python-SQLAlchemy >= 1.4
Requires: python-aiohttp >= 3.8.3
Requires: python-async-timeout >= 4.0.0
Requires: python-dataclasses-json >= 0.5.7
Requires: python-jsonpatch >= 1.33
Requires: python-langchain-community >= 0.0.30
Requires: python-langchain-core >= %version
Requires: python-langchain-text_splitters >= 0.0.1
Requires: python-langsmith >= 0.1.17
Requires: python-numpy >= 1.0.0
Requires: python-pydantic >= 1
Requires: python-requests >= 2.0.0
Requires: python-tenacity >= 8.1.0
Suggests: python-aiosqlite >= 0.19.0
Suggests: python-atlassian-python-api >= 3.36.0
Suggests: python-azure-ai-formrecognizer >= 3.2.1
Suggests: python-azure-ai-textanalytics >= 5.3.0
Suggests: python-azure-core >= 1.26.4
Suggests: python-azure-cosmos >= 4.0.0
Suggests: python-azure-identity >= 1.12.0
Suggests: python-azure-search-documents 11.4.0
Suggests: python-beautifulsoup4 >= 4.0.0
Suggests: python-bibtexparser >= 1.4.0
Suggests: python-chardet >= 5.1.0
Suggests: python-feedparser >= 6.0.10
Suggests: python-geopandas >= 0.13.1
Suggests: python-GitPython >= 3.1.32
Suggests: python-html2text >= 2020.1.16
Suggests: python-jinja2 >= 3.0.0
Suggests: python-jsonschema > 1
Suggests: python-lxml >= 4.9.3
Suggests: python-msal >= 1.25.0
Suggests: python-numexpr >= 2.8.6
Suggests: python-openai < 2
Suggests: python-pandas >= 2.0.1
Suggests: python-pymupdf >= 1.22.3
Suggests: python-pypdf >= 3.4.0
Suggests: python-rapidfuzz >= 3.1.1
Suggests: python-rdflib 7.0.0
Suggests: python-requests-toolbelt >= 1.0.0
Suggests: python-scikit-learn >= 1.2.2
Suggests: python-sympy >= 1.12.0
Suggests: python-telethon >= 1.28.5
Suggests: python-tqdm >= 4.48.0
Suggests: python-typer >= 0.9.0
Suggests: python-xmltodict >= 0.13.0
BuildArch: noarch
%python_subpackages
%description
LangChain
Building applications with LLMs through composability
Large language models (LLMs) are emerging as a transformative technology, enabling developers to build applications that they previously could not. However, using these LLMs in isolation is often insufficient for creating a truly powerful app - the real power comes when you can combine them with other sources of computation or knowledge.
This library aims to assist in the development of those types of applications.
%package server
Summary: Langchain Server
Requires(post): update-alternatives
Requires(postun): update-alternatives
%description server
The Server for Langchain
%package cli
Summary: Langchain cli module
Requires: python-gitpython >= 3.1.40
Requires: python-langserve >= 0.0.51
Requires: python-tomlkit >= 0.12.2
Requires: python-typer >= 0.9.0
Requires: python-uvicorn >= 0.23.2
Requires(post): update-alternatives
Requires(postun): update-alternatives
%description cli
This package contains the langchain cli and cli support module.
%package community
Summary: Langchain community module
Requires: python-langchain-core = %{version}-%{release}
Requires: python-PyYAML >= 5.3
Requires: python-SQLAlchemy >= 1.4
Requires: python-aiohttp >= 3.8.3
Requires: python-dataclasses-json >= 0.5.7
Requires: python-langsmith >= 0.1.0
Requires: python-numpy >= 1.0.0
Requires: python-requests >= 2.0.0
Requires: python-tenacity >= 8.1.0
Suggests: python-aiosqlite >= 0.19.0
Suggests: python-atlassian-python-api >= 3.36.0
Suggests: python-beautifulsoup4 >= 4.0.0
Suggests: python-bibtexparser >= 1.4.0
Suggests: python-chardet >= 5.1.0
Suggests: python-cloudpickle >= 2.0.0
Suggests: python-elasticsearch >= 8.12.0
Suggests: python-feedparser >= 6.0.10
Suggests: python-geopandas >= 0.13.1
Suggests: python-gitpython >= 3.1.32
Suggests: python-html2text >= 2020.1.16
Suggests: python-httpx >= 0.24.1
Suggests: python-jinja2 >= 3.0.0
Suggests: python-jsonschema > 1
Suggests: python-lxml >= 4.9.3
Suggests: python-msal >= 1.25.0
Suggests: python-numexpr >= 2.8.6
Suggests: python-oci >= 2.119.1
Suggests: python-openai < 2
Suggests: python-pandas >= 2.0.1
Suggests: python-premai >= 0.3.25
Suggests: python-pyjwt >= 2.8.0
Suggests: python-pymupdf >= 1.22.3
Suggests: python-pypdf >= 3.4.0
Suggests: python-rapidfuzz >= 3.1.1
Suggests: python-rdflib 7.0.0
Suggests: python-requests-toolbelt >= 1.0.0
Suggests: python-scikit-learn >= 1.2.2
Suggests: python-sympy >= 1.12.0
Suggests: python-telethon >= 1.28.5
Suggests: python-tqdm >= 4.48.0
Suggests: python-typer >= 0.9.0
Suggests: python-xmltodict >= 0.13.0
%description community
This package contains the langchain community support module.
%package core
Summary: Langchain core module
Requires: python-PyYAML >= 5.3
Requires: python-jsonpatch >= 1.33
Requires: python-langsmith >= 0.1.0
Requires: python-packaging >= 23.2.0
Requires: python-pydantic >= 1
Requires: python-tenacity >= 8.1.0
Suggests: python-jinja2 >= 3.0.0
%description core
This package contains the langchain core support module.
%package experimental
Summary: Langchain experimental module
Requires: python-langchain-core = %{version}-%{release}
Requires: python-langchain = %{version}-%{release}
Requires: python-langchain >= 0.1.14
Suggests: python-faker >= 19.3.1
Suggests: python-jinja2 >= 3.0.0
Suggests: python-pandas >= 2.0.1
Suggests: python-tabulate >= 0.9.0
%description experimental
This package contains the langchain experimental support module.
%package text_splitters
Summary: Langchain text_splitters module
Requires: python-langchain-core = %{version}-%{release}
Requires: python-orjson
Suggests: python-beautifulsoup4 >= 4.12.3
Suggests: python-lxml >= 4.9.3
%description text_splitters
This package contains the langchain text_splitters support module.
%package unstructured
Summary: Langchain Unstructured module
Requires: python-langchain-core = %{version}-%{release}
%description unstructured
This package contains the langchain unstructured support module.
%package airbyte
Summary: Langchain airbyte module
Requires: python-langchain-core = %{version}-%{release}
Requires: python-airbyte >= 0.7.3
%description airbyte
This package contains the langchain airbyte support module.
%package anthropic
Summary: Langchain anthropic module
Requires: python-langchain-core = %{version}-%{release}
Requires: python-defusedxml >= 0.7.1
%description anthropic
This package contains the langchain anthropic support module.
%package exa
Summary: Langchain exa module
Requires: python-langchain-core = %{version}-%{release}
Requires: python-exa-py >= 1.0.8
%description exa
This package contains the langchain exa support module.
%package fireworks
Summary: Langchain fireworks module
Requires: python-langchain-core = %{version}-%{release}
Requires: python-aiohttp >= 3.9.1
Requires: python-openai >= 1.10.0
Requires: python-requests >= 2.0.0
%description fireworks
This package contains the langchain fireworks support module.
%package groq
Summary: Langchain groq module
Requires: python-langchain-core = %{version}-%{release}
Requires: python-groq >= 0.4.1
%description groq
This package contains the langchain groq support module.
%package mistralai
Summary: Langchain mistralai module
Requires: python-langchain-core = %{version}-%{release}
Requires: python-httpx >= 0.25.2
Requires: python-tokenizers >= 0.15.1
%description mistralai
This package contains the langchain mistralai support module.
%package mongodb
Summary: Langchain mongodb module
Requires: python-langchain-core = %{version}-%{release}
Requires: python-numpy >= 1.0.0
Requires: python-pymongo >= 4.6.1
%description mongodb
This package contains the langchain mongodb support module.
%package nomic
Summary: Langchain nomic module
Requires: python-langchain-core = %{version}-%{release}
Requires: python-nomic >= 3.0.12
%description nomic
This package contains the langchain nomic support module.
%package ollama
Summary: Langchain Ollama module
Requires: python-langchain-core = %{version}-%{release}
Requires: python-ollama >= 0.3.0
%description ollama
This package contains the langchain Ollama support module.
%package openai
Summary: Langchain openai module
Requires: python-langchain-core = %{version}-%{release}
Requires: python-openai >= 1.10.0
%description openai
This package contains the langchain openai support module.
%package pinecone
Summary: Langchain pinecone module
Requires: python-langchain-core = %{version}-%{release}
Requires: python-numpy >= 1.0.0
Requires: python-pinecone-client >= 3.2.2
%description pinecone
This package contains the langchain pinecone support module.
%package robocorp
Summary: Langchain robocorp module
Requires: python-langchain-core = %{version}-%{release}
Requires: python-requests >= 2.31.0
Requires: python-types-requests >= 2.0.0
%description robocorp
This package contains the langchain robocorp support module.
%package voyageai
Summary: Langchain voyageai module
Requires: python-langchain-core = %{version}-%{release}
%description voyageai
This package contains the langchain voyageai support module.
%package standard_tests
Summary: Langchain standard_tests module
Requires: python-langchain-core = %{version}-%{release}
%description standard_tests
This package contains the langchain standard_tests support module.
%package qdrant
Summary: Langchain qdrant module
Requires: python-langchain-core = %{version}-%{release}
%description qdrant
This package contains the langchain qdrant support module.
%package prompty
Summary: Langchain prompty module
Requires: python-langchain-core = %{version}-%{release}
%description prompty
This package contains the langchain prompty support module.
%package huggingface
Summary: Langchain huggingface module
Requires: python-langchain-core = %{version}-%{release}
%description huggingface
This package contains the langchain huggingface support module.
%package chroma
Summary: Langchain chroma module
Requires: python-langchain-core = %{version}-%{release}
%description chroma
This package contains the langchain chroma support module.
%package azure_dynamic_sessions
Summary: Langchain azure_dynamic_sessions module
Requires: python-langchain-core = %{version}-%{release}
%description azure_dynamic_sessions
This package contains the langchain azure_dynamic_session support module.
%package box
Summary: Langchain Box module
Requires: python-langchain-core = %{version}-%{release}
%description box
This package contains the langchain Box support module.
%package couchbase
Summary: Langchain Couchbase module
Requires: python-langchain-core = %{version}-%{release}
%description couchbase
This package contains the langchain Couchbase support module.
%package milvus
Summary: Langchain Milvus module
Requires: python-langchain-core = %{version}-%{release}
%description milvus
This package contains the langchain Milvus support module.
%prep
# tag was langchain==version and expanding to langchain-langchain
%autosetup -n langchain-langchain-%{version}
# Remove the python 3.12.4 version cap so it will build on Tumbleweed.
# The python version cap is artificial and have no functional impact
# as far as we can tell.
sed -E -i 's/^(python = .*),<3\.12\..*/\1"/' libs/partners/airbyte/pyproject.toml
%build
export regignored='^.*?\b(groq|mistralai)\b'
for mod in libs/* libs/partners/*; do
[[ "$mod" =~ $regignored ]] && continue
modname=$(basename $mod|tr - _)
if test -e $mod/pyproject.toml; then
%pyproject_wheel $mod
fi
done
%install
export regignored='^.*?\b(groq|mistralai)\b'
for mod in libs/* libs/partners/*; do
[[ "$mod" =~ $regignored ]] && continue
modname=$(basename $mod|tr - _)
if test -e $mod/pyproject.toml; then
%pyproject_install --no-build-isolation $mod
path=$modname
if test "$path" != "langchain"; then
path=langchain_$modname
fi
fi
done
# These are the same but a symlink creates file conflicts
%python_clone -a %{buildroot}/%{_bindir}/langchain
%python_clone -a %{buildroot}/%{_bindir}/langchain-cli
%python_clone -a %{buildroot}/%{_bindir}/langchain-server
find %{buildroot} -name .gitignore -delete
for mod in libs/* libs/partners/*; do
[[ "$mod" =~ $regignored ]] && continue
modname=$(basename $mod|tr - _)
if test -e $mod/pyproject.toml; then
path=$modname
if test "$path" != "langchain"; then
path=langchain_$modname
fi
%python_expand %fdupes %{buildroot}/%{$python_sitelib}/$path
fi
done
%check
%files %{python_files}
%{python_sitelib}/langchain
%{python_sitelib}/langchain-%{versionexpr}.dist-info
%files %{python_files server}
%python_alternative %{_bindir}/langchain-server
%files %{python_files cli}
%{python_sitelib}/langchain_cli
%{python_sitelib}/langchain_cli-%{versionexpr}.dist-info
%python_alternative %{_bindir}/langchain
%python_alternative %{_bindir}/langchain-cli
%files %{python_files community}
%{python_sitelib}/langchain_community
%{python_sitelib}/langchain_community-%{versionexpr}.dist-info
%files %{python_files core}
%{python_sitelib}/langchain_core
%{python_sitelib}/langchain_core-%{versionexpr}.dist-info
%files %{python_files experimental}
%{python_sitelib}/langchain_experimental
%{python_sitelib}/langchain_experimental-%{versionexpr}.dist-info
%files %{python_files text_splitters}
%{python_sitelib}/langchain_text_splitters
%{python_sitelib}/langchain_text_splitters-%{versionexpr}.dist-info
%files %{python_files airbyte}
%{python_sitelib}/langchain_airbyte
%{python_sitelib}/langchain_airbyte-%{versionexpr}.dist-info
%files %{python_files anthropic}
%{python_sitelib}/langchain_anthropic
%{python_sitelib}/langchain_anthropic-%{versionexpr}.dist-info
%files %{python_files exa}
%{python_sitelib}/langchain_exa
%{python_sitelib}/langchain_exa-%{versionexpr}.dist-info
%files %{python_files fireworks}
%{python_sitelib}/langchain_fireworks
%{python_sitelib}/langchain_fireworks-%{versionexpr}.dist-info
%files %{python_files mongodb}
%{python_sitelib}/langchain_mongodb
%{python_sitelib}/langchain_mongodb-%{versionexpr}.dist-info
%files %{python_files nomic}
%{python_sitelib}/langchain_nomic
%{python_sitelib}/langchain_nomic-%{versionexpr}.dist-info
%files %{python_files ollama}
%{python_sitelib}/langchain_ollama
%{python_sitelib}/langchain_ollama-%{versionexpr}.dist-info
%files %{python_files openai}
%{python_sitelib}/langchain_openai
%{python_sitelib}/langchain_openai-%{versionexpr}.dist-info
%files %{python_files pinecone}
%{python_sitelib}/langchain_pinecone
%{python_sitelib}/langchain_pinecone-%{versionexpr}.dist-info
%files %{python_files robocorp}
%{python_sitelib}/langchain_robocorp
%{python_sitelib}/langchain_robocorp-%{versionexpr}.dist-info
%files %{python_files voyageai}
%{python_sitelib}/langchain_voyageai
%{python_sitelib}/langchain_voyageai-%{versionexpr}.dist-info
%files %{python_files standard_tests}
%{python_sitelib}/langchain_standard_tests
%{python_sitelib}/langchain_standard_tests-%{versionexpr}.dist-info
%files %{python_files qdrant}
%{python_sitelib}/langchain_qdrant
%{python_sitelib}/langchain_qdrant-%{versionexpr}.dist-info
%files %{python_files prompty}
%{python_sitelib}/langchain_prompty
%{python_sitelib}/langchain_prompty-%{versionexpr}.dist-info
%files %{python_files huggingface}
%{python_sitelib}/langchain_huggingface
%{python_sitelib}/langchain_huggingface-%{versionexpr}.dist-info
%files %{python_files milvus}
%{python_sitelib}/langchain_milvus
%{python_sitelib}/langchain_milvus-%{versionexpr}.dist-info
%files %{python_files chroma}
%{python_sitelib}/langchain_chroma
%{python_sitelib}/langchain_chroma-%{versionexpr}.dist-info
%files %{python_files azure_dynamic_sessions}
%{python_sitelib}/langchain_azure_dynamic_sessions
%{python_sitelib}/langchain_azure_dynamic_sessions-%{versionexpr}.dist-info
%files %{python_files box}
%{python_sitelib}/langchain_box
%{python_sitelib}/langchain_box-%{versionexpr}.dist-info
%files %{python_files couchbase}
%{python_sitelib}/langchain_couchbase
%{python_sitelib}/langchain_couchbase-%{versionexpr}.dist-info
%files %{python_files unstructured}
%{python_sitelib}/langchain_unstructured
%{python_sitelib}/langchain_unstructured-%{versionexpr}.dist-info
%post cli
%{python_install_alternative langchain langchain-cli}
%postun cli
%{python_uninstall_alternative langchain}
%post server
%{python_install_alternative langchain-server}
%postun server
%{python_uninstall_alternative langchain-server}
%changelog