-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fix: OpenAPI with provider get #1627
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
for p in providers: | ||
if p.provider_id == provider_id: | ||
ret = p | ||
return ProviderInfo( |
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 is different than inspect
. I believe this is what list
is supposed to accomplish, right?. a ProviderInfo
does not contain a config, llama-stack-client provider inspect ollama
will not contain the provider configuration if this change occurs
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 see, I think the API endpoint here is not very clear:
since
GET /providers
lists the providers
GET /providers/{provider_id}
I would assume it will return the same information from providers list.
Can we just put config in both list and get to keep consistency?
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.
@raghotham and I had a discussion about this on the initial PR, and decided that the GET /providers
with and without a provider_id is cleaner than having providers/inspect
and providers
or something like that. The single /providers is leaning more towards CRUD.
I feel like putting the config in GET /providers
but not using it is not ideal because users will have one experience when using the client and another when using the API directly and receive potentially unwanted information in the response. additionally we would need to add redaction to GET /providers
to ensure we aren't leaking information.
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 feel like putting the config in GET /providers but not using it is not ideal because users will have one experience when using the client and another when using the API directly and receive potentially unwanted information in the response. additionally we would need to add redaction to GET /providers to ensure we aren't leaking information.
Can you share an example? Are you referring to the llama-stack-client CLI v.s. API discrepancy?
My thinking is:
GET /providers --> client.providers.list()
GET /providers/{provider_id} --> client.providers.get(provider_id)
This is natual and aligns with rest of CRUD operation APIs.
As for llama-stack-client:
llama-stack-client providers list
llama-stack-client providers get <provider_id>
Without This endpoint You could expand Please let me know if I am misinterpreting something! |
Why can't we just use SafeConfig as well for ProviderInfo? |
The llama-stack-client-python PR will be a follow up. |
@cdoern Feel free to take over the PR if you see my point. This is to fix the OpenAPI spec issue we have with GetProviderResponse only being defined once breaking SDK generation. |
@yanxi0830 would the following course of action be ok?
This solution keeps the operations distinct and separate, with the user aware of the information they are retrieving Combining into one type seems a bit overloaded in my opinion, but I am happy to fix this in any way! edit: we can also name it something else like |
@cdoern what's your thought on: I feel like Option 1 is much better? Option1: single ProviderInfo with config @json_schema_type
class ProviderInfo(BaseModel):
api: str
provider_id: str
provider_type: str
config: Dict[str, Any] Option2 ProviderInfo + ProviderInfoWithConfig @json_schema_type
class ProviderInfo(BaseModel):
api: str
provider_id: str
provider_type: str
@json_schema_type
class ProviderInfoWithConfig(BaseModel):
api: str
provider_id: str
provider_type: str
config: Dict[str, Any] |
@cdoern If you are ok with my current change, feel free to take over this PR. I can help approve and merge. I will regen the SDK to fix the error with |
@yanxi0830 I think both of those look good, but I am just concerned about returning the config with each list and not using it. I feel like inspect should be the only thing to return a configuration spec while list should return just information. I think the separate ProviderInfo and ProviderInfoWithConfig (while it looks redundant in code) creates a much better API in regard to what is being returned in each request. What do you think? Also, thanks for fixing this :) |
I think list should return same object as get operation. This makes it consistent with rest of CRUD operations. |
@yanxi0830 ok, lets do it, this PR looks good to me then. Thanks for being open to the conversation! |
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.
Looks good, just a few questions comments inline. Could we perhaps squash the commits into a message just so we can keep track of these changes? Thanks for fixing this up!
- api | ||
- provider_id | ||
- provider_type | ||
- config |
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.
Is config mandatory, or if empty should it be returned as none rather than an empty dictionary?
|
||
class GetProviderResponse(BaseModel): | ||
data: Provider | None | ||
config: Dict[str, Any] |
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.
Same comment as above, maybe empty should be allowed as none, but this is kind of a nit.
There also probably needs to be a client PR to fix providers inspect to work with these changes. I can follow up with that as well as an integration test for providers inspect in the morning EST. |
@cdoern cool! could you fix that as a follow up? tagged you in llamastack/llama-stack-client-python#201 |
# What does this PR do? - sync with llamastack/llama-stack#1627 [//]: # (If resolving an issue, uncomment and update the line below) [//]: # (Closes #[issue-number]) ## Test Plan ``` llama-stack-client providers list ``` cc @cdoern to fix `llama-stack-client provider get <provider_id>` CLI [//]: # (## Documentation) [//]: # (- [ ] Added a Changelog entry if the change is significant)
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.
@leseb yeah these seem similar. I was going to introduce a 'UserConfig' which would only return fields in the provider config with a JSON schema. But we decided to maybe do that in a follow up if we decided that returning the redacted provider configuration was too much. I can make a draft PR to show how it'd work if you'd like |
No problem, thanks for the clarification! The redacted part wasn’t really the issue in #1064, but anyway, glad it made it in! |
What does this PR do?
cc @cdoern
Test Plan