1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, poetry-core
5, importlib-metadata
6, openai
7, python-dotenv
8, tiktoken
9}:
10let
11 version = "0.11.1";
12in
13buildPythonPackage rec {
14 pname = "litellm";
15 format = "pyproject";
16 inherit version;
17
18 src = fetchFromGitHub {
19 owner = "BerriAI";
20 repo = "litellm";
21 rev = "refs/tags/v${version}";
22 hash = "sha256-5Zk1lc7G0dU/AoLE5V+p30wE/gRfYRPsVS3sNgwWzCU=";
23 };
24
25 postPatch = ''
26 rm -rf dist
27 '';
28
29 nativeBuildInputs = [
30 poetry-core
31 ];
32
33 propagatedBuildInputs = [
34 importlib-metadata
35 openai
36 python-dotenv
37 tiktoken
38 ];
39
40 # the import check phase fails trying to do a network request to openai
41 # pythonImportsCheck = [ "litellm" ];
42
43 # no tests
44 doCheck = false;
45
46 meta = with lib; {
47 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)";
48 homepage = "https://github.com/BerriAI/litellm";
49 license = licenses.mit;
50 changelog = "https://github.com/BerriAI/litellm/releases/tag/v${version}";
51 maintainers = with maintainers; [ happysalada ];
52 };
53}