fix: improve maintenance and synchronize live conversations
This commit is contained in:
1 parent
bb541bd212
commit
ef86a5d3af
297 files changed
+2983
-1274
No files matched your search
@@ -15,12 +15,9 @@ limitations under the License.
|
||||
"""
|
||||
|
||||
import pytest
|
||||
import sys
|
||||
from unittest.mock import patch, MagicMock, AsyncMock
|
||||
from agno.agent import Agent
|
||||
from app.utils import agno_utils
|
||||
from fastapi import HTTPException
|
||||
import importlib
|
||||
|
||||
|
||||
class TestCreateModel:
|
||||
@@ -179,9 +176,17 @@ class TestCreateModel:
|
||||
|
||||
def test_create_model_google(self):
|
||||
"""Test creating Google Gemini model"""
|
||||
with patch("agno.models.google.Gemini") as mock_gemini:
|
||||
mock_model = MagicMock()
|
||||
mock_gemini.return_value = mock_model
|
||||
import sys
|
||||
from types import ModuleType
|
||||
import agno.models
|
||||
|
||||
google_module = ModuleType("agno.models.google")
|
||||
google_module.Gemini = MagicMock()
|
||||
mock_model = MagicMock()
|
||||
google_module.Gemini.return_value = mock_model
|
||||
|
||||
with patch.dict(sys.modules, {"agno.models.google": google_module}), \
|
||||
patch.object(agno.models, "google", google_module, create=True):
|
||||
|
||||
result = agno_utils.create_model(
|
||||
model_type="GOOGLE",
|
||||
@@ -189,12 +194,13 @@ class TestCreateModel:
|
||||
model_name="gemini-pro"
|
||||
)
|
||||
|
||||
mock_gemini.assert_called_once_with(
|
||||
google_module.Gemini.assert_called_once_with(
|
||||
api_key="test-api-key",
|
||||
id="gemini-pro",
|
||||
max_output_tokens=1000 # Gemini's agno model uses max_output_tokens
|
||||
)
|
||||
assert result == mock_model
|
||||
assert result == mock_model
|
||||
|
||||
def test_create_model_googlevertex(self):
|
||||
"""Test creating Google Vertex AI model (should trigger import error)"""
|
||||
@@ -573,4 +579,4 @@ class TestEdgeCases:
|
||||
result = await agno_utils.test_model_api_key("", "", "")
|
||||
|
||||
mock_create_model.assert_called_once_with("", "", "", base_url=None)
|
||||
assert result is True
|
||||
assert result is True
|
||||
@@ -18,7 +18,7 @@ from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
|
||||
from app.agents.guardrail_policy import CANARY_STRINGS, looks_like_scope_refusal
|
||||
from app.agents.guardrail_policy import CANARY_STRINGS
|
||||
from app.utils.guardrail_runtime import (
|
||||
BLOCK_REPLY,
|
||||
LEAK_REPLY,
|
||||
|
||||
@@ -14,7 +14,6 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from unittest.mock import MagicMock
|
||||
from app.utils.response_parser import (
|
||||
GENERIC_ERROR_MESSAGE,
|
||||
|
||||
Reference in new issue
Block a user