Fix broken merge

This commit is contained in:
Cyber MacGeddon 2025-09-01 11:58:45 +01:00
parent f62de4e644
commit a415aac170

View file

@ -188,22 +188,12 @@ class TestVertexAIProcessorSimple(IsolatedAsyncioTestCase):
assert result.out_token == 0 assert result.out_token == 0
assert result.model == 'gemini-2.0-flash-001' assert result.model == 'gemini-2.0-flash-001'
<<<<<<< HEAD
=======
@patch('trustgraph.model.text_completion.vertexai.llm.google.auth.default') @patch('trustgraph.model.text_completion.vertexai.llm.google.auth.default')
>>>>>>> release/v1.2
@patch('trustgraph.model.text_completion.vertexai.llm.service_account') @patch('trustgraph.model.text_completion.vertexai.llm.service_account')
@patch('trustgraph.model.text_completion.vertexai.llm.vertexai') @patch('trustgraph.model.text_completion.vertexai.llm.vertexai')
@patch('trustgraph.model.text_completion.vertexai.llm.GenerativeModel') @patch('trustgraph.model.text_completion.vertexai.llm.GenerativeModel')
@patch('trustgraph.base.async_processor.AsyncProcessor.__init__') @patch('trustgraph.base.async_processor.AsyncProcessor.__init__')
@patch('trustgraph.base.llm_service.LlmService.__init__') @patch('trustgraph.base.llm_service.LlmService.__init__')
<<<<<<< HEAD
async def test_processor_initialization_without_private_key(self, mock_llm_init, mock_async_init, mock_generative_model, mock_vertexai, mock_service_account):
"""Test processor initialization without private key (should fail)"""
# Arrange
mock_async_init.return_value = None
mock_llm_init.return_value = None
=======
async def test_processor_initialization_without_private_key(self, mock_llm_init, mock_async_init, mock_generative_model, mock_vertexai, mock_service_account, mock_auth_default): async def test_processor_initialization_without_private_key(self, mock_llm_init, mock_async_init, mock_generative_model, mock_vertexai, mock_service_account, mock_auth_default):
"""Test processor initialization without private key (uses default credentials)""" """Test processor initialization without private key (uses default credentials)"""
# Arrange # Arrange
@ -217,7 +207,6 @@ class TestVertexAIProcessorSimple(IsolatedAsyncioTestCase):
# Mock GenerativeModel # Mock GenerativeModel
mock_model = MagicMock() mock_model = MagicMock()
mock_generative_model.return_value = mock_model mock_generative_model.return_value = mock_model
>>>>>>> release/v1.2
config = { config = {
'region': 'us-central1', 'region': 'us-central1',
@ -230,11 +219,6 @@ class TestVertexAIProcessorSimple(IsolatedAsyncioTestCase):
'id': 'test-processor' 'id': 'test-processor'
} }
<<<<<<< HEAD
# Act & Assert
with pytest.raises(RuntimeError, match="Private key file not specified"):
processor = Processor(**config)
=======
# Act # Act
processor = Processor(**config) processor = Processor(**config)
@ -245,7 +229,6 @@ class TestVertexAIProcessorSimple(IsolatedAsyncioTestCase):
location='us-central1', location='us-central1',
project='test-project-123' project='test-project-123'
) )
>>>>>>> release/v1.2
@patch('trustgraph.model.text_completion.vertexai.llm.service_account') @patch('trustgraph.model.text_completion.vertexai.llm.service_account')
@patch('trustgraph.model.text_completion.vertexai.llm.vertexai') @patch('trustgraph.model.text_completion.vertexai.llm.vertexai')
@ -325,20 +308,11 @@ class TestVertexAIProcessorSimple(IsolatedAsyncioTestCase):
# Verify service account was called with custom key # Verify service account was called with custom key
mock_service_account.Credentials.from_service_account_file.assert_called_once_with('custom-key.json') mock_service_account.Credentials.from_service_account_file.assert_called_once_with('custom-key.json')
<<<<<<< HEAD
# Verify that parameters dict has the correct values (this is accessible)
assert processor.parameters["temperature"] == 0.7
assert processor.parameters["max_output_tokens"] == 4096
assert processor.parameters["top_p"] == 1.0
assert processor.parameters["top_k"] == 32
assert processor.parameters["candidate_count"] == 1
=======
# Verify that api_params dict has the correct values (this is accessible) # Verify that api_params dict has the correct values (this is accessible)
assert processor.api_params["temperature"] == 0.7 assert processor.api_params["temperature"] == 0.7
assert processor.api_params["max_output_tokens"] == 4096 assert processor.api_params["max_output_tokens"] == 4096
assert processor.api_params["top_p"] == 1.0 assert processor.api_params["top_p"] == 1.0
assert processor.api_params["top_k"] == 32 assert processor.api_params["top_k"] == 32
>>>>>>> release/v1.2
@patch('trustgraph.model.text_completion.vertexai.llm.service_account') @patch('trustgraph.model.text_completion.vertexai.llm.service_account')
@patch('trustgraph.model.text_completion.vertexai.llm.vertexai') @patch('trustgraph.model.text_completion.vertexai.llm.vertexai')
@ -433,8 +407,6 @@ class TestVertexAIProcessorSimple(IsolatedAsyncioTestCase):
# The prompt should be "" + "\n\n" + "" = "\n\n" # The prompt should be "" + "\n\n" + "" = "\n\n"
assert call_args[0][0] == "\n\n" assert call_args[0][0] == "\n\n"
<<<<<<< HEAD
=======
@patch('trustgraph.model.text_completion.vertexai.llm.AnthropicVertex') @patch('trustgraph.model.text_completion.vertexai.llm.AnthropicVertex')
@patch('trustgraph.model.text_completion.vertexai.llm.service_account') @patch('trustgraph.model.text_completion.vertexai.llm.service_account')
@patch('trustgraph.base.async_processor.AsyncProcessor.__init__') @patch('trustgraph.base.async_processor.AsyncProcessor.__init__')
@ -487,7 +459,6 @@ class TestVertexAIProcessorSimple(IsolatedAsyncioTestCase):
assert processor.api_params["top_p"] == 1.0 assert processor.api_params["top_p"] == 1.0
assert processor.api_params["top_k"] == 32 assert processor.api_params["top_k"] == 32
>>>>>>> release/v1.2
if __name__ == '__main__': if __name__ == '__main__':
pytest.main([__file__]) pytest.main([__file__])