28 lines
645 B
Python
28 lines
645 B
Python
from dotenv import load_dotenv
|
|
|
|
from modaic import PrecompiledAgent, PrecompiledConfig
|
|
import weaviate
|
|
|
|
load_dotenv()
|
|
|
|
class EchoConfig(PrecompiledConfig):
|
|
lm: str = "gpt-4o"
|
|
|
|
class EchoAgent(PrecompiledAgent):
|
|
config: EchoConfig
|
|
|
|
def __init__(self, config: EchoConfig, **kwargs):
|
|
super().__init__(config, **kwargs)
|
|
|
|
def forward(self, text: str) -> str:
|
|
return f"Echo: {text}"
|
|
|
|
|
|
if __name__ == "__main__":
|
|
agent = EchoAgent(EchoConfig())
|
|
print(agent(text="hello"))
|
|
agent.push_to_hub(
|
|
"connor/CrossEncoderRanker",
|
|
with_code=True,
|
|
commit_message="Fix init to accept kwargs"
|
|
) |