Simple LLM Memory
Project description
Memento: Simple LLM Memory
Memento is a conversation management API for llm applications. It interfaces with your SQL or NoSQL database of choice to automatically handle conversational histories, assistant configurations, user preferences, and more.
Many important AI application features are supported, such as Retrieval Augmented Generation (RAG), function/tool calling and streaming, with full async support and LLM provider agnosticism.
Memento uses SQLAlchemy and Alembic under the hood to interact with SQL databases, so any database that is supported by these libraries (PostgreSQL, MySQL, SQLite, CosmoDB, etc.) is also supported by Memento. For NoSQL databasses, Memento currently used Beanie (and Bunnet) to provide suppport for MongoDB and CosmoDB.
Getting Started
The easiest way install Memento is by running pip install 'memento-llm[all]'
in your terminal.
Getting Started
With Memento, you no longer have to worry about setting up message storage logic in your application, here is how I can be integrated into your code:
from openai import OpenAI
from memento import Memento
client = OpenAI()
### Stores message history in-memory.
memory = Memento()
@memory ### Memento provides a decorator for your LLM generation function.
def generate():
return client.chat.completions.create(
model="gpt-3.5-turbo",
# messages=[ ### No longer worry about the message parameter.
# {"role": "user", "content": "Extract Jason is 25 years old"},
# ],
)
response_1 = generate("My name is Anibal")
print(response_1) # Output: Hello Anibal!
response_2 = generate("What´s my name?")
print(response_2) # Output: Your name is Anibal.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for memento_llm-0.1.8.8.dev0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5297993667eb59e09ff27813fde413071bba93b4c85b7e3e708f1dc0c0829b4b |
|
MD5 | f727425352ee8d78b58f28cdfb9d5890 |
|
BLAKE2b-256 | ca5b6b9e3b4862c1ee6136094bb7bd3a686885ad936e381f85ed2ef6443bc125 |