diff --git a/src/llama_stack_client/_client.py b/src/llama_stack_client/_client.py index a8489b0f..33e23819 100644 --- a/src/llama_stack_client/_client.py +++ b/src/llama_stack_client/_client.py @@ -2,35 +2,22 @@ from __future__ import annotations +import json + import os -from typing import Any, Union, Mapping -from typing_extensions import Self, override +from typing import Any, Mapping, Union import httpx +from typing_extensions import override, Self -from . import resources, _exceptions +from . import _exceptions, resources +from ._base_client import AsyncAPIClient, DEFAULT_MAX_RETRIES, SyncAPIClient +from ._exceptions import APIStatusError from ._qs import Querystring -from ._types import ( - NOT_GIVEN, - Omit, - Timeout, - NotGiven, - Transport, - ProxiesTypes, - RequestOptions, -) -from ._utils import ( - is_given, - get_async_library, -) +from ._streaming import AsyncStream as AsyncStream, Stream as Stream +from ._types import NOT_GIVEN, NotGiven, Omit, ProxiesTypes, RequestOptions, Timeout, Transport +from ._utils import get_async_library, is_given from ._version import __version__ -from ._streaming import Stream as Stream, AsyncStream as AsyncStream -from ._exceptions import APIStatusError -from ._base_client import ( - DEFAULT_MAX_RETRIES, - SyncAPIClient, - AsyncAPIClient, -) __all__ = [ "Timeout", @@ -91,6 +78,7 @@ def __init__( # outlining your use-case to help us decide if it should be # part of our public interface in the future. _strict_response_validation: bool = False, + provider_data: Mapping[str, Any] | None = None, ) -> None: """Construct a new synchronous llama-stack-client client instance.""" if base_url is None: @@ -98,6 +86,11 @@ def __init__( if base_url is None: base_url = f"http://any-hosted-llama-stack.com" + if provider_data: + if default_headers is None: + default_headers = {} + default_headers["X-LlamaStack-ProviderData"] = json.dumps(provider_data) + super().__init__( version=__version__, base_url=base_url, @@ -274,6 +267,7 @@ def __init__( # outlining your use-case to help us decide if it should be # part of our public interface in the future. _strict_response_validation: bool = False, + provider_data: Mapping[str, Any] | None = None, ) -> None: """Construct a new async llama-stack-client client instance.""" if base_url is None: @@ -281,6 +275,11 @@ def __init__( if base_url is None: base_url = f"http://any-hosted-llama-stack.com" + if provider_data: + if default_headers is None: + default_headers = {} + default_headers["X-LlamaStack-ProviderData"] = json.dumps(provider_data) + super().__init__( version=__version__, base_url=base_url,