2024-04-04 23:28:36 +02:00
{
lib ,
buildPythonPackage ,
fetchFromGitHub ,
2025-02-15 02:00:18 +00:00
pythonOlder ,
2025-03-15 11:04:06 -07:00
nix-update-script ,
2024-09-06 12:09:33 +02:00
# build-system
2025-02-15 02:00:18 +00:00
pdm-backend ,
2024-09-06 12:09:33 +02:00
# buildInputs
bash ,
# dependencies
aiohttp ,
2025-02-15 02:00:18 +00:00
async-timeout ,
2024-04-04 23:28:36 +02:00
langchain-core ,
langchain-text-splitters ,
langsmith ,
2025-02-15 02:00:18 +00:00
numpy ,
2024-09-06 12:09:33 +02:00
pydantic ,
pyyaml ,
requests ,
sqlalchemy ,
tenacity ,
# tests
2025-04-28 12:31:05 -07:00
blockbuster ,
2024-09-06 12:09:33 +02:00
freezegun ,
2024-09-15 00:11:32 +02:00
httpx ,
2024-09-06 12:09:33 +02:00
lark ,
2024-04-04 23:28:36 +02:00
pandas ,
pytest-asyncio ,
pytest-mock ,
pytest-socket ,
pytestCheckHook ,
requests-mock ,
responses ,
syrupy ,
toml ,
2023-05-05 01:30:01 +09:00
} :
buildPythonPackage rec {
pname = " l a n g c h a i n " ;
2025-05-08 16:23:50 -07:00
version = " 0 . 3 . 2 5 " ;
2023-10-30 22:21:28 +09:00
pyproject = true ;
2023-05-05 01:30:01 +09:00
src = fetchFromGitHub {
2024-01-14 15:56:02 +09:00
owner = " l a n g c h a i n - a i " ;
2023-05-05 01:30:01 +09:00
repo = " l a n g c h a i n " ;
2025-01-03 21:24:13 +01:00
tag = " l a n g c h a i n = = ${ version } " ;
2025-05-08 16:23:50 -07:00
hash = " s h a 2 5 6 - B 2 K g 8 k C 6 Q l u 8 9 h Z V M h g q P U 3 2 B w F v g A t i 0 I I Y U d o s T 1 A = " ;
2023-05-05 01:30:01 +09:00
} ;
2023-08-11 23:39:00 +04:00
sourceRoot = " ${ src . name } / l i b s / l a n g c h a i n " ;
2023-07-23 21:49:04 +09:00
2025-02-15 02:00:18 +00:00
build-system = [ pdm-backend ] ;
2023-05-05 01:30:01 +09:00
2024-04-04 23:28:36 +02:00
buildInputs = [ bash ] ;
2023-05-05 01:30:01 +09:00
2024-12-24 17:28:46 +01:00
pythonRelaxDeps = [
2025-03-18 14:21:33 -07:00
# Each component release requests the exact latest core.
2025-06-02 15:54:57 +02:00
# That prevents us from updating individual components.
2025-03-18 14:21:33 -07:00
" l a n g c h a i n - c o r e "
2024-12-24 17:28:46 +01:00
" n u m p y "
" t e n a c i t y "
] ;
2024-10-26 04:03:42 +02:00
2024-04-04 23:27:23 +02:00
dependencies = [
2024-02-21 00:12:40 +01:00
aiohttp
langchain-core
2024-03-04 09:36:51 +01:00
langchain-text-splitters
2024-02-21 00:12:40 +01:00
langsmith
2025-02-15 02:00:18 +00:00
numpy
2023-08-07 22:50:53 +09:00
pydantic
pyyaml
2024-02-21 00:12:40 +01:00
requests
sqlalchemy
2024-01-14 15:56:02 +09:00
tenacity
2025-02-15 02:00:18 +00:00
] ++ lib . optional ( pythonOlder " 3 . 1 1 " ) async-timeout ;
2023-05-05 01:30:01 +09:00
2024-08-14 20:27:07 +00:00
optional-dependencies = {
numpy = [ numpy ] ;
} ;
2023-05-05 01:30:01 +09:00
nativeCheckInputs = [
2025-04-28 12:31:05 -07:00
blockbuster
2023-08-07 22:50:53 +09:00
freezegun
2024-09-15 00:11:32 +02:00
httpx
2023-11-11 15:32:30 +09:00
lark
2023-08-07 22:50:53 +09:00
pandas
pytest-asyncio
2023-05-05 01:30:01 +09:00
pytest-mock
2023-05-18 11:27:01 +09:00
pytest-socket
2023-08-07 22:50:53 +09:00
pytestCheckHook
2023-11-11 14:55:25 +09:00
requests-mock
2023-08-07 22:50:53 +09:00
responses
2023-06-16 10:12:35 +09:00
syrupy
2023-05-05 01:30:01 +09:00
toml
2023-11-11 15:32:30 +09:00
] ;
2023-05-05 01:30:01 +09:00
2023-05-12 12:29:19 +09:00
pytestFlagsArray = [
2024-04-04 23:27:23 +02:00
# integration_tests require network access, database access and require `OPENAI_API_KEY`, etc.
2023-05-14 17:05:37 +09:00
" t e s t s / u n i t _ t e s t s "
2023-11-11 15:32:30 +09:00
" - - o n l y - c o r e "
2023-05-12 12:29:19 +09:00
] ;
2023-05-05 01:30:01 +09:00
disabledTests = [
2024-04-04 23:27:23 +02:00
# These tests have database access
2023-05-05 01:30:01 +09:00
" t e s t _ t a b l e _ i n f o "
" t e s t _ s q l _ d a t a b a s e _ r u n "
2024-04-04 23:27:23 +02:00
# These tests have network access
2023-05-18 11:27:01 +09:00
" t e s t _ s o c k e t _ d i s a b l e d "
2024-04-04 23:27:23 +02:00
" t e s t _ o p e n a i _ a g e n t _ w i t h _ s t r e a m i n g "
" t e s t _ o p e n a i _ a g e n t _ t o o l s _ a g e n t "
# This test may require a specific version of langchain-community
2024-01-14 15:56:02 +09:00
" t e s t _ c o m p a t i b l e _ v e c t o r s t o r e _ d o c u m e n t a t i o n "
2024-04-04 23:27:23 +02:00
# AssertionErrors
" t e s t _ c a l l b a c k _ h a n d l e r s "
" t e s t _ g e n e r i c _ f a k e _ c h a t _ m o d e l "
2024-04-29 10:42:55 +02:00
# Test is outdated
" t e s t _ s e r i a l i z a b l e _ m a p p i n g "
2024-05-10 11:01:40 +02:00
" t e s t _ p e r s o n "
" t e s t _ a l i a s e s _ h i d d e n "
2023-05-05 01:30:01 +09:00
] ;
2024-12-24 17:28:46 +01:00
disabledTestPaths = [
# pydantic.errors.PydanticUserError: `ConversationSummaryMemory` is not fully defined; you should define `BaseCache`, then call `ConversationSummaryMemory.model_rebuild()`.
" t e s t s / u n i t _ t e s t s / c h a i n s / t e s t _ c o n v e r s a t i o n . p y "
# pydantic.errors.PydanticUserError: `ConversationSummaryMemory` is not fully defined; you should define `BaseCache`, then call `ConversationSummaryMemory.model_rebuild()`.
" t e s t s / u n i t _ t e s t s / c h a i n s / t e s t _ m e m o r y . p y "
# pydantic.errors.PydanticUserError: `ConversationSummaryBufferMemory` is not fully defined; you should define `BaseCache`, then call `ConversationSummaryBufferMemory.model_rebuild()`.
" t e s t s / u n i t _ t e s t s / c h a i n s / t e s t _ s u m m a r y _ b u f f e r _ m e m o r y . p y "
" t e s t s / u n i t _ t e s t s / o u t p u t _ p a r s e r s / t e s t _ f i x . p y "
" t e s t s / u n i t _ t e s t s / c h a i n s / t e s t _ l l m _ c h e c k e r . p y "
# TypeError: Can't instantiate abstract class RunnableSerializable[RetryOutputParserRetryChainInput, str] without an implementation for abstract method 'invoke'
" t e s t s / u n i t _ t e s t s / o u t p u t _ p a r s e r s / t e s t _ r e t r y . p y "
# pydantic.errors.PydanticUserError: `LLMSummarizationCheckerChain` is not fully defined; you should define `BaseCache`, then call `LLMSummarizationCheckerChain.model_rebuild()`.
" t e s t s / u n i t _ t e s t s / c h a i n s / t e s t _ l l m _ s u m m a r i z a t i o n _ c h e c k e r . p y "
] ;
2024-04-04 23:28:36 +02:00
pythonImportsCheck = [ " l a n g c h a i n " ] ;
2023-11-11 15:32:30 +09:00
2025-03-15 11:04:06 -07:00
passthru . updateScript = nix-update-script {
extraArgs = [
" - - v e r s i o n - r e g e x "
2025-04-28 12:31:05 -07:00
" l a n g c h a i n = = ( [ 0 - 9 . ] + ) "
2025-03-15 11:04:06 -07:00
] ;
2024-05-24 10:29:56 +09:00
} ;
2024-06-10 15:53:40 +02:00
meta = {
2023-05-05 01:30:01 +09:00
description = " B u i l d i n g a p p l i c a t i o n s w i t h L L M s t h r o u g h c o m p o s a b i l i t y " ;
2024-01-14 15:56:02 +09:00
homepage = " h t t p s : / / g i t h u b . c o m / l a n g c h a i n - a i / l a n g c h a i n " ;
changelog = " h t t p s : / / g i t h u b . c o m / l a n g c h a i n - a i / l a n g c h a i n / r e l e a s e s / t a g / v ${ version } " ;
2024-06-10 15:53:40 +02:00
license = lib . licenses . mit ;
2025-02-06 10:55:24 -08:00
maintainers = with lib . maintainers ; [
natsukium
sarahec
] ;
2024-04-04 23:27:23 +02:00
mainProgram = " l a n g c h a i n - s e r v e r " ;
2023-05-05 01:30:01 +09:00
} ;
}