about summary refs log tree commit diff
diff options
context:
space:
mode:
authorhappysalada <raphael@megzari.com>2023-09-10 11:46:53 -0400
committerhappysalada <raphael@megzari.com>2023-09-11 15:41:14 -0400
commite38bce9d300e6bbbf39e7574c27d533bbfdeb559 (patch)
tree7a8df0cb8aca27192c1d6b36427812ad8a50817a
parente66e868f4e877b185fdce573524f25f3272da67d (diff)
python310Packages.tokentrim: init at unstable-2023-09-07
python310Packages.tokentrim: disable tests
-rw-r--r--pkgs/development/python-modules/tokentrim/default.nix39
-rw-r--r--pkgs/top-level/python-packages.nix2
2 files changed, 41 insertions, 0 deletions
diff --git a/pkgs/development/python-modules/tokentrim/default.nix b/pkgs/development/python-modules/tokentrim/default.nix
new file mode 100644
index 0000000000000..c830d29b8a944
--- /dev/null
+++ b/pkgs/development/python-modules/tokentrim/default.nix
@@ -0,0 +1,39 @@
+{ lib
+, buildPythonPackage
+, fetchFromGitHub
+, poetry-core
+, tiktoken
+}:
+
+buildPythonPackage {
+  pname = "tokentrim";
+  version = "unstable-2023-09-07";
+  format = "pyproject";
+
+  src = fetchFromGitHub {
+    owner = "KillianLucas";
+    repo = "tokentrim";
+    rev = "e98ad3a2ca0e321a7347f76c30be584175495139";
+    hash = "sha256-95xitHnbFFaj0xPuLMWvIvuJzoCO3VSd592X1RI9h3A=";
+  };
+
+  nativeBuildInputs = [
+    poetry-core
+  ];
+
+  propagatedBuildInputs = [
+    tiktoken
+  ];
+
+  pythonImportsCheck = [ "tokentrim" ];
+
+  # tests connect to openai
+  doCheck = false;
+
+  meta = with lib; {
+    description = "Easily trim 'messages' arrays for use with GPTs";
+    homepage = "https://github.com/KillianLucas/tokentrim";
+    license = licenses.mit;
+    maintainers = with maintainers; [ happysalada ];
+  };
+}
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index ac2a3e6e0c382..16f519ae55ace 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -12933,6 +12933,8 @@ self: super: with self; {
 
   tokenlib = callPackage ../development/python-modules/tokenlib { };
 
+  tokentrim = callPackage ../development/python-modules/tokentrim { };
+
   tololib = callPackage ../development/python-modules/tololib { };
 
   toml = callPackage ../development/python-modules/toml { };