1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5
6 # build-system
7 poetry-core,
8
9 # dependencies
10 fastavro,
11 httpx,
12 httpx-sse,
13 pydantic,
14 pydantic-core,
15 requests,
16 tokenizers,
17 types-requests,
18 typing-extensions,
19}:
20
21buildPythonPackage rec {
22 pname = "cohere";
23 version = "5.18.0";
24 pyproject = true;
25
26 src = fetchFromGitHub {
27 owner = "cohere-ai";
28 repo = "cohere-python";
29 tag = version;
30 hash = "sha256-p0EQZ7C5z9qi62L3KESF/oQf/yWKtnG1fzCAoSatuVU=";
31 };
32
33 build-system = [ poetry-core ];
34
35 dependencies = [
36 fastavro
37 httpx
38 httpx-sse
39 pydantic
40 pydantic-core
41 requests
42 tokenizers
43 types-requests
44 typing-extensions
45 ];
46
47 pythonRelaxDeps = [ "httpx-sse" ];
48
49 # tests require CO_API_KEY
50 doCheck = false;
51
52 pythonImportsCheck = [ "cohere" ];
53
54 meta = {
55 description = "Simplify interfacing with the Cohere API";
56 homepage = "https://docs.cohere.com/docs";
57 changelog = "https://github.com/cohere-ai/cohere-python/releases/tag/${src.tag}";
58 license = lib.licenses.mit;
59 maintainers = with lib.maintainers; [ natsukium ];
60 };
61}