Skip to content

Conversation

cdoern
Copy link
Contributor

@cdoern cdoern commented Mar 3, 2025

What does this PR do?

Introduce an RFC for a Provider Configuration API, allowing for provider configuration changes of an existing stack to aid in common runtime changes like model swapping, endpoint switching, etc

Closes #993

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Meta Open Source bot. label Mar 3, 2025
@cdoern cdoern changed the title RFC: Configuration API feat: Introduce RFC for Configuration API Mar 3, 2025
@cdoern cdoern force-pushed the config-proposal branch 2 times, most recently from 9b1a1e3 to 5d337fb Compare March 3, 2025 20:05
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There can also be sensitive configurations such as API keys so we probably want to categorize fields that require redactions.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hopefully this will be handled by the UserConfig class. I would imagine a user should not be able to see any API keys in the returned config

Copy link
Contributor

@raghotham raghotham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we try to reduce the scope by calling it /v1/providers. That way we know that we are going to support provider CRUD. We can rejigger /inspect to move out provider specific methods.

The only concern here is the requirement for different software packages based on the provider. Right now, getting dependencies is a build time operation. For now, maybe we support adding new provider endpoints only for providers whose dependencies are already in the distro. Otherwise, we may get into situations where we package everything and cause bloat. Thoughts?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we also need to check that user_field key in field.json_schema_extra is True, right?

@cdoern
Copy link
Contributor Author

cdoern commented Mar 4, 2025

@raghotham :

Can we try to reduce the scope by calling it /v1/providers. That way we know that we are going to support provider CRUD. We can rejigger /inspect to move out provider specific methods.
The only concern here is the requirement for different software packages based on the provider. Right now, getting dependencies is a build time operation. For now, maybe we support adding new provider endpoints only for providers whose dependencies are already in the distro. Otherwise, we may get into situations where we package everything and cause bloat. Thoughts?

Yeah /v1/providers might make more sense here since configuration makes it seem like its a higher level stack config API that can change things like ports.

Yep, it seems fair for an initial version to just be re-configuring already initialized providers! I hadn't thought of using it outside of that realm, good call out!

@cdoern cdoern force-pushed the config-proposal branch from 5d337fb to 1e77a3f Compare March 5, 2025 16:04
@cdoern cdoern requested a review from SLR722 as a code owner March 5, 2025 16:04
@cdoern cdoern changed the title feat: Introduce RFC for Configuration API feat: Introduce RFC for Provider Configuration API Mar 5, 2025
Introduce an RFC for a Provider Configuration API, allowing for provider configuration changes of an existing stack to aid in common runtime changes like model swapping, endpoint switching, etc

Signed-off-by: Charlie Doern <cdoern@redhat.com>
@cdoern cdoern force-pushed the config-proposal branch from 1e77a3f to 3f105a8 Compare March 5, 2025 21:08
cdoern added a commit to cdoern/llama-stack that referenced this pull request Mar 13, 2025
currently the `inspect` API for providers is really a `list` API. Create a new `providers` API which has a GET `providers/{provider_id}` inspect API
which returns "user friendly" configuration to the end user. Also add a GET `/providers` endpoint which returns the list of providers as `inspect/providers` does today.

This API follows CRUD and is more intuitive/RESTful.

This work is part of the RFC at llamastack#1359

Signed-off-by: Charlie Doern <cdoern@redhat.com>
ashwinb pushed a commit that referenced this pull request Mar 13, 2025
# What does this PR do?

currently the `inspect` API for providers is really a `list` API. Create
a new `providers` API which has a GET `providers/{provider_id}` inspect
API
which returns "user friendly" configuration to the end user. Also add a
GET `/providers` endpoint which returns the list of providers as
`inspect/providers` does today.

This API follows CRUD and is more intuitive/RESTful.

This work is part of the RFC at
#1359

sensitive fields are redacted using `redact_sensetive_fields` on the
server side before returning a response:

<img width="456" alt="Screenshot 2025-03-13 at 4 40 21 PM"
src="https://github.com/user-attachments/assets/9465c221-2a26-42f8-a08a-6ac4a9fecce8"
/>


## Test Plan

using llamastack/llama-stack-client-python#181 a
user is able to to run the following:

`llama stack build --template ollama --image-type venv`
`llama stack run --image-type venv
~/.llama/distributions/ollama/ollama-run.yaml`
`llama-stack-client providers inspect ollama`

<img width="378" alt="Screenshot 2025-03-13 at 4 39 35 PM"
src="https://github.com/user-attachments/assets/8273d05d-8bc3-44c6-9e4b-ef95e48d5466"
/>


also, was able to run the new test_list integration test locally with
ollama:

<img width="1509" alt="Screenshot 2025-03-13 at 11 03 40 AM"
src="https://github.com/user-attachments/assets/9b9db166-f02f-45b0-86a4-306d85149bc8"
/>

Signed-off-by: Charlie Doern <cdoern@redhat.com>
cdoern added a commit to cdoern/llama-stack that referenced this pull request Apr 8, 2025
add `v1/providers/` which uses PUT to allow users to change their provider configuration

this is a follow up to llamastack#1429 and related to llamastack#1359

a user can call something like:

`llama_stack_client.providers.update(api="inference", provider_id="ollama", provider_type="remote::ollama", config={'url': 'http:/localhost:12345'})`

or

`llama-stack-client providers update inference ollama remote::ollama "{'url': 'http://localhost:12345'}"`

this API works by adding a `RequestMiddleware` to the server which checks requests, and if the user is using PUT /v1/providers, the routes are re-registered with the re-initialized provider configurations/methods

for the client, `self.impls` is updated to hold the proper methods+configurations

this depends on a client PR, the CI will fail until then but succeeded locally

Signed-off-by: Charlie Doern <cdoern@redhat.com>
Copy link
Contributor

github-actions bot commented May 5, 2025

This pull request has been automatically marked as stale because it has not had activity within 60 days. It will be automatically closed if no further activity occurs within 30 days.

@github-actions github-actions bot added the stale label May 5, 2025
Copy link
Contributor

github-actions bot commented Jun 5, 2025

This pull request has been automatically closed due to inactivity. Please feel free to reopen if you intend to continue working on it!

@github-actions github-actions bot closed this Jun 5, 2025
@cdoern cdoern mentioned this pull request Jun 11, 2025
cdoern added a commit to cdoern/llama-stack that referenced this pull request Jun 27, 2025
add `v1/providers/` which uses PUT to allow users to change their provider configuration

this is a follow up to llamastack#1429 and related to llamastack#1359

a user can call something like:

`llama_stack_client.providers.update(api="inference", provider_id="ollama", provider_type="remote::ollama", config={'url': 'http:/localhost:12345'})`

or

`llama-stack-client providers update inference ollama remote::ollama "{'url': 'http://localhost:12345'}"`

this API works by adding a `RequestMiddleware` to the server which checks requests, and if the user is using PUT /v1/providers, the routes are re-registered with the re-initialized provider configurations/methods

for the client, `self.impls` is updated to hold the proper methods+configurations

this depends on a client PR, the CI will fail until then but succeeded locally

Signed-off-by: Charlie Doern <cdoern@redhat.com>
cdoern added a commit to cdoern/llama-stack that referenced this pull request Jun 30, 2025
add `v1/providers/` which uses PUT to allow users to change their provider configuration

this is a follow up to llamastack#1429 and related to llamastack#1359

a user can call something like:

`llama_stack_client.providers.update(api="inference", provider_id="ollama", provider_type="remote::ollama", config={'url': 'http:/localhost:12345'})`

or

`llama-stack-client providers update inference ollama remote::ollama "{'url': 'http://localhost:12345'}"`

this API works by adding a `RequestMiddleware` to the server which checks requests, and if the user is using PUT /v1/providers, the routes are re-registered with the re-initialized provider configurations/methods

for the client, `self.impls` is updated to hold the proper methods+configurations

this depends on a client PR, the CI will fail until then but succeeded locally

Signed-off-by: Charlie Doern <cdoern@redhat.com>
cdoern added a commit to cdoern/llama-stack that referenced this pull request Jun 30, 2025
add `v1/providers/` which uses PUT to allow users to change their provider configuration

this is a follow up to llamastack#1429 and related to llamastack#1359

a user can call something like:

`llama_stack_client.providers.update(api="inference", provider_id="ollama", provider_type="remote::ollama", config={'url': 'http:/localhost:12345'})`

or

`llama-stack-client providers update inference ollama remote::ollama "{'url': 'http://localhost:12345'}"`

this API works by adding a `RequestMiddleware` to the server which checks requests, and if the user is using PUT /v1/providers, the routes are re-registered with the re-initialized provider configurations/methods

for the client, `self.impls` is updated to hold the proper methods+configurations

this depends on a client PR, the CI will fail until then but succeeded locally

Signed-off-by: Charlie Doern <cdoern@redhat.com>
cdoern added a commit to cdoern/llama-stack that referenced this pull request Jul 1, 2025
add `v1/providers/` which uses PUT to allow users to change their provider configuration

this is a follow up to llamastack#1429 and related to llamastack#1359

a user can call something like:

`llama_stack_client.providers.update(api="inference", provider_id="ollama", provider_type="remote::ollama", config={'url': 'http:/localhost:12345'})`

or

`llama-stack-client providers update inference ollama remote::ollama "{'url': 'http://localhost:12345'}"`

this API works by adding a `RequestMiddleware` to the server which checks requests, and if the user is using PUT /v1/providers, the routes are re-registered with the re-initialized provider configurations/methods

for the client, `self.impls` is updated to hold the proper methods+configurations

this depends on a client PR, the CI will fail until then but succeeded locally

Signed-off-by: Charlie Doern <cdoern@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot. stale

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Configuration API

5 participants