26 lines
607 B
Python
26 lines
607 B
Python
from modaic import PrecompiledAgent, PrecompiledConfig
|
|
|
|
from dotenv import load_dotenv
|
|
|
|
load_dotenv()
|
|
|
|
class EchoConfig(PrecompiledConfig):
|
|
lm: str = "gpt-4o"
|
|
|
|
class EchoAgent(PrecompiledAgent):
|
|
config: EchoConfig # ! Important: config must be annotated with the config class
|
|
|
|
def __init__(self, config: EchoConfig):
|
|
super().__init__(config)
|
|
|
|
def forward(self, text: str) -> str:
|
|
return f"Echo: {text}"
|
|
|
|
agent = EchoAgent(EchoConfig())
|
|
print(agent(text="hello"))
|
|
agent.push_to_hub(
|
|
"connor/CrossEncoderRanker",
|
|
with_code=True,
|
|
commit_message="My first commit"
|
|
)
|