mirror of
https://github.com/kennethreitz/simplemind.git
synced 2026-06-05 22:50:18 +00:00
fuck yes
This commit is contained in:
@@ -13,6 +13,9 @@ class SMBaseModel(BaseModel):
|
||||
def __str__(self):
|
||||
return f"<{self.__class__.__name__} {self.model_dump_json()}>"
|
||||
|
||||
def __repr__(self):
|
||||
return str(self)
|
||||
|
||||
|
||||
class Message(SMBaseModel):
|
||||
role: str
|
||||
@@ -51,4 +54,7 @@ class Conversation(SMBaseModel):
|
||||
) -> Message:
|
||||
"""Send the conversation to the LLM."""
|
||||
provider = find_provider(llm_provider or self.llm_provider)
|
||||
return provider.send_conversation(self)
|
||||
response = provider.send_conversation(self)
|
||||
|
||||
self.add_message(role="assistant", text=response.text, meta=response.meta)
|
||||
return response
|
||||
|
||||
@@ -2,6 +2,7 @@ import simplemind as sm
|
||||
|
||||
conversation = sm.create_conversation()
|
||||
conversation.add_message(role="user", text="Hello, how are you? Do you like poetry?")
|
||||
r = conversation.send(llm_provider="anthropic")
|
||||
r = conversation.send(llm_provider="openai")
|
||||
|
||||
print(r.text)
|
||||
print(conversation.messages)
|
||||
|
||||
Reference in New Issue
Block a user