mirror of
https://github.com/MervinPraison/PraisonAI.git
synced 2026-11-07 12:47:55 -10:00
(a) The code generator advertised a hardcoded memory capability list that still named removed backends (redis/postgres/qdrant), so generated agent code raised before the API. Derive supports_presets/supports_url_schemes from the live resolver registries (MEMORY_PRESETS, MEMORY_URL_SCHEMES) so the generator can never teach a dead value. Update the four shipped examples that crashed at the config boundary to use shipped backends. (b) runtime= stored any string verbatim, silently dropping nine of twelve capabilities on a typo. Normalise through canonical_runtime_name() so spelling variants (NATIVE, " native ", Native) all map to the native matrix, and raise on a close typo (nativ -> "Did you mean native?"). A genuinely unknown plugin runtime name is still accepted and falls back to the reduced harness via the runtime registry, not a closed literal. Co-authored-by: MervinPraison <[email protected]>
25 lines
616 B
Python
25 lines
616 B
Python
"""Basic memory example - minimal usage."""
|
|
from praisonaiagents import Agent
|
|
|
|
# Simple enable (uses default file-based memory)
|
|
agent = Agent(
|
|
instructions="You are a helpful assistant with memory.",
|
|
memory=True,
|
|
)
|
|
|
|
# With preset
|
|
agent_sqlite = Agent(
|
|
instructions="You are a helpful assistant.",
|
|
memory="sqlite", # Uses sqlite preset
|
|
)
|
|
|
|
# With URL
|
|
agent_mongo = Agent(
|
|
instructions="You are a helpful assistant.",
|
|
memory="mongodb://localhost/mydb", # URL auto-detected
|
|
)
|
|
|
|
if __name__ == "__main__":
|
|
response = agent.chat("Remember that my favorite color is blue.")
|
|
print(response)
|