Feat: Started to implement llm providers
This commit is contained in:
@@ -17,6 +17,8 @@ from cleveragents.domain.models.core import (
|
||||
Project,
|
||||
ProjectSettings,
|
||||
)
|
||||
from cleveragents.domain.models.aimodelsdatamodels import AIModel, Provider
|
||||
from cleveragents.domain.models.aimodels_custom import CustomAIModel
|
||||
|
||||
|
||||
@given("I have valid project data")
|
||||
@@ -314,3 +316,28 @@ def step_models_have_pydantic_config(context):
|
||||
for model_class in context.imported_models:
|
||||
assert hasattr(model_class, "model_config")
|
||||
assert hasattr(model_class, "model_validate")
|
||||
|
||||
|
||||
@given('I create an "{model_name}" with the following data:')
|
||||
@given('I create a "{model_name}" with the following data:')
|
||||
def create_model(context, model_name):
|
||||
data = {row["name"]: row["value"] for row in context.table}
|
||||
if model_name == "AIModel":
|
||||
context.model = AIModel(**data)
|
||||
elif model_name == "Provider":
|
||||
context.model = Provider(**data)
|
||||
elif model_name == "CustomAIModel":
|
||||
context.model = CustomAIModel(**data)
|
||||
|
||||
|
||||
@then('the "{model_name}" object should have the following attributes:')
|
||||
def verify_model_attributes(context, model_name):
|
||||
for row in context.table:
|
||||
attr_name = row["name"]
|
||||
expected_value = row["value"]
|
||||
actual_value = getattr(context.model, attr_name)
|
||||
if expected_value == "False":
|
||||
expected_value = False
|
||||
assert actual_value == expected_value, (
|
||||
f"Expected {attr_name} to be {expected_value}, but got {actual_value}"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user