-
Notifications
You must be signed in to change notification settings - Fork 10.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add flake app to run openai proxy #4612
base: master
Are you sure you want to change the base?
Add flake app to run openai proxy #4612
Conversation
Works with: nix run .#llama-server-openai-proxy If merged, then you can run both the server and proxy via two commands: nix run github:ggerganov/llama.cpp#llama-server nix run github:ggerganov/llama.cpp#llama-server-openai-proxy
program = "${ | ||
(let pythonWithPkgs = pkgs.python3.withPackages (ps: with ps; [ flask requests ]); | ||
in pkgs.writeShellScriptBin "run-openai-proxy" '' | ||
${pythonWithPkgs}/bin/python3 ${self}/examples/server/api_like_OAI.py |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could've been a makeWrapper
. I don't know if api_like_OAI.py
takes any command line arguments, but makeWrapper
would have passed those on
(let pythonWithPkgs = pkgs.python3.withPackages (ps: with ps; [ flask requests ]); | ||
in pkgs.writeShellScriptBin "run-openai-proxy" '' | ||
${pythonWithPkgs}/bin/python3 ${self}/examples/server/api_like_OAI.py | ||
'') | ||
}/bin/run-openai-proxy"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't suggest anything concrete right now, but it might be a good thing to do some form of buildPythonApplication
because its probably less affected by PYTHONPATH contamination.
@@ -110,6 +110,15 @@ | |||
type = "app"; | |||
program = "${self.packages.${system}.default}/bin/llama-server"; | |||
}; | |||
apps.llama-server-openai-proxy = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was going to mention this in #4605, but we wouldn't have had to manually wrap these in apps
if we instead exposed them (in the overlay and) in packages/legacyPackages, and if we ensured that meta.mainProgram
s are set correctly (with writeShellScriptBin
they are)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could now add this to scope.nix
:
llama.cpp/.devops/nix/scope.nix
Lines 7 to 12 in 4e1d251
lib.makeScope newScope ( | |
self: { | |
inherit llamaVersion; | |
llama-cpp = self.callPackage ./package.nix { }; | |
} | |
) |
This way the attribute would show up as llamaPackages.llama-server-openai-proxy
in nixpkgs with the flake's overlays.default
applied, as well as in the flake's legacyPackages.${system}.llamaPackages
.
I think this might not be needed since the default |
Yes, I'm thinking we should probably deprecate |
Works with:
nix run .#llama-server-openai-proxy
If merged, then you can run both the server and proxy via two commands:
nix run github:ggerganov/llama.cpp#llama-server
nix run github:ggerganov/llama.cpp#llama-server-openai-proxy
Note: This is likely not ideal or the best way to do this, but it works and can hopefully spark useful discussion to get this feature into the llama.cpp flake 😃