1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5
6 # build-system
7 pdm-backend,
8
9 # dependencies
10 langchain-core,
11 openai,
12
13 # tests
14 langchain-tests,
15 pytest-asyncio,
16 pytest-cov-stub,
17 pytest-mock,
18 pytestCheckHook,
19
20 # passthru
21 gitUpdater,
22}:
23
24buildPythonPackage rec {
25 pname = "langchain-perplexity";
26 version = "0.1.2";
27 pyproject = true;
28
29 src = fetchFromGitHub {
30 owner = "langchain-ai";
31 repo = "langchain";
32 tag = "langchain-perplexity==${version}";
33 hash = "sha256-4KYLyhGbG8Y8cDGffE4/8OM61eAKRFTgxKDKMTQExic=";
34 };
35
36 sourceRoot = "${src.name}/libs/partners/perplexity";
37
38 build-system = [ pdm-backend ];
39
40 dependencies = [
41 langchain-core
42 openai
43 ];
44
45 pythonRelaxDeps = [
46 # Each component release requests the exact latest core.
47 # That prevents us from updating individual components.
48 "langchain-core"
49 ];
50
51 nativeCheckInputs = [
52 langchain-tests
53 pytest-asyncio
54 pytest-cov-stub
55 pytest-mock
56 pytestCheckHook
57 ];
58
59 enabledTestPaths = [ "tests/unit_tests" ];
60
61 pythonImportsCheck = [ "langchain_perplexity" ];
62
63 passthru = {
64 # python updater script sets the wrong tag
65 skipBulkUpdate = true;
66 updateScript = gitUpdater {
67 rev-prefix = "langchain-perplexity==";
68 };
69 };
70
71 meta = {
72 changelog = "https://github.com/langchain-ai/langchain-perplexity/releases/tag/${src.tag}";
73 description = "Build LangChain applications with Perplexity";
74 homepage = "https://github.com/langchain-ai/langchain/tree/master/libs/partners/perplexity";
75 license = lib.licenses.mit;
76 maintainers = [
77 lib.maintainers.sarahec
78 ];
79 };
80}