From 48a42e9072d1917fd9c90dc0450db6bd9a4628da Mon Sep 17 00:00:00 2001 From: "Victor M. SMITH" <72023257+MVS-source@users.noreply.github.com> Date: Tue, 21 Jul 2026 15:25:46 +0200 Subject: [PATCH 1/4] feat: add Eden AI as a provider option Eden AI is an EU-based, OpenAI-compatible LLM gateway. Since Atomic Agents delegates model access to Instructor, Eden AI works through instructor.from_openai(OpenAI(base_url=..., api_key=...)), exactly like the existing OpenRouter and MiniMax options. Model ids are vendor-prefixed (e.g. openai/gpt-4o-mini, anthropic/claude-haiku-4-5). Adds the provider to the multi-provider quickstart example, unit tests and live integration tests mirroring the MiniMax ones, and a mention in the README provider list. --- README.md | 2 +- .../tests/agents/test_edenai_integration.py | 79 ++++++++ .../tests/agents/test_edenai_provider.py | 171 ++++++++++++++++++ .../4_basic_chatbot_different_providers.py | 10 +- 4 files changed, 260 insertions(+), 2 deletions(-) create mode 100644 atomic-agents/tests/agents/test_edenai_integration.py create mode 100644 atomic-agents/tests/agents/test_edenai_provider.py diff --git a/README.md b/README.md index d0fed80d..ba505fae 100644 --- a/README.md +++ b/README.md @@ -402,7 +402,7 @@ uv sync --all-packages ## Provider & Model Compatibility -Atomic Agents depends on the [Instructor](https://github.com/jxnl/instructor) package. This means that in all examples where OpenAI is used, any other API supported by Instructor can also be used, such as Ollama, Groq, Mistral, Cohere, Anthropic, Gemini, [MiniMax](https://www.minimax.io/), and more. For a complete list, please refer to the Instructor documentation on its [GitHub page](https://github.com/jxnl/instructor). +Atomic Agents depends on the [Instructor](https://github.com/jxnl/instructor) package. This means that in all examples where OpenAI is used, any other API supported by Instructor can also be used, such as Ollama, Groq, Mistral, Cohere, Anthropic, Gemini, [MiniMax](https://www.minimax.io/), [Eden AI](https://www.edenai.co/), and more. For a complete list, please refer to the Instructor documentation on its [GitHub page](https://github.com/jxnl/instructor). ## Support diff --git a/atomic-agents/tests/agents/test_edenai_integration.py b/atomic-agents/tests/agents/test_edenai_integration.py new file mode 100644 index 00000000..69992767 --- /dev/null +++ b/atomic-agents/tests/agents/test_edenai_integration.py @@ -0,0 +1,79 @@ +"""Integration tests for Eden AI provider with Atomic Agents. + +These tests require a valid EDENAI_API_KEY environment variable. +Run with: pytest -m integration tests/agents/test_edenai_integration.py +""" + +import os +import pytest +import instructor +from pydantic import Field +from atomic_agents import ( + AtomicAgent, + AgentConfig, + BasicChatInputSchema, + BasicChatOutputSchema, + BaseIOSchema, +) + +pytestmark = pytest.mark.skipif( + not os.getenv("EDENAI_API_KEY"), + reason="EDENAI_API_KEY not set", +) + + +def _make_edenai_agent(model="openai/gpt-4o-mini", **agent_kwargs): + """Helper to create an Eden AI-backed agent.""" + from openai import OpenAI + + raw = OpenAI( + base_url="https://api.edenai.run/v3", + api_key=os.environ["EDENAI_API_KEY"], + ) + client = instructor.from_openai(raw) + config = AgentConfig(client=client, model=model, **agent_kwargs) + return AtomicAgent[BasicChatInputSchema, BasicChatOutputSchema](config) + + +@pytest.mark.integration +class TestEdenAILiveChat: + """Live integration tests against Eden AI API.""" + + def test_basic_chat(self): + """Test a basic chat completion with Eden AI.""" + agent = _make_edenai_agent() + response = agent.run(BasicChatInputSchema(chat_message="Say hello in one word.")) + assert response.chat_message + assert len(response.chat_message) > 0 + + def test_multi_turn_conversation(self): + """Test multi-turn conversation with Eden AI.""" + agent = _make_edenai_agent() + r1 = agent.run(BasicChatInputSchema(chat_message="Remember the number 42.")) + assert r1.chat_message # first response should be non-empty + r2 = agent.run(BasicChatInputSchema(chat_message="What number did I ask you to remember?")) + assert r2.chat_message + # The model should recall "42" from the conversation history + assert "42" in r2.chat_message + + def test_custom_output_schema(self): + """Test structured output with a custom schema via Eden AI.""" + from openai import OpenAI + + class AnalysisOutput(BaseIOSchema): + """Analysis output schema.""" + + sentiment: str = Field(..., description="One of: positive, negative, neutral") + confidence: float = Field(..., description="Confidence score between 0 and 1") + + raw = OpenAI( + base_url="https://api.edenai.run/v3", + api_key=os.environ["EDENAI_API_KEY"], + ) + client = instructor.from_openai(raw) + config = AgentConfig(client=client, model="openai/gpt-4o-mini") + agent = AtomicAgent[BasicChatInputSchema, AnalysisOutput](config) + + response = agent.run(BasicChatInputSchema(chat_message="I love this product, it's amazing!")) + assert response.sentiment in ("positive", "negative", "neutral") + assert 0 <= response.confidence <= 1 diff --git a/atomic-agents/tests/agents/test_edenai_provider.py b/atomic-agents/tests/agents/test_edenai_provider.py new file mode 100644 index 00000000..3130421c --- /dev/null +++ b/atomic-agents/tests/agents/test_edenai_provider.py @@ -0,0 +1,171 @@ +"""Unit tests for Eden AI provider integration with Atomic Agents.""" + +import os +import pytest +from unittest.mock import Mock, patch +import instructor +from atomic_agents import ( + AtomicAgent, + AgentConfig, + BasicChatInputSchema, + BasicChatOutputSchema, +) +from atomic_agents.context import SystemPromptGenerator + + +def _create_edenai_client(api_key="test-key"): + """Create an Eden AI client via OpenAI-compatible interface.""" + from openai import OpenAI + + return instructor.from_openai(OpenAI(base_url="https://api.edenai.run/v3", api_key=api_key)) + + +class TestEdenAIClientSetup: + """Tests for Eden AI client initialization.""" + + def test_edenai_client_creation(self): + """Test that Eden AI client can be created with correct base_url.""" + from openai import OpenAI + + raw_client = OpenAI(base_url="https://api.edenai.run/v3", api_key="test-key") + assert raw_client.base_url == "https://api.edenai.run/v3/" + + def test_edenai_instructor_wrapping(self): + """Test that Eden AI client can be wrapped with instructor.""" + client = _create_edenai_client() + assert isinstance(client, instructor.Instructor) + + def test_edenai_agent_config(self): + """Test that AgentConfig accepts Eden AI client and model.""" + client = _create_edenai_client() + config = AgentConfig( + client=client, + model="openai/gpt-4o-mini", + ) + assert config.model == "openai/gpt-4o-mini" + assert config.assistant_role == "assistant" + + def test_edenai_agent_initialization(self): + """Test that AtomicAgent can be initialized with Eden AI config.""" + client = _create_edenai_client() + config = AgentConfig( + client=client, + model="openai/gpt-4o-mini", + ) + agent = AtomicAgent[BasicChatInputSchema, BasicChatOutputSchema](config) + assert agent.model == "openai/gpt-4o-mini" + assert agent.assistant_role == "assistant" + + def test_edenai_vendor_prefixed_model(self): + """Test that a different vendor-prefixed Eden AI model id works.""" + client = _create_edenai_client() + config = AgentConfig( + client=client, + model="anthropic/claude-haiku-4-5", + ) + agent = AtomicAgent[BasicChatInputSchema, BasicChatOutputSchema](config) + assert agent.model == "anthropic/claude-haiku-4-5" + + +class TestEdenAIAgentBehavior: + """Tests for agent behavior with Eden AI provider.""" + + @pytest.fixture + def mock_edenai_instructor(self): + mock = Mock(spec=instructor.Instructor) + mock.chat = Mock() + mock.chat.completions = Mock() + mock.chat.completions.create = Mock(return_value=BasicChatOutputSchema(chat_message="Eden AI response")) + mock_response = BasicChatOutputSchema(chat_message="Eden AI response") + mock_iter = Mock() + mock_iter.__iter__ = Mock(return_value=iter([mock_response])) + mock.chat.completions.create_partial.return_value = mock_iter + return mock + + @pytest.fixture + def edenai_agent(self, mock_edenai_instructor): + config = AgentConfig( + client=mock_edenai_instructor, + model="openai/gpt-4o-mini", + ) + return AtomicAgent[BasicChatInputSchema, BasicChatOutputSchema](config) + + def test_run_with_edenai(self, edenai_agent, mock_edenai_instructor): + """Test that agent.run works with Eden AI mock client.""" + user_input = BasicChatInputSchema(chat_message="Hello from Eden AI test") + response = edenai_agent.run(user_input) + assert response.chat_message == "Eden AI response" + mock_edenai_instructor.chat.completions.create.assert_called_once() + + def test_run_passes_correct_model(self, edenai_agent, mock_edenai_instructor): + """Test that the correct model name is passed to the API.""" + user_input = BasicChatInputSchema(chat_message="Test") + edenai_agent.run(user_input) + call_kwargs = mock_edenai_instructor.chat.completions.create.call_args + assert call_kwargs.kwargs["model"] == "openai/gpt-4o-mini" + + def test_run_stream_with_edenai(self, edenai_agent): + """Test that streaming works with Eden AI mock client.""" + user_input = BasicChatInputSchema(chat_message="Stream test") + responses = list(edenai_agent.run_stream(user_input)) + assert len(responses) == 1 + assert responses[0].chat_message == "Eden AI response" + + def test_history_tracking_with_edenai(self, edenai_agent): + """Test that chat history is properly tracked.""" + user_input = BasicChatInputSchema(chat_message="First message") + edenai_agent.run(user_input) + history = edenai_agent.history.get_history() + assert len(history) == 2 # user + assistant + + def test_system_prompt_with_edenai(self, mock_edenai_instructor): + """Test that system prompt works correctly with Eden AI.""" + spg = SystemPromptGenerator( + background=["You are a helpful Eden AI-powered assistant."], + ) + config = AgentConfig( + client=mock_edenai_instructor, + model="openai/gpt-4o-mini", + system_prompt_generator=spg, + ) + agent = AtomicAgent[BasicChatInputSchema, BasicChatOutputSchema](config) + prompt = agent.system_prompt_generator.generate_prompt() + assert "Eden AI" in prompt + + def test_model_api_parameters_with_edenai(self, mock_edenai_instructor): + """Test that custom API parameters are passed through.""" + config = AgentConfig( + client=mock_edenai_instructor, + model="openai/gpt-4o-mini", + model_api_parameters={"temperature": 0.7, "max_tokens": 1024}, + ) + agent = AtomicAgent[BasicChatInputSchema, BasicChatOutputSchema](config) + assert agent.model_api_parameters["temperature"] == 0.7 + assert agent.model_api_parameters["max_tokens"] == 1024 + + def test_edenai_reset_history(self, edenai_agent): + """Test that history reset works with Eden AI agent.""" + user_input = BasicChatInputSchema(chat_message="Test") + edenai_agent.run(user_input) + edenai_agent.reset_history() + history = edenai_agent.history.get_history() + assert len(history) == 0 + + +class TestEdenAIProviderSetup: + """Tests for the provider setup function from the quickstart example.""" + + def test_setup_client_edenai_pattern(self): + """Test the Eden AI client setup pattern used by the quickstart example.""" + from openai import OpenAI + + api_key = "test-edenai-key" + raw_client = OpenAI(base_url="https://api.edenai.run/v3", api_key=api_key) + client = instructor.from_openai(raw_client) + assert isinstance(client, instructor.Instructor) + + def test_edenai_env_var_detection(self): + """Test that EDENAI_API_KEY env var can be used.""" + with patch.dict(os.environ, {"EDENAI_API_KEY": "test-env-key"}): + api_key = os.getenv("EDENAI_API_KEY") + assert api_key == "test-env-key" diff --git a/atomic-examples/quickstart/quickstart/4_basic_chatbot_different_providers.py b/atomic-examples/quickstart/quickstart/4_basic_chatbot_different_providers.py index 7b279807..7f8d10ed 100644 --- a/atomic-examples/quickstart/quickstart/4_basic_chatbot_different_providers.py +++ b/atomic-examples/quickstart/quickstart/4_basic_chatbot_different_providers.py @@ -82,6 +82,14 @@ def setup_client(provider): model = "MiniMax-M3" model_api_parameters = {"max_tokens": 2048} assistant_role = "assistant" + elif provider == "8" or provider == "edenai": + from openai import OpenAI as EdenAIClient + + api_key = os.getenv("EDENAI_API_KEY") + client = instructor.from_openai(EdenAIClient(base_url="https://api.edenai.run/v3", api_key=api_key)) + model = "openai/gpt-4o-mini" + model_api_parameters = {"max_tokens": 2048} + assistant_role = "assistant" else: raise ValueError(f"Unsupported provider: {provider}") @@ -89,7 +97,7 @@ def setup_client(provider): # Prompt the user to choose a provider from one in the list below. -providers_list = ["openai", "anthropic", "groq", "ollama", "gemini", "openrouter", "minimax"] +providers_list = ["openai", "anthropic", "groq", "ollama", "gemini", "openrouter", "minimax", "edenai"] y = "bold yellow" b = "bold blue" g = "bold green" From 723225a0c2bdf7515231447b2cb23dc6350d8d91 Mon Sep 17 00:00:00 2001 From: Kenny Vaneetvelde Date: Wed, 22 Jul 2026 09:30:21 +0200 Subject: [PATCH 2/4] Revise API compatibility details in README Updated compatibility information for APIs supported by Instructor. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ba505fae..d745f1c6 100644 --- a/README.md +++ b/README.md @@ -402,7 +402,7 @@ uv sync --all-packages ## Provider & Model Compatibility -Atomic Agents depends on the [Instructor](https://github.com/jxnl/instructor) package. This means that in all examples where OpenAI is used, any other API supported by Instructor can also be used, such as Ollama, Groq, Mistral, Cohere, Anthropic, Gemini, [MiniMax](https://www.minimax.io/), [Eden AI](https://www.edenai.co/), and more. For a complete list, please refer to the Instructor documentation on its [GitHub page](https://github.com/jxnl/instructor). +Atomic Agents depends on the [Instructor](https://github.com/jxnl/instructor) package. This means that in all examples where OpenAI is used, any other API supported by Instructor can also be used, such as Ollama, Groq, Mistral, Cohere, Anthropic, Gemini, OpenAI and any OpenAI-compatible API such as OpenRouter, MiniMax, EdenAI, and more. For a complete list, please refer to the Instructor documentation on its [GitHub page](https://github.com/jxnl/instructor). ## Support From 1f223c7547adf009dcbb3326dae8dbec70e4d28b Mon Sep 17 00:00:00 2001 From: Kenny Vaneetvelde Date: Wed, 22 Jul 2026 09:31:15 +0200 Subject: [PATCH 3/4] Delete atomic-agents/tests/agents/test_edenai_integration.py --- .../tests/agents/test_edenai_integration.py | 79 ------------------- 1 file changed, 79 deletions(-) delete mode 100644 atomic-agents/tests/agents/test_edenai_integration.py diff --git a/atomic-agents/tests/agents/test_edenai_integration.py b/atomic-agents/tests/agents/test_edenai_integration.py deleted file mode 100644 index 69992767..00000000 --- a/atomic-agents/tests/agents/test_edenai_integration.py +++ /dev/null @@ -1,79 +0,0 @@ -"""Integration tests for Eden AI provider with Atomic Agents. - -These tests require a valid EDENAI_API_KEY environment variable. -Run with: pytest -m integration tests/agents/test_edenai_integration.py -""" - -import os -import pytest -import instructor -from pydantic import Field -from atomic_agents import ( - AtomicAgent, - AgentConfig, - BasicChatInputSchema, - BasicChatOutputSchema, - BaseIOSchema, -) - -pytestmark = pytest.mark.skipif( - not os.getenv("EDENAI_API_KEY"), - reason="EDENAI_API_KEY not set", -) - - -def _make_edenai_agent(model="openai/gpt-4o-mini", **agent_kwargs): - """Helper to create an Eden AI-backed agent.""" - from openai import OpenAI - - raw = OpenAI( - base_url="https://api.edenai.run/v3", - api_key=os.environ["EDENAI_API_KEY"], - ) - client = instructor.from_openai(raw) - config = AgentConfig(client=client, model=model, **agent_kwargs) - return AtomicAgent[BasicChatInputSchema, BasicChatOutputSchema](config) - - -@pytest.mark.integration -class TestEdenAILiveChat: - """Live integration tests against Eden AI API.""" - - def test_basic_chat(self): - """Test a basic chat completion with Eden AI.""" - agent = _make_edenai_agent() - response = agent.run(BasicChatInputSchema(chat_message="Say hello in one word.")) - assert response.chat_message - assert len(response.chat_message) > 0 - - def test_multi_turn_conversation(self): - """Test multi-turn conversation with Eden AI.""" - agent = _make_edenai_agent() - r1 = agent.run(BasicChatInputSchema(chat_message="Remember the number 42.")) - assert r1.chat_message # first response should be non-empty - r2 = agent.run(BasicChatInputSchema(chat_message="What number did I ask you to remember?")) - assert r2.chat_message - # The model should recall "42" from the conversation history - assert "42" in r2.chat_message - - def test_custom_output_schema(self): - """Test structured output with a custom schema via Eden AI.""" - from openai import OpenAI - - class AnalysisOutput(BaseIOSchema): - """Analysis output schema.""" - - sentiment: str = Field(..., description="One of: positive, negative, neutral") - confidence: float = Field(..., description="Confidence score between 0 and 1") - - raw = OpenAI( - base_url="https://api.edenai.run/v3", - api_key=os.environ["EDENAI_API_KEY"], - ) - client = instructor.from_openai(raw) - config = AgentConfig(client=client, model="openai/gpt-4o-mini") - agent = AtomicAgent[BasicChatInputSchema, AnalysisOutput](config) - - response = agent.run(BasicChatInputSchema(chat_message="I love this product, it's amazing!")) - assert response.sentiment in ("positive", "negative", "neutral") - assert 0 <= response.confidence <= 1 From 34fae521dfd32d1f9ceb8a5e747d80c4dd13e3ff Mon Sep 17 00:00:00 2001 From: Kenny Vaneetvelde Date: Wed, 22 Jul 2026 09:31:43 +0200 Subject: [PATCH 4/4] Delete atomic-agents/tests/agents/test_edenai_provider.py --- .../tests/agents/test_edenai_provider.py | 171 ------------------ 1 file changed, 171 deletions(-) delete mode 100644 atomic-agents/tests/agents/test_edenai_provider.py diff --git a/atomic-agents/tests/agents/test_edenai_provider.py b/atomic-agents/tests/agents/test_edenai_provider.py deleted file mode 100644 index 3130421c..00000000 --- a/atomic-agents/tests/agents/test_edenai_provider.py +++ /dev/null @@ -1,171 +0,0 @@ -"""Unit tests for Eden AI provider integration with Atomic Agents.""" - -import os -import pytest -from unittest.mock import Mock, patch -import instructor -from atomic_agents import ( - AtomicAgent, - AgentConfig, - BasicChatInputSchema, - BasicChatOutputSchema, -) -from atomic_agents.context import SystemPromptGenerator - - -def _create_edenai_client(api_key="test-key"): - """Create an Eden AI client via OpenAI-compatible interface.""" - from openai import OpenAI - - return instructor.from_openai(OpenAI(base_url="https://api.edenai.run/v3", api_key=api_key)) - - -class TestEdenAIClientSetup: - """Tests for Eden AI client initialization.""" - - def test_edenai_client_creation(self): - """Test that Eden AI client can be created with correct base_url.""" - from openai import OpenAI - - raw_client = OpenAI(base_url="https://api.edenai.run/v3", api_key="test-key") - assert raw_client.base_url == "https://api.edenai.run/v3/" - - def test_edenai_instructor_wrapping(self): - """Test that Eden AI client can be wrapped with instructor.""" - client = _create_edenai_client() - assert isinstance(client, instructor.Instructor) - - def test_edenai_agent_config(self): - """Test that AgentConfig accepts Eden AI client and model.""" - client = _create_edenai_client() - config = AgentConfig( - client=client, - model="openai/gpt-4o-mini", - ) - assert config.model == "openai/gpt-4o-mini" - assert config.assistant_role == "assistant" - - def test_edenai_agent_initialization(self): - """Test that AtomicAgent can be initialized with Eden AI config.""" - client = _create_edenai_client() - config = AgentConfig( - client=client, - model="openai/gpt-4o-mini", - ) - agent = AtomicAgent[BasicChatInputSchema, BasicChatOutputSchema](config) - assert agent.model == "openai/gpt-4o-mini" - assert agent.assistant_role == "assistant" - - def test_edenai_vendor_prefixed_model(self): - """Test that a different vendor-prefixed Eden AI model id works.""" - client = _create_edenai_client() - config = AgentConfig( - client=client, - model="anthropic/claude-haiku-4-5", - ) - agent = AtomicAgent[BasicChatInputSchema, BasicChatOutputSchema](config) - assert agent.model == "anthropic/claude-haiku-4-5" - - -class TestEdenAIAgentBehavior: - """Tests for agent behavior with Eden AI provider.""" - - @pytest.fixture - def mock_edenai_instructor(self): - mock = Mock(spec=instructor.Instructor) - mock.chat = Mock() - mock.chat.completions = Mock() - mock.chat.completions.create = Mock(return_value=BasicChatOutputSchema(chat_message="Eden AI response")) - mock_response = BasicChatOutputSchema(chat_message="Eden AI response") - mock_iter = Mock() - mock_iter.__iter__ = Mock(return_value=iter([mock_response])) - mock.chat.completions.create_partial.return_value = mock_iter - return mock - - @pytest.fixture - def edenai_agent(self, mock_edenai_instructor): - config = AgentConfig( - client=mock_edenai_instructor, - model="openai/gpt-4o-mini", - ) - return AtomicAgent[BasicChatInputSchema, BasicChatOutputSchema](config) - - def test_run_with_edenai(self, edenai_agent, mock_edenai_instructor): - """Test that agent.run works with Eden AI mock client.""" - user_input = BasicChatInputSchema(chat_message="Hello from Eden AI test") - response = edenai_agent.run(user_input) - assert response.chat_message == "Eden AI response" - mock_edenai_instructor.chat.completions.create.assert_called_once() - - def test_run_passes_correct_model(self, edenai_agent, mock_edenai_instructor): - """Test that the correct model name is passed to the API.""" - user_input = BasicChatInputSchema(chat_message="Test") - edenai_agent.run(user_input) - call_kwargs = mock_edenai_instructor.chat.completions.create.call_args - assert call_kwargs.kwargs["model"] == "openai/gpt-4o-mini" - - def test_run_stream_with_edenai(self, edenai_agent): - """Test that streaming works with Eden AI mock client.""" - user_input = BasicChatInputSchema(chat_message="Stream test") - responses = list(edenai_agent.run_stream(user_input)) - assert len(responses) == 1 - assert responses[0].chat_message == "Eden AI response" - - def test_history_tracking_with_edenai(self, edenai_agent): - """Test that chat history is properly tracked.""" - user_input = BasicChatInputSchema(chat_message="First message") - edenai_agent.run(user_input) - history = edenai_agent.history.get_history() - assert len(history) == 2 # user + assistant - - def test_system_prompt_with_edenai(self, mock_edenai_instructor): - """Test that system prompt works correctly with Eden AI.""" - spg = SystemPromptGenerator( - background=["You are a helpful Eden AI-powered assistant."], - ) - config = AgentConfig( - client=mock_edenai_instructor, - model="openai/gpt-4o-mini", - system_prompt_generator=spg, - ) - agent = AtomicAgent[BasicChatInputSchema, BasicChatOutputSchema](config) - prompt = agent.system_prompt_generator.generate_prompt() - assert "Eden AI" in prompt - - def test_model_api_parameters_with_edenai(self, mock_edenai_instructor): - """Test that custom API parameters are passed through.""" - config = AgentConfig( - client=mock_edenai_instructor, - model="openai/gpt-4o-mini", - model_api_parameters={"temperature": 0.7, "max_tokens": 1024}, - ) - agent = AtomicAgent[BasicChatInputSchema, BasicChatOutputSchema](config) - assert agent.model_api_parameters["temperature"] == 0.7 - assert agent.model_api_parameters["max_tokens"] == 1024 - - def test_edenai_reset_history(self, edenai_agent): - """Test that history reset works with Eden AI agent.""" - user_input = BasicChatInputSchema(chat_message="Test") - edenai_agent.run(user_input) - edenai_agent.reset_history() - history = edenai_agent.history.get_history() - assert len(history) == 0 - - -class TestEdenAIProviderSetup: - """Tests for the provider setup function from the quickstart example.""" - - def test_setup_client_edenai_pattern(self): - """Test the Eden AI client setup pattern used by the quickstart example.""" - from openai import OpenAI - - api_key = "test-edenai-key" - raw_client = OpenAI(base_url="https://api.edenai.run/v3", api_key=api_key) - client = instructor.from_openai(raw_client) - assert isinstance(client, instructor.Instructor) - - def test_edenai_env_var_detection(self): - """Test that EDENAI_API_KEY env var can be used.""" - with patch.dict(os.environ, {"EDENAI_API_KEY": "test-env-key"}): - api_key = os.getenv("EDENAI_API_KEY") - assert api_key == "test-env-key"