mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-08-01 16:24:44 +00:00
add context to distinguish multiple credentials for the same (user, provider)
This commit is contained in:
parent
b43cdaaed5
commit
f6fb4a5865
3 changed files with 23 additions and 3 deletions
9
docs/_static/llama-stack-spec.html
vendored
9
docs/_static/llama-stack-spec.html
vendored
|
@ -577,7 +577,7 @@
|
||||||
"tags": [
|
"tags": [
|
||||||
"Credentials"
|
"Credentials"
|
||||||
],
|
],
|
||||||
"description": "Create a new set of credentials for a given provider.",
|
"description": "Create a new set of credentials for a given provider. The unique key is (provider_id, context)",
|
||||||
"parameters": [],
|
"parameters": [],
|
||||||
"requestBody": {
|
"requestBody": {
|
||||||
"content": {
|
"content": {
|
||||||
|
@ -6750,6 +6750,13 @@
|
||||||
"ttl_seconds": {
|
"ttl_seconds": {
|
||||||
"type": "integer",
|
"type": "integer",
|
||||||
"description": "The time to live for the credential in seconds. Defaults to 3600 seconds. When token_type is oauth2_authorization_code, the TTL is ignored and is obtained from the provider when exchanging the code for an access token."
|
"description": "The time to live for the credential in seconds. Defaults to 3600 seconds. When token_type is oauth2_authorization_code, the TTL is ignored and is obtained from the provider when exchanging the code for an access token."
|
||||||
|
},
|
||||||
|
"context": {
|
||||||
|
"type": "object",
|
||||||
|
"additionalProperties": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"description": "Context to distinguish between different credentials for the same provider. For example, for the MCP provider, this could be the toolgroup_id (which corresponds to a unique MCP endpoint)."
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"additionalProperties": false,
|
"additionalProperties": false,
|
||||||
|
|
11
docs/_static/llama-stack-spec.yaml
vendored
11
docs/_static/llama-stack-spec.yaml
vendored
|
@ -394,7 +394,8 @@ paths:
|
||||||
tags:
|
tags:
|
||||||
- Credentials
|
- Credentials
|
||||||
description: >-
|
description: >-
|
||||||
Create a new set of credentials for a given provider.
|
Create a new set of credentials for a given provider. The unique key is (provider_id,
|
||||||
|
context)
|
||||||
parameters: []
|
parameters: []
|
||||||
requestBody:
|
requestBody:
|
||||||
content:
|
content:
|
||||||
|
@ -4787,6 +4788,14 @@ components:
|
||||||
The time to live for the credential in seconds. Defaults to 3600 seconds.
|
The time to live for the credential in seconds. Defaults to 3600 seconds.
|
||||||
When token_type is oauth2_authorization_code, the TTL is ignored and is
|
When token_type is oauth2_authorization_code, the TTL is ignored and is
|
||||||
obtained from the provider when exchanging the code for an access token.
|
obtained from the provider when exchanging the code for an access token.
|
||||||
|
context:
|
||||||
|
type: object
|
||||||
|
additionalProperties:
|
||||||
|
type: string
|
||||||
|
description: >-
|
||||||
|
Context to distinguish between different credentials for the same provider.
|
||||||
|
For example, for the MCP provider, this could be the toolgroup_id (which
|
||||||
|
corresponds to a unique MCP endpoint).
|
||||||
additionalProperties: false
|
additionalProperties: false
|
||||||
required:
|
required:
|
||||||
- provider_id
|
- provider_id
|
||||||
|
|
|
@ -59,8 +59,9 @@ class Credentials(Protocol):
|
||||||
token: str,
|
token: str,
|
||||||
nonce: str | None = None,
|
nonce: str | None = None,
|
||||||
ttl_seconds: int = 3600,
|
ttl_seconds: int = 3600,
|
||||||
|
context: dict[str, str] | None = None,
|
||||||
) -> str:
|
) -> str:
|
||||||
"""Create a new set of credentials for a given provider.
|
"""Create a new set of credentials for a given provider. The unique key is (provider_id, context)
|
||||||
|
|
||||||
:param provider_id: The ID of the provider to create credentials for.
|
:param provider_id: The ID of the provider to create credentials for.
|
||||||
:param token_type: The type of token to create. This is provided in the API to serve as lightweight
|
:param token_type: The type of token to create. This is provided in the API to serve as lightweight
|
||||||
|
@ -70,6 +71,9 @@ class Credentials(Protocol):
|
||||||
:param ttl_seconds: The time to live for the credential in seconds. Defaults to 3600 seconds.
|
:param ttl_seconds: The time to live for the credential in seconds. Defaults to 3600 seconds.
|
||||||
When token_type is oauth2_authorization_code, the TTL is ignored and is obtained
|
When token_type is oauth2_authorization_code, the TTL is ignored and is obtained
|
||||||
from the provider when exchanging the code for an access token.
|
from the provider when exchanging the code for an access token.
|
||||||
|
:param context: Context to distinguish between different credentials for the same provider. For example,
|
||||||
|
for the MCP provider, this could be the toolgroup_id (which corresponds to a unique MCP
|
||||||
|
endpoint).
|
||||||
:returns: The ID of the created credential.
|
:returns: The ID of the created credential.
|
||||||
"""
|
"""
|
||||||
...
|
...
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue