banner(“Half 5 — Streaming”)
mem.attribution(entity_id=”[email protected]”, process_id=”personal-assistant”)
stream = consumer.chat.completions.create(
mannequin=MODEL,
messages=[{“role”: “user”,
“content”: “In two sentences, what do you remember about me?”}],
stream=True,
)
print(“[stream] “, finish=””)
for chunk in stream:
d = chunk.decisions[0].delta.content material
if d: print(d, finish=””, flush=True)
print(); time.sleep(WRITE_DELAY)
banner(“Half 6 — Async LLM calls”)
async def async_demo():
r = await async_client.chat.completions.create(
mannequin=MODEL,
messages=[{“role”: “user”,
“content”: “What dietary restriction do I have? (asked async)”}],
)
return r.decisions[0].message.content material
print(“[async]”, asyncio.run(async_demo()))
banner(“Half 7 — Mini help agent throughout a number of periods”)
def help(user_id, immediate):
mem.attribution(entity_id=user_id, process_id=”support-bot”)
return ask(immediate, system=(
“You’re a calm, useful buyer help agent. ”
“Use what you bear in mind concerning the person. If you do not know, say so.”
))
USER = “[email protected]”
mem.attribution(entity_id=USER, process_id=”support-bot”)
mem.new_session()
print(“[support T1]”, help(USER,
“Hello! I am Charlie, on the Professional plan. Electronic mail: [email protected]. ”
“Billing query for subsequent month.”))
time.sleep(WRITE_DELAY)
mem.new_session()
print(“[support T2]”, help(USER,
“Hey, me once more. What plan am I on and what’s my electronic mail of file?”))
banner(“Achieved. Open https://app.memorilabs.ai to examine recollections, ”
“or use Memori BYODB to level at your personal Postgres.”)
Trending
- Acer’s $350 OLED is the gaming monitor deal I have been ready for
- TikTok is launching an ad-free model within the UK
- The Breville Bambino Plus is my cheat code to barista-quality espresso at residence, and it is randomly on sale proper now
- AI Is Watching Your Each Transfer on the Street. These State Legal guidelines Are Pushing Again
- Meta Discontinues Finish-to-Finish Encryption For Instagram Direct Messages
- A Coding Implementation to Construct Agent-Native Reminiscence Infrastructure with Memori for Persistent Multi-Person and Multi-Session LLM Purposes
- Iran vows to combat on, oil costs surge as Trump rejects peace proposal as “unacceptable”
- The brand new Fitbit Air gives an intriguing different to the Pixel Watch, however is Google’s Whoop competitor compelling sufficient for you?

