about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/litellm/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/python-modules/litellm/default.nix')
-rw-r--r--nixpkgs/pkgs/development/python-modules/litellm/default.nix53
1 files changed, 53 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/python-modules/litellm/default.nix b/nixpkgs/pkgs/development/python-modules/litellm/default.nix
new file mode 100644
index 000000000000..1e75776f0c32
--- /dev/null
+++ b/nixpkgs/pkgs/development/python-modules/litellm/default.nix
@@ -0,0 +1,53 @@
+{ lib
+, buildPythonPackage
+, fetchFromGitHub
+, poetry-core
+, importlib-metadata
+, openai
+, python-dotenv
+, tiktoken
+}:
+let
+  version = "0.1.590";
+in
+buildPythonPackage rec {
+  pname = "litellm";
+  format = "pyproject";
+  inherit version;
+
+  src = fetchFromGitHub {
+    owner = "BerriAI";
+    repo = "litellm";
+    rev = "7cb96e86b4753008cbf8d116aca514750e98d360";
+    hash = "sha256-ITMcwGjelNfNGnfBmmdu0Xwph4u0mxiFSfHnysUxWCQ=";
+  };
+
+  postPatch = ''
+    rm -rf dist
+  '';
+
+  nativeBuildInputs = [
+    poetry-core
+  ];
+
+  propagatedBuildInputs = [
+    importlib-metadata
+    openai
+    python-dotenv
+    tiktoken
+  ];
+
+  # the import check phase fails trying to do a network request to openai
+  # pythonImportsCheck = [ "litellm" ];
+
+  # no tests
+  doCheck = false;
+
+  meta = with lib; {
+    description = "Use any LLM as a drop in replacement for gpt-3.5-turbo. Use Azure, OpenAI, Cohere, Anthropic, Ollama, VLLM, Sagemaker, HuggingFace, Replicate (100+ LLMs)";
+    homepage = "https://github.com/BerriAI/litellm";
+    license = licenses.mit;
+    changelog = "https://github.com/BerriAI/litellm/releases/tag/v${version}";
+    maintainers = with maintainers; [ happysalada ];
+  };
+}