1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, matplotlib
5, numpy
6, openpyxl
7, pandas
8, pandas-stubs
9, plotly
10, pytest-mock
11, pytestCheckHook
12, pythonOlder
13, requests
14, scikit-learn
15, tenacity
16, tqdm
17, typing-extensions
18, wandb
19}:
20
21buildPythonPackage rec {
22 pname = "openai";
23 version = "0.25.0";
24 format = "setuptools";
25
26 disabled = pythonOlder "3.7.1";
27
28 src = fetchFromGitHub {
29 owner = "openai";
30 repo = "openai-python";
31 rev = "v${version}";
32 hash = "sha256-bwv7lpdDYlk+y3KBjv7cSvaGr3v02riNCUfPFh6yv1I=";
33 };
34
35 propagatedBuildInputs = [
36 numpy
37 openpyxl
38 pandas
39 pandas-stubs
40 requests
41 tqdm
42 typing-extensions
43 ];
44
45 passthru.optional-dependencies = {
46 wandb = [
47 wandb
48 ];
49 embeddings = [
50 matplotlib
51 plotly
52 scikit-learn
53 tenacity
54 ];
55 };
56
57 pythonImportsCheck = [
58 "openai"
59 ];
60
61 checkInputs = [
62 pytestCheckHook
63 pytest-mock
64 ];
65
66 pytestFlagsArray = [
67 "openai/tests"
68 ];
69
70 OPENAI_API_KEY = "sk-foo";
71
72 disabledTestPaths = [
73 # Requires a real API key
74 "openai/tests/test_endpoints.py"
75 # openai: command not found
76 "openai/tests/test_file_cli.py"
77 "openai/tests/test_long_examples_validator.py"
78 ];
79
80 meta = with lib; {
81 description = "Python client library for the OpenAI API";
82 homepage = "https://github.com/openai/openai-python";
83 license = licenses.mit;
84 maintainers = with maintainers; [ malo ];
85 };
86}