My first commit
This commit is contained in:
28
hello.py
Normal file
28
hello.py
Normal file
@@ -0,0 +1,28 @@
|
||||
from modaic import PrecompiledAgent, PrecompiledConfig
|
||||
from dotenv import load_dotenv
|
||||
|
||||
load_dotenv()
|
||||
|
||||
class EchoConfig(PrecompiledConfig):
|
||||
lm: str = "gpt-4o"
|
||||
|
||||
class EchoAgent(PrecompiledAgent):
|
||||
config: EchoConfig
|
||||
|
||||
def __init__(self, config: EchoConfig):
|
||||
super().__init__(config)
|
||||
|
||||
def forward(self, text: str) -> str:
|
||||
return f"Echo: {text}"
|
||||
|
||||
|
||||
# This block only runs when you execute the script directly,
|
||||
# NOT when modaic imports the module
|
||||
if __name__ == "__main__":
|
||||
agent = EchoAgent(EchoConfig())
|
||||
print(agent(text="hello"))
|
||||
agent.push_to_hub(
|
||||
"connor/CrossEncoderRanker",
|
||||
with_code=True,
|
||||
commit_message="My first commit"
|
||||
)
|
||||
Reference in New Issue
Block a user