2021-12-24 04:21:11 +00:00
|
|
|
{ lib
|
|
|
|
, buildPythonPackage
|
|
|
|
, fetchFromGitHub
|
2023-02-02 18:25:31 +00:00
|
|
|
, aiohttp
|
2022-10-21 18:38:19 +00:00
|
|
|
, matplotlib
|
2022-08-12 12:06:08 +00:00
|
|
|
, numpy
|
2021-12-24 04:21:11 +00:00
|
|
|
, openpyxl
|
|
|
|
, pandas
|
|
|
|
, pandas-stubs
|
2022-10-21 18:38:19 +00:00
|
|
|
, plotly
|
2023-02-02 18:25:31 +00:00
|
|
|
, pytest-asyncio
|
2022-10-21 18:38:19 +00:00
|
|
|
, pytest-mock
|
|
|
|
, pytestCheckHook
|
|
|
|
, pythonOlder
|
2021-12-24 04:21:11 +00:00
|
|
|
, requests
|
2022-08-12 12:06:08 +00:00
|
|
|
, scikit-learn
|
|
|
|
, tenacity
|
2021-12-24 04:21:11 +00:00
|
|
|
, tqdm
|
2022-10-21 18:38:19 +00:00
|
|
|
, typing-extensions
|
2022-04-15 01:41:22 +00:00
|
|
|
, wandb
|
2023-02-02 18:25:31 +00:00
|
|
|
, withOptionalDependencies ? false
|
2021-12-24 04:21:11 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "openai";
|
2023-07-15 17:15:38 +00:00
|
|
|
version = "0.27.8";
|
2022-10-21 18:38:19 +00:00
|
|
|
format = "setuptools";
|
2021-12-24 04:21:11 +00:00
|
|
|
|
|
|
|
disabled = pythonOlder "3.7.1";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "openai";
|
|
|
|
repo = "openai-python";
|
2023-03-04 12:14:45 +00:00
|
|
|
rev = "refs/tags/v${version}";
|
2023-07-15 17:15:38 +00:00
|
|
|
hash = "sha256-7D7oi3NCqq0QSW66MqYMmc9ga02T5G4xFVic4PjgFRA=";
|
2021-12-24 04:21:11 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
2023-02-02 18:25:31 +00:00
|
|
|
aiohttp
|
2021-12-24 04:21:11 +00:00
|
|
|
requests
|
|
|
|
tqdm
|
2023-02-02 18:25:31 +00:00
|
|
|
] ++ lib.optionals (pythonOlder "3.8") [
|
2022-10-21 18:38:19 +00:00
|
|
|
typing-extensions
|
2023-02-02 18:25:31 +00:00
|
|
|
] ++ lib.optionals withOptionalDependencies (builtins.attrValues {
|
|
|
|
inherit (passthru.optional-dependencies) embeddings wandb;
|
|
|
|
});
|
2022-10-21 18:38:19 +00:00
|
|
|
|
|
|
|
passthru.optional-dependencies = {
|
2023-02-02 18:25:31 +00:00
|
|
|
datalib = [
|
|
|
|
numpy
|
|
|
|
openpyxl
|
|
|
|
pandas
|
|
|
|
pandas-stubs
|
2022-10-21 18:38:19 +00:00
|
|
|
];
|
|
|
|
embeddings = [
|
|
|
|
matplotlib
|
|
|
|
plotly
|
|
|
|
scikit-learn
|
|
|
|
tenacity
|
2023-02-02 18:25:31 +00:00
|
|
|
] ++ passthru.optional-dependencies.datalib;
|
|
|
|
wandb = [
|
|
|
|
wandb
|
|
|
|
] ++ passthru.optional-dependencies.datalib;
|
2022-10-21 18:38:19 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
pythonImportsCheck = [
|
|
|
|
"openai"
|
|
|
|
];
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [
|
2022-10-21 18:38:19 +00:00
|
|
|
pytestCheckHook
|
2023-02-02 18:25:31 +00:00
|
|
|
pytest-asyncio
|
2022-10-21 18:38:19 +00:00
|
|
|
pytest-mock
|
|
|
|
];
|
|
|
|
|
|
|
|
pytestFlagsArray = [
|
|
|
|
"openai/tests"
|
2021-12-24 04:21:11 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
OPENAI_API_KEY = "sk-foo";
|
2022-10-21 18:38:19 +00:00
|
|
|
|
2021-12-24 04:21:11 +00:00
|
|
|
disabledTestPaths = [
|
2022-10-21 18:38:19 +00:00
|
|
|
# Requires a real API key
|
|
|
|
"openai/tests/test_endpoints.py"
|
2023-02-02 18:25:31 +00:00
|
|
|
"openai/tests/asyncio/test_endpoints.py"
|
2022-10-30 15:09:59 +00:00
|
|
|
# openai: command not found
|
2021-12-24 04:21:11 +00:00
|
|
|
"openai/tests/test_file_cli.py"
|
2022-10-30 15:09:59 +00:00
|
|
|
"openai/tests/test_long_examples_validator.py"
|
2021-12-24 04:21:11 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Python client library for the OpenAI API";
|
|
|
|
homepage = "https://github.com/openai/openai-python";
|
2023-03-04 12:14:45 +00:00
|
|
|
changelog = "https://github.com/openai/openai-python/releases/tag/v${version}";
|
2021-12-24 04:21:11 +00:00
|
|
|
license = licenses.mit;
|
2022-10-21 18:38:19 +00:00
|
|
|
maintainers = with maintainers; [ malo ];
|
2021-12-24 04:21:11 +00:00
|
|
|
};
|
|
|
|
}
|