-
-
Notifications
You must be signed in to change notification settings - Fork 984
Expand file tree
/
Copy pathbase_llm.py
More file actions
32 lines (26 loc) · 798 Bytes
/
Copy pathbase_llm.py
File metadata and controls
32 lines (26 loc) · 798 Bytes
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
from swarms.structs.agent import Agent
class BaseLLM:
def __init__(
self,
temperature: float = 0.0,
max_tokens: int = 1000,
top_p: float = 1.0,
frequency_penalty: float = 0.0,
presence_penalty: float = 0.0,
stop: list[str] = [],
):
self.temperature = temperature
self.max_tokens = max_tokens
self.top_p = top_p
self.frequency_penalty = frequency_penalty
self.presence_penalty = presence_penalty
self.stop = stop
def run(self, task: str, *args, **kwargs):
pass
def __call__(self, task: str, *args, **kwargs):
return self.run(task, *args, **kwargs)
agent = Agent(
llm=BaseLLM(),
agent_name="BaseLLM",
system_prompt="You are a base LLM agent.",
)