Merge pull request #869 from ascender1729/PulsarConversation
commit
b54c2c9d03
@ -0,0 +1,25 @@
|
||||
from swarms import Agent
|
||||
from swarms.communication.pulsar_struct import PulsarConversation
|
||||
|
||||
# Configure a Pulsar-backed conversation store
|
||||
conversation_store = PulsarConversation(
|
||||
pulsar_host="pulsar://localhost:6650", # adjust to your broker
|
||||
topic="support_conversation",
|
||||
token_count=False,
|
||||
)
|
||||
|
||||
# Create an agent that uses this persistent memory
|
||||
agent = Agent(
|
||||
agent_name="SupportAgent",
|
||||
system_prompt="You are a helpful assistant.",
|
||||
model_name="gpt-4o-mini",
|
||||
long_term_memory=conversation_store,
|
||||
max_loops=1,
|
||||
autosave=False,
|
||||
)
|
||||
|
||||
response = agent.run("What time is check-out?")
|
||||
print(response)
|
||||
|
||||
# View the messages as stored in Pulsar
|
||||
print(conversation_store.get_messages())
|
Loading…
Reference in new issue