Skip to content

Commit

Permalink
remove tests involving serialization of lambdas (#1281)
Browse files Browse the repository at this point in the history
  • Loading branch information
anakin87 authored Jan 9, 2025
1 parent f5c3aee commit 97a2cda
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 39 deletions.
19 changes: 0 additions & 19 deletions integrations/anthropic/tests/test_chat_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,25 +81,6 @@ def test_to_dict_with_parameters(self, monkeypatch):
},
}

def test_to_dict_with_lambda_streaming_callback(self, monkeypatch):
monkeypatch.setenv("ANTHROPIC_API_KEY", "test-api-key")
component = AnthropicChatGenerator(
model="claude-3-5-sonnet-20240620",
streaming_callback=lambda x: x,
generation_kwargs={"max_tokens": 10, "some_test_param": "test-params"},
)
data = component.to_dict()
assert data == {
"type": "haystack_integrations.components.generators.anthropic.chat.chat_generator.AnthropicChatGenerator",
"init_parameters": {
"api_key": {"env_vars": ["ANTHROPIC_API_KEY"], "strict": True, "type": "env_var"},
"model": "claude-3-5-sonnet-20240620",
"streaming_callback": "tests.test_chat_generator.<lambda>",
"generation_kwargs": {"max_tokens": 10, "some_test_param": "test-params"},
"ignore_tools_thinking_messages": True,
},
}

def test_from_dict(self, monkeypatch):
monkeypatch.setenv("ANTHROPIC_API_KEY", "fake-api-key")
data = {
Expand Down
20 changes: 0 additions & 20 deletions integrations/cohere/tests/test_cohere_chat_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,26 +98,6 @@ def test_to_dict_with_parameters(self, monkeypatch):
},
}

def test_to_dict_with_lambda_streaming_callback(self, monkeypatch):
monkeypatch.setenv("COHERE_API_KEY", "test-api-key")
component = CohereChatGenerator(
model="command-r",
streaming_callback=lambda x: x,
api_base_url="test-base-url",
generation_kwargs={"max_tokens": 10, "some_test_param": "test-params"},
)
data = component.to_dict()
assert data == {
"type": "haystack_integrations.components.generators.cohere.chat.chat_generator.CohereChatGenerator",
"init_parameters": {
"model": "command-r",
"api_base_url": "test-base-url",
"api_key": {"env_vars": ["COHERE_API_KEY", "CO_API_KEY"], "strict": True, "type": "env_var"},
"streaming_callback": "tests.test_cohere_chat_generator.<lambda>",
"generation_kwargs": {"max_tokens": 10, "some_test_param": "test-params"},
},
}

def test_from_dict(self, monkeypatch):
monkeypatch.setenv("COHERE_API_KEY", "fake-api-key")
monkeypatch.setenv("CO_API_KEY", "fake-api-key")
Expand Down

0 comments on commit 97a2cda

Please sign in to comment.