mirror of
https://github.com/strands-agents/harness-sdk.git
synced 2026-10-02 02:44:48 +08:00
chore(python): deprecate LlamaAPI model provider (#4011)
This commit is contained in:
@@ -10,7 +10,13 @@ sourceLinks:
|
||||
- path: strands-py/src/strands/models/llamaapi.py
|
||||
---
|
||||
|
||||
[Llama API](https://llama.developer.meta.com?utm_source=partner-strandsagent&utm_medium=website) is a Meta-hosted API service that helps you integrate Llama models into your applications quickly and efficiently.
|
||||
:::caution[Deprecated]
|
||||
The Llama API service has been deprecated by Meta, and Strands' `LlamaAPIModel` provider is deprecated
|
||||
along with it. It will be removed in v2.0.0. Use [Amazon Bedrock](./amazon-bedrock),
|
||||
[Ollama](./ollama), or [OpenAI](./openai) instead.
|
||||
:::
|
||||
|
||||
Llama API is a Meta-hosted API service that helps you integrate Llama models into your applications quickly and efficiently.
|
||||
|
||||
Llama API provides access to Llama models through a simple API interface, with inference provided by Meta, so you can focus on building AI-powered solutions without managing your own inference infrastructure.
|
||||
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
# Copyright (c) Meta Platforms, Inc. and affiliates
|
||||
"""Llama API model provider.
|
||||
|
||||
- Docs: https://llama.developer.meta.com/
|
||||
Deprecated: The Llama API service has been deprecated by Meta. This provider will be removed
|
||||
in v2.0.0. Migrate to another provider (BedrockModel, OllamaModel, or OpenAIModel) that hosts
|
||||
Llama or comparable models.
|
||||
"""
|
||||
|
||||
import base64
|
||||
@@ -14,7 +16,7 @@ from typing import Any, TypeVar, cast
|
||||
import llama_api_client
|
||||
from llama_api_client import LlamaAPIClient
|
||||
from pydantic import BaseModel
|
||||
from typing_extensions import Unpack, override
|
||||
from typing_extensions import Unpack, deprecated, override
|
||||
|
||||
from ..types.content import ContentBlock, Messages
|
||||
from ..types.exceptions import ContextWindowOverflowException, ModelThrottledException
|
||||
@@ -28,8 +30,17 @@ logger = logging.getLogger(__name__)
|
||||
T = TypeVar("T", bound=BaseModel)
|
||||
|
||||
|
||||
@deprecated(
|
||||
"LlamaAPIModel is deprecated and will be removed in v2.0.0. "
|
||||
"The underlying Llama API service has been deprecated by Meta. "
|
||||
"Use BedrockModel, OllamaModel, or OpenAIModel instead."
|
||||
)
|
||||
class LlamaAPIModel(Model):
|
||||
"""Llama API model provider implementation."""
|
||||
"""Llama API model provider implementation.
|
||||
|
||||
Deprecated: The Llama API service has been deprecated by Meta. This class will be removed
|
||||
in v2.0.0. Use BedrockModel, OllamaModel, or OpenAIModel instead.
|
||||
"""
|
||||
|
||||
OVERFLOW_MESSAGES = {
|
||||
"this model's maximum context length is",
|
||||
|
||||
@@ -49,6 +49,13 @@ def test__init__model_configs(llamaapi_client, model_id):
|
||||
assert tru_temperature == exp_temperature
|
||||
|
||||
|
||||
def test__init__emits_deprecation_warning(llamaapi_client, model_id):
|
||||
_ = llamaapi_client
|
||||
|
||||
with pytest.warns(DeprecationWarning, match="LlamaAPIModel is deprecated"):
|
||||
LlamaAPIModel(model_id=model_id)
|
||||
|
||||
|
||||
def test_update_config(model, model_id):
|
||||
model.update_config(model_id=model_id)
|
||||
|
||||
@@ -436,9 +443,10 @@ def test_config_validation_warns_on_unknown_keys(llamaapi_client, captured_warni
|
||||
"""Test that unknown config keys emit a warning."""
|
||||
LlamaAPIModel(model_id="test-model", invalid_param="test")
|
||||
|
||||
assert len(captured_warnings) == 1
|
||||
assert "Invalid configuration parameters" in str(captured_warnings[0].message)
|
||||
assert "invalid_param" in str(captured_warnings[0].message)
|
||||
user_warnings = [warning for warning in captured_warnings if issubclass(warning.category, UserWarning)]
|
||||
assert len(user_warnings) == 1
|
||||
assert "Invalid configuration parameters" in str(user_warnings[0].message)
|
||||
assert "invalid_param" in str(user_warnings[0].message)
|
||||
|
||||
|
||||
def test_update_config_validation_warns_on_unknown_keys(model, captured_warnings):
|
||||
|
||||
Reference in New Issue
Block a user