-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat: ability to execute external providers #1672
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
Conversation
|
TODO: add doc instruction on how to write an external provider and configure a llama-stack instance of it. |
|
Would it make sense to use some manager for entrypoints like |
Never heard of it, I'll do some more exploration. Thanks! |
|
cc @raghotham let's consider this and allow folks to "bring your own providers to the Stack" |
ashwinb
left a comment
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.
See inline comment about where the extension point should be executed.
|
This seems like a good direction. I wonder if the YAML format for provider specs should be adopted for in-tree providers too, to avoid two separate code paths to define these. (python vs yaml) |
b5ae496 to
75c0e2a
Compare
5bae29d to
66a3618
Compare
booxter
left a comment
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.
It's fine. One thing that could be improved is de-duplicating the code for test provider. Basically, instead of copy pasting the implementation to another directory, we could prepare a tmpdir with the necessary files (most of them copied verbatim from the "real" ollama provider subtree). Otherwise, we'll have to patch the test provider every time we patch the "real" provider.)
Yes, I was trying to avoid that with symlinks first (but the package install would fail). Agree that the duplication is not ideal I can give this another try but would like to move fw with this too :) |
44a437e to
2c21686
Compare
@booxter no more dups! |
bd31424 to
761ccf7
Compare
47b8777 to
9b55a61
Compare
docs/source/providers/external.md
Outdated
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.
We want the dependencies of the config class to be minimal, it should not pick up dependencies of the implementation so lots of automation can work with typed configs without needing dependency bloat. At the very least, we can say this in the documentation here for now. Later, it might be a good idea to enforce it via a test.
ashwinb
left a comment
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.
amazing! thank you so much and many apologies for being AWOL. 🙏
I’ve noted your latest review comments, assuming they’re non-blocking, I’ll go ahead and merge this. I’ll follow up with a separate PR to address the minor nits. Thanks again! |
Providers that live outside of the llama-stack codebase are now
supported.
A new property `external_providers_dir` has been added to the main
config and can be configured as follow:
```
external_providers_dir: /etc/llama-stack/providers.d/
```
Where the expected structure is:
```
providers.d/
inference/
custom_ollama.yaml
vllm.yaml
vector_io/
qdrant.yaml
```
Where `custom_ollama.yaml` is:
```
adapter:
adapter_type: custom_ollama
pip_packages: ["ollama", "aiohttp"]
config_class: llama_stack_ollama_provider.config.OllamaImplConfig
module: llama_stack_ollama_provider
api_dependencies: []
optional_api_dependencies: []
```
Obviously the package must be installed on the system, here is the
`llama_stack_ollama_provider` example:
```
$ uv pip show llama-stack-ollama-provider
Using Python 3.10.16 environment at: /Users/leseb/Documents/AI/llama-stack/.venv
Name: llama-stack-ollama-provider
Version: 0.1.0
Location: /Users/leseb/Documents/AI/llama-stack/.venv/lib/python3.10/site-packages
Editable project location: /private/var/folders/mq/rnm5w_7s2d3fxmtkx02knvhm0000gn/T/tmp.ZBHU5Ezxg4/ollama/llama-stack-ollama-provider
Requires:
Required-by:
```
Signed-off-by: Sébastien Han <[email protected]>
|
Just gave it a final spin after a rebase, and it's all green! Merging now :) |
What does this PR do?
Providers that live outside of the llama-stack codebase are now
supported.
A new property
external_providers_dirhas been added to the mainconfig and can be configured as follow:
Where the expected structure is:
Where
custom_ollama.yamlis:Obviously the package must be installed on the system, here is the
llama_stack_ollama_providerexample:Closes: #658