-
Notifications
You must be signed in to change notification settings - Fork 428
Expand file tree
/
Copy pathagent.py
More file actions
40 lines (36 loc) · 1.29 KB
/
agent.py
File metadata and controls
40 lines (36 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import factory
from backend.config.tools import Tool
from backend.database_models.agent import Agent
from backend.tests.unit.factories.base import BaseFactory
from backend.tests.unit.factories.user import UserFactory
class AgentFactory(BaseFactory):
class Meta:
model = Agent
user = factory.SubFactory(UserFactory)
user_id = factory.SelfAttribute("user.id")
organization_id = None
deployment_id = None
model_id = None
name = factory.Faker("sentence")
description = factory.Faker("sentence")
preamble = factory.Faker("sentence")
version = factory.Faker("random_int")
temperature = factory.Faker("pyfloat", min_value=0.0, max_value=1.0)
created_at = factory.Faker("date_time")
updated_at = factory.Faker("date_time")
tools = factory.List(
[
factory.Faker(
"random_element",
elements=[
Tool.Wiki_Retriever_LangChain.value.ID,
Tool.Search_File.value.ID,
Tool.Read_File.value.ID,
Tool.Python_Interpreter.value.ID,
Tool.Calculator.value.ID,
Tool.Tavily_Web_Search.value.ID,
],
)
]
)
is_private = factory.Faker("boolean", chance_of_getting_true=0)