mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-07-26 14:17:44 +00:00
chore: remove *_openai_compat providers (#2849)
# What does this PR do? These are no longer needed as llama-stack-evals can run against OAI endpoints directly. ## Test Plan
This commit is contained in:
parent
5e18d4d097
commit
8e1a2b4703
21 changed files with 0 additions and 545 deletions
|
@ -7,13 +7,10 @@ This section contains documentation for all available providers for the **infere
|
||||||
- [remote::anthropic](remote_anthropic.md)
|
- [remote::anthropic](remote_anthropic.md)
|
||||||
- [remote::bedrock](remote_bedrock.md)
|
- [remote::bedrock](remote_bedrock.md)
|
||||||
- [remote::cerebras](remote_cerebras.md)
|
- [remote::cerebras](remote_cerebras.md)
|
||||||
- [remote::cerebras-openai-compat](remote_cerebras-openai-compat.md)
|
|
||||||
- [remote::databricks](remote_databricks.md)
|
- [remote::databricks](remote_databricks.md)
|
||||||
- [remote::fireworks](remote_fireworks.md)
|
- [remote::fireworks](remote_fireworks.md)
|
||||||
- [remote::fireworks-openai-compat](remote_fireworks-openai-compat.md)
|
|
||||||
- [remote::gemini](remote_gemini.md)
|
- [remote::gemini](remote_gemini.md)
|
||||||
- [remote::groq](remote_groq.md)
|
- [remote::groq](remote_groq.md)
|
||||||
- [remote::groq-openai-compat](remote_groq-openai-compat.md)
|
|
||||||
- [remote::hf::endpoint](remote_hf_endpoint.md)
|
- [remote::hf::endpoint](remote_hf_endpoint.md)
|
||||||
- [remote::hf::serverless](remote_hf_serverless.md)
|
- [remote::hf::serverless](remote_hf_serverless.md)
|
||||||
- [remote::llama-openai-compat](remote_llama-openai-compat.md)
|
- [remote::llama-openai-compat](remote_llama-openai-compat.md)
|
||||||
|
@ -23,9 +20,7 @@ This section contains documentation for all available providers for the **infere
|
||||||
- [remote::passthrough](remote_passthrough.md)
|
- [remote::passthrough](remote_passthrough.md)
|
||||||
- [remote::runpod](remote_runpod.md)
|
- [remote::runpod](remote_runpod.md)
|
||||||
- [remote::sambanova](remote_sambanova.md)
|
- [remote::sambanova](remote_sambanova.md)
|
||||||
- [remote::sambanova-openai-compat](remote_sambanova-openai-compat.md)
|
|
||||||
- [remote::tgi](remote_tgi.md)
|
- [remote::tgi](remote_tgi.md)
|
||||||
- [remote::together](remote_together.md)
|
- [remote::together](remote_together.md)
|
||||||
- [remote::together-openai-compat](remote_together-openai-compat.md)
|
|
||||||
- [remote::vllm](remote_vllm.md)
|
- [remote::vllm](remote_vllm.md)
|
||||||
- [remote::watsonx](remote_watsonx.md)
|
- [remote::watsonx](remote_watsonx.md)
|
|
@ -224,17 +224,6 @@ def available_providers() -> list[ProviderSpec]:
|
||||||
description="Groq inference provider for ultra-fast inference using Groq's LPU technology.",
|
description="Groq inference provider for ultra-fast inference using Groq's LPU technology.",
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
remote_provider_spec(
|
|
||||||
api=Api.inference,
|
|
||||||
adapter=AdapterSpec(
|
|
||||||
adapter_type="fireworks-openai-compat",
|
|
||||||
pip_packages=["litellm"],
|
|
||||||
module="llama_stack.providers.remote.inference.fireworks_openai_compat",
|
|
||||||
config_class="llama_stack.providers.remote.inference.fireworks_openai_compat.config.FireworksCompatConfig",
|
|
||||||
provider_data_validator="llama_stack.providers.remote.inference.fireworks_openai_compat.config.FireworksProviderDataValidator",
|
|
||||||
description="Fireworks AI OpenAI-compatible provider for using Fireworks models with OpenAI API format.",
|
|
||||||
),
|
|
||||||
),
|
|
||||||
remote_provider_spec(
|
remote_provider_spec(
|
||||||
api=Api.inference,
|
api=Api.inference,
|
||||||
adapter=AdapterSpec(
|
adapter=AdapterSpec(
|
||||||
|
@ -246,50 +235,6 @@ def available_providers() -> list[ProviderSpec]:
|
||||||
description="Llama OpenAI-compatible provider for using Llama models with OpenAI API format.",
|
description="Llama OpenAI-compatible provider for using Llama models with OpenAI API format.",
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
remote_provider_spec(
|
|
||||||
api=Api.inference,
|
|
||||||
adapter=AdapterSpec(
|
|
||||||
adapter_type="together-openai-compat",
|
|
||||||
pip_packages=["litellm"],
|
|
||||||
module="llama_stack.providers.remote.inference.together_openai_compat",
|
|
||||||
config_class="llama_stack.providers.remote.inference.together_openai_compat.config.TogetherCompatConfig",
|
|
||||||
provider_data_validator="llama_stack.providers.remote.inference.together_openai_compat.config.TogetherProviderDataValidator",
|
|
||||||
description="Together AI OpenAI-compatible provider for using Together models with OpenAI API format.",
|
|
||||||
),
|
|
||||||
),
|
|
||||||
remote_provider_spec(
|
|
||||||
api=Api.inference,
|
|
||||||
adapter=AdapterSpec(
|
|
||||||
adapter_type="groq-openai-compat",
|
|
||||||
pip_packages=["litellm"],
|
|
||||||
module="llama_stack.providers.remote.inference.groq_openai_compat",
|
|
||||||
config_class="llama_stack.providers.remote.inference.groq_openai_compat.config.GroqCompatConfig",
|
|
||||||
provider_data_validator="llama_stack.providers.remote.inference.groq_openai_compat.config.GroqProviderDataValidator",
|
|
||||||
description="Groq OpenAI-compatible provider for using Groq models with OpenAI API format.",
|
|
||||||
),
|
|
||||||
),
|
|
||||||
remote_provider_spec(
|
|
||||||
api=Api.inference,
|
|
||||||
adapter=AdapterSpec(
|
|
||||||
adapter_type="sambanova-openai-compat",
|
|
||||||
pip_packages=["litellm"],
|
|
||||||
module="llama_stack.providers.remote.inference.sambanova_openai_compat",
|
|
||||||
config_class="llama_stack.providers.remote.inference.sambanova_openai_compat.config.SambaNovaCompatConfig",
|
|
||||||
provider_data_validator="llama_stack.providers.remote.inference.sambanova_openai_compat.config.SambaNovaProviderDataValidator",
|
|
||||||
description="SambaNova OpenAI-compatible provider for using SambaNova models with OpenAI API format.",
|
|
||||||
),
|
|
||||||
),
|
|
||||||
remote_provider_spec(
|
|
||||||
api=Api.inference,
|
|
||||||
adapter=AdapterSpec(
|
|
||||||
adapter_type="cerebras-openai-compat",
|
|
||||||
pip_packages=["litellm"],
|
|
||||||
module="llama_stack.providers.remote.inference.cerebras_openai_compat",
|
|
||||||
config_class="llama_stack.providers.remote.inference.cerebras_openai_compat.config.CerebrasCompatConfig",
|
|
||||||
provider_data_validator="llama_stack.providers.remote.inference.cerebras_openai_compat.config.CerebrasProviderDataValidator",
|
|
||||||
description="Cerebras OpenAI-compatible provider for using Cerebras models with OpenAI API format.",
|
|
||||||
),
|
|
||||||
),
|
|
||||||
remote_provider_spec(
|
remote_provider_spec(
|
||||||
api=Api.inference,
|
api=Api.inference,
|
||||||
adapter=AdapterSpec(
|
adapter=AdapterSpec(
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
||||||
# All rights reserved.
|
|
||||||
#
|
|
||||||
# This source code is licensed under the terms described in the LICENSE file in
|
|
||||||
# the root directory of this source tree.
|
|
||||||
|
|
||||||
from llama_stack.apis.inference import InferenceProvider
|
|
||||||
|
|
||||||
from .config import CerebrasCompatConfig
|
|
||||||
|
|
||||||
|
|
||||||
async def get_adapter_impl(config: CerebrasCompatConfig, _deps) -> InferenceProvider:
|
|
||||||
# import dynamically so the import is used only when it is needed
|
|
||||||
from .cerebras import CerebrasCompatInferenceAdapter
|
|
||||||
|
|
||||||
adapter = CerebrasCompatInferenceAdapter(config)
|
|
||||||
return adapter
|
|
|
@ -1,30 +0,0 @@
|
||||||
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
||||||
# All rights reserved.
|
|
||||||
#
|
|
||||||
# This source code is licensed under the terms described in the LICENSE file in
|
|
||||||
# the root directory of this source tree.
|
|
||||||
|
|
||||||
from llama_stack.providers.remote.inference.cerebras_openai_compat.config import CerebrasCompatConfig
|
|
||||||
from llama_stack.providers.utils.inference.litellm_openai_mixin import LiteLLMOpenAIMixin
|
|
||||||
|
|
||||||
from ..cerebras.models import MODEL_ENTRIES
|
|
||||||
|
|
||||||
|
|
||||||
class CerebrasCompatInferenceAdapter(LiteLLMOpenAIMixin):
|
|
||||||
_config: CerebrasCompatConfig
|
|
||||||
|
|
||||||
def __init__(self, config: CerebrasCompatConfig):
|
|
||||||
LiteLLMOpenAIMixin.__init__(
|
|
||||||
self,
|
|
||||||
model_entries=MODEL_ENTRIES,
|
|
||||||
api_key_from_config=config.api_key,
|
|
||||||
provider_data_api_key_field="cerebras_api_key",
|
|
||||||
openai_compat_api_base=config.openai_compat_api_base,
|
|
||||||
)
|
|
||||||
self.config = config
|
|
||||||
|
|
||||||
async def initialize(self):
|
|
||||||
await super().initialize()
|
|
||||||
|
|
||||||
async def shutdown(self):
|
|
||||||
await super().shutdown()
|
|
|
@ -1,38 +0,0 @@
|
||||||
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
||||||
# All rights reserved.
|
|
||||||
#
|
|
||||||
# This source code is licensed under the terms described in the LICENSE file in
|
|
||||||
# the root directory of this source tree.
|
|
||||||
|
|
||||||
from typing import Any
|
|
||||||
|
|
||||||
from pydantic import BaseModel, Field
|
|
||||||
|
|
||||||
from llama_stack.schema_utils import json_schema_type
|
|
||||||
|
|
||||||
|
|
||||||
class CerebrasProviderDataValidator(BaseModel):
|
|
||||||
cerebras_api_key: str | None = Field(
|
|
||||||
default=None,
|
|
||||||
description="API key for Cerebras models",
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@json_schema_type
|
|
||||||
class CerebrasCompatConfig(BaseModel):
|
|
||||||
api_key: str | None = Field(
|
|
||||||
default=None,
|
|
||||||
description="The Cerebras API key",
|
|
||||||
)
|
|
||||||
|
|
||||||
openai_compat_api_base: str = Field(
|
|
||||||
default="https://api.cerebras.ai/v1",
|
|
||||||
description="The URL for the Cerebras API server",
|
|
||||||
)
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def sample_run_config(cls, api_key: str = "${env.CEREBRAS_API_KEY}", **kwargs) -> dict[str, Any]:
|
|
||||||
return {
|
|
||||||
"openai_compat_api_base": "https://api.cerebras.ai/v1",
|
|
||||||
"api_key": api_key,
|
|
||||||
}
|
|
|
@ -1,17 +0,0 @@
|
||||||
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
||||||
# All rights reserved.
|
|
||||||
#
|
|
||||||
# This source code is licensed under the terms described in the LICENSE file in
|
|
||||||
# the root directory of this source tree.
|
|
||||||
|
|
||||||
from llama_stack.apis.inference import InferenceProvider
|
|
||||||
|
|
||||||
from .config import FireworksCompatConfig
|
|
||||||
|
|
||||||
|
|
||||||
async def get_adapter_impl(config: FireworksCompatConfig, _deps) -> InferenceProvider:
|
|
||||||
# import dynamically so the import is used only when it is needed
|
|
||||||
from .fireworks import FireworksCompatInferenceAdapter
|
|
||||||
|
|
||||||
adapter = FireworksCompatInferenceAdapter(config)
|
|
||||||
return adapter
|
|
|
@ -1,38 +0,0 @@
|
||||||
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
||||||
# All rights reserved.
|
|
||||||
#
|
|
||||||
# This source code is licensed under the terms described in the LICENSE file in
|
|
||||||
# the root directory of this source tree.
|
|
||||||
|
|
||||||
from typing import Any
|
|
||||||
|
|
||||||
from pydantic import BaseModel, Field
|
|
||||||
|
|
||||||
from llama_stack.schema_utils import json_schema_type
|
|
||||||
|
|
||||||
|
|
||||||
class FireworksProviderDataValidator(BaseModel):
|
|
||||||
fireworks_api_key: str | None = Field(
|
|
||||||
default=None,
|
|
||||||
description="API key for Fireworks models",
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@json_schema_type
|
|
||||||
class FireworksCompatConfig(BaseModel):
|
|
||||||
api_key: str | None = Field(
|
|
||||||
default=None,
|
|
||||||
description="The Fireworks API key",
|
|
||||||
)
|
|
||||||
|
|
||||||
openai_compat_api_base: str = Field(
|
|
||||||
default="https://api.fireworks.ai/inference/v1",
|
|
||||||
description="The URL for the Fireworks API server",
|
|
||||||
)
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def sample_run_config(cls, api_key: str = "${env.FIREWORKS_API_KEY}", **kwargs) -> dict[str, Any]:
|
|
||||||
return {
|
|
||||||
"openai_compat_api_base": "https://api.fireworks.ai/inference/v1",
|
|
||||||
"api_key": api_key,
|
|
||||||
}
|
|
|
@ -1,30 +0,0 @@
|
||||||
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
||||||
# All rights reserved.
|
|
||||||
#
|
|
||||||
# This source code is licensed under the terms described in the LICENSE file in
|
|
||||||
# the root directory of this source tree.
|
|
||||||
|
|
||||||
from llama_stack.providers.remote.inference.fireworks_openai_compat.config import FireworksCompatConfig
|
|
||||||
from llama_stack.providers.utils.inference.litellm_openai_mixin import LiteLLMOpenAIMixin
|
|
||||||
|
|
||||||
from ..fireworks.models import MODEL_ENTRIES
|
|
||||||
|
|
||||||
|
|
||||||
class FireworksCompatInferenceAdapter(LiteLLMOpenAIMixin):
|
|
||||||
_config: FireworksCompatConfig
|
|
||||||
|
|
||||||
def __init__(self, config: FireworksCompatConfig):
|
|
||||||
LiteLLMOpenAIMixin.__init__(
|
|
||||||
self,
|
|
||||||
model_entries=MODEL_ENTRIES,
|
|
||||||
api_key_from_config=config.api_key,
|
|
||||||
provider_data_api_key_field="fireworks_api_key",
|
|
||||||
openai_compat_api_base=config.openai_compat_api_base,
|
|
||||||
)
|
|
||||||
self.config = config
|
|
||||||
|
|
||||||
async def initialize(self):
|
|
||||||
await super().initialize()
|
|
||||||
|
|
||||||
async def shutdown(self):
|
|
||||||
await super().shutdown()
|
|
|
@ -1,17 +0,0 @@
|
||||||
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
||||||
# All rights reserved.
|
|
||||||
#
|
|
||||||
# This source code is licensed under the terms described in the LICENSE file in
|
|
||||||
# the root directory of this source tree.
|
|
||||||
|
|
||||||
from llama_stack.apis.inference import InferenceProvider
|
|
||||||
|
|
||||||
from .config import GroqCompatConfig
|
|
||||||
|
|
||||||
|
|
||||||
async def get_adapter_impl(config: GroqCompatConfig, _deps) -> InferenceProvider:
|
|
||||||
# import dynamically so the import is used only when it is needed
|
|
||||||
from .groq import GroqCompatInferenceAdapter
|
|
||||||
|
|
||||||
adapter = GroqCompatInferenceAdapter(config)
|
|
||||||
return adapter
|
|
|
@ -1,38 +0,0 @@
|
||||||
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
||||||
# All rights reserved.
|
|
||||||
#
|
|
||||||
# This source code is licensed under the terms described in the LICENSE file in
|
|
||||||
# the root directory of this source tree.
|
|
||||||
|
|
||||||
from typing import Any
|
|
||||||
|
|
||||||
from pydantic import BaseModel, Field
|
|
||||||
|
|
||||||
from llama_stack.schema_utils import json_schema_type
|
|
||||||
|
|
||||||
|
|
||||||
class GroqProviderDataValidator(BaseModel):
|
|
||||||
groq_api_key: str | None = Field(
|
|
||||||
default=None,
|
|
||||||
description="API key for Groq models",
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@json_schema_type
|
|
||||||
class GroqCompatConfig(BaseModel):
|
|
||||||
api_key: str | None = Field(
|
|
||||||
default=None,
|
|
||||||
description="The Groq API key",
|
|
||||||
)
|
|
||||||
|
|
||||||
openai_compat_api_base: str = Field(
|
|
||||||
default="https://api.groq.com/openai/v1",
|
|
||||||
description="The URL for the Groq API server",
|
|
||||||
)
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def sample_run_config(cls, api_key: str = "${env.GROQ_API_KEY}", **kwargs) -> dict[str, Any]:
|
|
||||||
return {
|
|
||||||
"openai_compat_api_base": "https://api.groq.com/openai/v1",
|
|
||||||
"api_key": api_key,
|
|
||||||
}
|
|
|
@ -1,30 +0,0 @@
|
||||||
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
||||||
# All rights reserved.
|
|
||||||
#
|
|
||||||
# This source code is licensed under the terms described in the LICENSE file in
|
|
||||||
# the root directory of this source tree.
|
|
||||||
|
|
||||||
from llama_stack.providers.remote.inference.groq_openai_compat.config import GroqCompatConfig
|
|
||||||
from llama_stack.providers.utils.inference.litellm_openai_mixin import LiteLLMOpenAIMixin
|
|
||||||
|
|
||||||
from ..groq.models import MODEL_ENTRIES
|
|
||||||
|
|
||||||
|
|
||||||
class GroqCompatInferenceAdapter(LiteLLMOpenAIMixin):
|
|
||||||
_config: GroqCompatConfig
|
|
||||||
|
|
||||||
def __init__(self, config: GroqCompatConfig):
|
|
||||||
LiteLLMOpenAIMixin.__init__(
|
|
||||||
self,
|
|
||||||
model_entries=MODEL_ENTRIES,
|
|
||||||
api_key_from_config=config.api_key,
|
|
||||||
provider_data_api_key_field="groq_api_key",
|
|
||||||
openai_compat_api_base=config.openai_compat_api_base,
|
|
||||||
)
|
|
||||||
self.config = config
|
|
||||||
|
|
||||||
async def initialize(self):
|
|
||||||
await super().initialize()
|
|
||||||
|
|
||||||
async def shutdown(self):
|
|
||||||
await super().shutdown()
|
|
|
@ -1,17 +0,0 @@
|
||||||
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
||||||
# All rights reserved.
|
|
||||||
#
|
|
||||||
# This source code is licensed under the terms described in the LICENSE file in
|
|
||||||
# the root directory of this source tree.
|
|
||||||
|
|
||||||
from llama_stack.apis.inference import InferenceProvider
|
|
||||||
|
|
||||||
from .config import SambaNovaCompatConfig
|
|
||||||
|
|
||||||
|
|
||||||
async def get_adapter_impl(config: SambaNovaCompatConfig, _deps) -> InferenceProvider:
|
|
||||||
# import dynamically so the import is used only when it is needed
|
|
||||||
from .sambanova import SambaNovaCompatInferenceAdapter
|
|
||||||
|
|
||||||
adapter = SambaNovaCompatInferenceAdapter(config)
|
|
||||||
return adapter
|
|
|
@ -1,38 +0,0 @@
|
||||||
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
||||||
# All rights reserved.
|
|
||||||
#
|
|
||||||
# This source code is licensed under the terms described in the LICENSE file in
|
|
||||||
# the root directory of this source tree.
|
|
||||||
|
|
||||||
from typing import Any
|
|
||||||
|
|
||||||
from pydantic import BaseModel, Field
|
|
||||||
|
|
||||||
from llama_stack.schema_utils import json_schema_type
|
|
||||||
|
|
||||||
|
|
||||||
class SambaNovaProviderDataValidator(BaseModel):
|
|
||||||
sambanova_api_key: str | None = Field(
|
|
||||||
default=None,
|
|
||||||
description="API key for SambaNova models",
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@json_schema_type
|
|
||||||
class SambaNovaCompatConfig(BaseModel):
|
|
||||||
api_key: str | None = Field(
|
|
||||||
default=None,
|
|
||||||
description="The SambaNova API key",
|
|
||||||
)
|
|
||||||
|
|
||||||
openai_compat_api_base: str = Field(
|
|
||||||
default="https://api.sambanova.ai/v1",
|
|
||||||
description="The URL for the SambaNova API server",
|
|
||||||
)
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def sample_run_config(cls, api_key: str = "${env.SAMBANOVA_API_KEY}", **kwargs) -> dict[str, Any]:
|
|
||||||
return {
|
|
||||||
"openai_compat_api_base": "https://api.sambanova.ai/v1",
|
|
||||||
"api_key": api_key,
|
|
||||||
}
|
|
|
@ -1,30 +0,0 @@
|
||||||
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
||||||
# All rights reserved.
|
|
||||||
#
|
|
||||||
# This source code is licensed under the terms described in the LICENSE file in
|
|
||||||
# the root directory of this source tree.
|
|
||||||
|
|
||||||
from llama_stack.providers.remote.inference.sambanova_openai_compat.config import SambaNovaCompatConfig
|
|
||||||
from llama_stack.providers.utils.inference.litellm_openai_mixin import LiteLLMOpenAIMixin
|
|
||||||
|
|
||||||
from ..sambanova.models import MODEL_ENTRIES
|
|
||||||
|
|
||||||
|
|
||||||
class SambaNovaCompatInferenceAdapter(LiteLLMOpenAIMixin):
|
|
||||||
_config: SambaNovaCompatConfig
|
|
||||||
|
|
||||||
def __init__(self, config: SambaNovaCompatConfig):
|
|
||||||
LiteLLMOpenAIMixin.__init__(
|
|
||||||
self,
|
|
||||||
model_entries=MODEL_ENTRIES,
|
|
||||||
api_key_from_config=config.api_key,
|
|
||||||
provider_data_api_key_field="sambanova_api_key",
|
|
||||||
openai_compat_api_base=config.openai_compat_api_base,
|
|
||||||
)
|
|
||||||
self.config = config
|
|
||||||
|
|
||||||
async def initialize(self):
|
|
||||||
await super().initialize()
|
|
||||||
|
|
||||||
async def shutdown(self):
|
|
||||||
await super().shutdown()
|
|
|
@ -1,17 +0,0 @@
|
||||||
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
||||||
# All rights reserved.
|
|
||||||
#
|
|
||||||
# This source code is licensed under the terms described in the LICENSE file in
|
|
||||||
# the root directory of this source tree.
|
|
||||||
|
|
||||||
from llama_stack.apis.inference import InferenceProvider
|
|
||||||
|
|
||||||
from .config import TogetherCompatConfig
|
|
||||||
|
|
||||||
|
|
||||||
async def get_adapter_impl(config: TogetherCompatConfig, _deps) -> InferenceProvider:
|
|
||||||
# import dynamically so the import is used only when it is needed
|
|
||||||
from .together import TogetherCompatInferenceAdapter
|
|
||||||
|
|
||||||
adapter = TogetherCompatInferenceAdapter(config)
|
|
||||||
return adapter
|
|
|
@ -1,38 +0,0 @@
|
||||||
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
||||||
# All rights reserved.
|
|
||||||
#
|
|
||||||
# This source code is licensed under the terms described in the LICENSE file in
|
|
||||||
# the root directory of this source tree.
|
|
||||||
|
|
||||||
from typing import Any
|
|
||||||
|
|
||||||
from pydantic import BaseModel, Field
|
|
||||||
|
|
||||||
from llama_stack.schema_utils import json_schema_type
|
|
||||||
|
|
||||||
|
|
||||||
class TogetherProviderDataValidator(BaseModel):
|
|
||||||
together_api_key: str | None = Field(
|
|
||||||
default=None,
|
|
||||||
description="API key for Together models",
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@json_schema_type
|
|
||||||
class TogetherCompatConfig(BaseModel):
|
|
||||||
api_key: str | None = Field(
|
|
||||||
default=None,
|
|
||||||
description="The Together API key",
|
|
||||||
)
|
|
||||||
|
|
||||||
openai_compat_api_base: str = Field(
|
|
||||||
default="https://api.together.xyz/v1",
|
|
||||||
description="The URL for the Together API server",
|
|
||||||
)
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def sample_run_config(cls, api_key: str = "${env.TOGETHER_API_KEY}", **kwargs) -> dict[str, Any]:
|
|
||||||
return {
|
|
||||||
"openai_compat_api_base": "https://api.together.xyz/v1",
|
|
||||||
"api_key": api_key,
|
|
||||||
}
|
|
|
@ -1,30 +0,0 @@
|
||||||
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
||||||
# All rights reserved.
|
|
||||||
#
|
|
||||||
# This source code is licensed under the terms described in the LICENSE file in
|
|
||||||
# the root directory of this source tree.
|
|
||||||
|
|
||||||
from llama_stack.providers.remote.inference.together_openai_compat.config import TogetherCompatConfig
|
|
||||||
from llama_stack.providers.utils.inference.litellm_openai_mixin import LiteLLMOpenAIMixin
|
|
||||||
|
|
||||||
from ..together.models import MODEL_ENTRIES
|
|
||||||
|
|
||||||
|
|
||||||
class TogetherCompatInferenceAdapter(LiteLLMOpenAIMixin):
|
|
||||||
_config: TogetherCompatConfig
|
|
||||||
|
|
||||||
def __init__(self, config: TogetherCompatConfig):
|
|
||||||
LiteLLMOpenAIMixin.__init__(
|
|
||||||
self,
|
|
||||||
model_entries=MODEL_ENTRIES,
|
|
||||||
api_key_from_config=config.api_key,
|
|
||||||
provider_data_api_key_field="together_api_key",
|
|
||||||
openai_compat_api_base=config.openai_compat_api_base,
|
|
||||||
)
|
|
||||||
self.config = config
|
|
||||||
|
|
||||||
async def initialize(self):
|
|
||||||
await super().initialize()
|
|
||||||
|
|
||||||
async def shutdown(self):
|
|
||||||
await super().shutdown()
|
|
|
@ -19,12 +19,7 @@ distribution_spec:
|
||||||
- remote::anthropic
|
- remote::anthropic
|
||||||
- remote::gemini
|
- remote::gemini
|
||||||
- remote::groq
|
- remote::groq
|
||||||
- remote::fireworks-openai-compat
|
|
||||||
- remote::llama-openai-compat
|
- remote::llama-openai-compat
|
||||||
- remote::together-openai-compat
|
|
||||||
- remote::groq-openai-compat
|
|
||||||
- remote::sambanova-openai-compat
|
|
||||||
- remote::cerebras-openai-compat
|
|
||||||
- remote::sambanova
|
- remote::sambanova
|
||||||
- remote::passthrough
|
- remote::passthrough
|
||||||
- inline::sentence-transformers
|
- inline::sentence-transformers
|
||||||
|
|
|
@ -90,36 +90,11 @@ providers:
|
||||||
config:
|
config:
|
||||||
url: https://api.groq.com
|
url: https://api.groq.com
|
||||||
api_key: ${env.GROQ_API_KEY}
|
api_key: ${env.GROQ_API_KEY}
|
||||||
- provider_id: ${env.ENABLE_FIREWORKS_OPENAI_COMPAT:=__disabled__}
|
|
||||||
provider_type: remote::fireworks-openai-compat
|
|
||||||
config:
|
|
||||||
openai_compat_api_base: https://api.fireworks.ai/inference/v1
|
|
||||||
api_key: ${env.FIREWORKS_API_KEY}
|
|
||||||
- provider_id: ${env.ENABLE_LLAMA_OPENAI_COMPAT:=__disabled__}
|
- provider_id: ${env.ENABLE_LLAMA_OPENAI_COMPAT:=__disabled__}
|
||||||
provider_type: remote::llama-openai-compat
|
provider_type: remote::llama-openai-compat
|
||||||
config:
|
config:
|
||||||
openai_compat_api_base: https://api.llama.com/compat/v1/
|
openai_compat_api_base: https://api.llama.com/compat/v1/
|
||||||
api_key: ${env.LLAMA_API_KEY}
|
api_key: ${env.LLAMA_API_KEY}
|
||||||
- provider_id: ${env.ENABLE_TOGETHER_OPENAI_COMPAT:=__disabled__}
|
|
||||||
provider_type: remote::together-openai-compat
|
|
||||||
config:
|
|
||||||
openai_compat_api_base: https://api.together.xyz/v1
|
|
||||||
api_key: ${env.TOGETHER_API_KEY}
|
|
||||||
- provider_id: ${env.ENABLE_GROQ_OPENAI_COMPAT:=__disabled__}
|
|
||||||
provider_type: remote::groq-openai-compat
|
|
||||||
config:
|
|
||||||
openai_compat_api_base: https://api.groq.com/openai/v1
|
|
||||||
api_key: ${env.GROQ_API_KEY}
|
|
||||||
- provider_id: ${env.ENABLE_SAMBANOVA_OPENAI_COMPAT:=__disabled__}
|
|
||||||
provider_type: remote::sambanova-openai-compat
|
|
||||||
config:
|
|
||||||
openai_compat_api_base: https://api.sambanova.ai/v1
|
|
||||||
api_key: ${env.SAMBANOVA_API_KEY}
|
|
||||||
- provider_id: ${env.ENABLE_CEREBRAS_OPENAI_COMPAT:=__disabled__}
|
|
||||||
provider_type: remote::cerebras-openai-compat
|
|
||||||
config:
|
|
||||||
openai_compat_api_base: https://api.cerebras.ai/v1
|
|
||||||
api_key: ${env.CEREBRAS_API_KEY}
|
|
||||||
- provider_id: ${env.ENABLE_SAMBANOVA:=__disabled__}
|
- provider_id: ${env.ENABLE_SAMBANOVA:=__disabled__}
|
||||||
provider_type: remote::sambanova
|
provider_type: remote::sambanova
|
||||||
config:
|
config:
|
||||||
|
|
|
@ -19,12 +19,7 @@ distribution_spec:
|
||||||
- remote::anthropic
|
- remote::anthropic
|
||||||
- remote::gemini
|
- remote::gemini
|
||||||
- remote::groq
|
- remote::groq
|
||||||
- remote::fireworks-openai-compat
|
|
||||||
- remote::llama-openai-compat
|
- remote::llama-openai-compat
|
||||||
- remote::together-openai-compat
|
|
||||||
- remote::groq-openai-compat
|
|
||||||
- remote::sambanova-openai-compat
|
|
||||||
- remote::cerebras-openai-compat
|
|
||||||
- remote::sambanova
|
- remote::sambanova
|
||||||
- remote::passthrough
|
- remote::passthrough
|
||||||
- inline::sentence-transformers
|
- inline::sentence-transformers
|
||||||
|
|
|
@ -90,36 +90,11 @@ providers:
|
||||||
config:
|
config:
|
||||||
url: https://api.groq.com
|
url: https://api.groq.com
|
||||||
api_key: ${env.GROQ_API_KEY}
|
api_key: ${env.GROQ_API_KEY}
|
||||||
- provider_id: ${env.ENABLE_FIREWORKS_OPENAI_COMPAT:=__disabled__}
|
|
||||||
provider_type: remote::fireworks-openai-compat
|
|
||||||
config:
|
|
||||||
openai_compat_api_base: https://api.fireworks.ai/inference/v1
|
|
||||||
api_key: ${env.FIREWORKS_API_KEY}
|
|
||||||
- provider_id: ${env.ENABLE_LLAMA_OPENAI_COMPAT:=__disabled__}
|
- provider_id: ${env.ENABLE_LLAMA_OPENAI_COMPAT:=__disabled__}
|
||||||
provider_type: remote::llama-openai-compat
|
provider_type: remote::llama-openai-compat
|
||||||
config:
|
config:
|
||||||
openai_compat_api_base: https://api.llama.com/compat/v1/
|
openai_compat_api_base: https://api.llama.com/compat/v1/
|
||||||
api_key: ${env.LLAMA_API_KEY}
|
api_key: ${env.LLAMA_API_KEY}
|
||||||
- provider_id: ${env.ENABLE_TOGETHER_OPENAI_COMPAT:=__disabled__}
|
|
||||||
provider_type: remote::together-openai-compat
|
|
||||||
config:
|
|
||||||
openai_compat_api_base: https://api.together.xyz/v1
|
|
||||||
api_key: ${env.TOGETHER_API_KEY}
|
|
||||||
- provider_id: ${env.ENABLE_GROQ_OPENAI_COMPAT:=__disabled__}
|
|
||||||
provider_type: remote::groq-openai-compat
|
|
||||||
config:
|
|
||||||
openai_compat_api_base: https://api.groq.com/openai/v1
|
|
||||||
api_key: ${env.GROQ_API_KEY}
|
|
||||||
- provider_id: ${env.ENABLE_SAMBANOVA_OPENAI_COMPAT:=__disabled__}
|
|
||||||
provider_type: remote::sambanova-openai-compat
|
|
||||||
config:
|
|
||||||
openai_compat_api_base: https://api.sambanova.ai/v1
|
|
||||||
api_key: ${env.SAMBANOVA_API_KEY}
|
|
||||||
- provider_id: ${env.ENABLE_CEREBRAS_OPENAI_COMPAT:=__disabled__}
|
|
||||||
provider_type: remote::cerebras-openai-compat
|
|
||||||
config:
|
|
||||||
openai_compat_api_base: https://api.cerebras.ai/v1
|
|
||||||
api_key: ${env.CEREBRAS_API_KEY}
|
|
||||||
- provider_id: ${env.ENABLE_SAMBANOVA:=__disabled__}
|
- provider_id: ${env.ENABLE_SAMBANOVA:=__disabled__}
|
||||||
provider_type: remote::sambanova
|
provider_type: remote::sambanova
|
||||||
config:
|
config:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue