1{ lib
2, buildPythonPackage
3, fetchpatch
4, fetchPypi
5, poetry-core
6, pythonOlder
7, aiohttp
8, backoff
9, fastavro
10, importlib-metadata
11, requests
12, urllib3
13}:
14
15buildPythonPackage rec {
16 pname = "cohere";
17 version = "4.32";
18 format = "pyproject";
19
20 disabled = pythonOlder "3.7";
21
22 src = fetchPypi {
23 inherit pname version;
24 hash = "sha256-OAd0e+mE8hHc6RHBM1vXE68qwrcPcpZ4OB5v9uRQ5oE=";
25 };
26
27 patches = [
28 # https://github.com/cohere-ai/cohere-python/pull/289
29 (fetchpatch {
30 name = "replace-poetry-with-poetry-core.patch";
31 url = "https://github.com/cohere-ai/cohere-python/commit/e86480336331c0cf6f67e26b0825467dfca5b277.patch";
32 hash = "sha256-P1Ioq5ypzT3tx6cxrI3ep34Fi4cUx88YkfJ5ErN3VHk=";
33 })
34 ];
35
36 nativeBuildInputs = [
37 poetry-core
38 ];
39
40 propagatedBuildInputs = [
41 aiohttp
42 backoff
43 fastavro
44 importlib-metadata
45 requests
46 urllib3
47 ];
48
49 # tests require CO_API_KEY
50 doCheck = false;
51
52 pythonImportsCheck = [
53 "cohere"
54 ];
55
56 meta = with lib; {
57 description = "Simplify interfacing with the Cohere API";
58 homepage = "https://docs.cohere.com/docs";
59 changelog = "https://github.com/cohere-ai/cohere-python/blob/main/CHANGELOG.md#${builtins.replaceStrings ["."] [""] version}";
60 license = licenses.mit;
61 maintainers = with maintainers; [ natsukium ];
62 };
63}