# 1. Install the Python SDK
# pip install jeanmemory openai
# 2. Get context before calling your LLM
import os
from jeanmemory import JeanMemoryClient
from openai import OpenAI
jean = JeanMemoryClient(api_key=os.environ["JEAN_API_KEY"])
openai = OpenAI(api_key=os.environ["OPENAI_API_KEY"])
context = jean.get_context(
user_token="USER_TOKEN_FROM_FRONTEND",
message="What was our last conversation about?"
).text
prompt = f"Context: {context}\n\nUser question: What was our last conversation about?"
# 3. Use the context in your LLM call
completion = openai.chat.completions.create(
model="gpt-4-turbo",
messages=[{"role": "user", "content": prompt}]
)