2023-10-09 19:29:22 +00:00
|
|
|
{ lib
|
|
|
|
, buildPythonPackage
|
|
|
|
, fetchFromGitHub
|
|
|
|
, poetry-core
|
|
|
|
, importlib-metadata
|
|
|
|
, openai
|
|
|
|
, python-dotenv
|
|
|
|
, tiktoken
|
2024-01-02 11:29:13 +00:00
|
|
|
, tokenizers
|
|
|
|
, click
|
|
|
|
, jinja2
|
|
|
|
, certifi
|
|
|
|
, appdirs
|
|
|
|
, aiohttp
|
|
|
|
, httpx
|
2023-10-09 19:29:22 +00:00
|
|
|
}:
|
|
|
|
let
|
2024-01-25 14:12:00 +00:00
|
|
|
version = "1.18.3";
|
2023-10-09 19:29:22 +00:00
|
|
|
in
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "litellm";
|
|
|
|
format = "pyproject";
|
|
|
|
inherit version;
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "BerriAI";
|
|
|
|
repo = "litellm";
|
2023-10-19 13:55:26 +00:00
|
|
|
rev = "refs/tags/v${version}";
|
2024-01-25 14:12:00 +00:00
|
|
|
hash = "sha256-V4OTEZMyhXDcva7k88uTVH6vJ1EsF549ZmqUqXETsB0=";
|
2023-10-09 19:29:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
rm -rf dist
|
|
|
|
'';
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
poetry-core
|
|
|
|
];
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
openai
|
|
|
|
python-dotenv
|
|
|
|
tiktoken
|
2024-01-02 11:29:13 +00:00
|
|
|
importlib-metadata
|
|
|
|
tokenizers
|
|
|
|
click
|
|
|
|
jinja2
|
|
|
|
certifi
|
|
|
|
appdirs
|
|
|
|
aiohttp
|
2023-10-09 19:29:22 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
# 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 ];
|
|
|
|
};
|
|
|
|
}
|