1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, poetry-core
5, tiktoken
6}:
7
8buildPythonPackage {
9 pname = "tokentrim";
10 version = "unstable-2023-09-07";
11 format = "pyproject";
12
13 src = fetchFromGitHub {
14 owner = "KillianLucas";
15 repo = "tokentrim";
16 rev = "e98ad3a2ca0e321a7347f76c30be584175495139";
17 hash = "sha256-95xitHnbFFaj0xPuLMWvIvuJzoCO3VSd592X1RI9h3A=";
18 };
19
20 nativeBuildInputs = [
21 poetry-core
22 ];
23
24 propagatedBuildInputs = [
25 tiktoken
26 ];
27
28 pythonImportsCheck = [ "tokentrim" ];
29
30 # tests connect to openai
31 doCheck = false;
32
33 meta = with lib; {
34 description = "Easily trim 'messages' arrays for use with GPTs";
35 homepage = "https://github.com/KillianLucas/tokentrim";
36 license = licenses.mit;
37 maintainers = with maintainers; [ happysalada ];
38 };
39}