@@ -110,11 +110,31 @@ async def main() -> None:
110110 },
111111 },
112112 }
113+ elif API_HOST == "github" :
114+ # Use GitHub Models for both Mem0's LLM and embedder
115+ mem0_config = {
116+ "llm" : {
117+ "provider" : "openai" ,
118+ "config" : {
119+ "model" : os .getenv ("GITHUB_MODEL" , "openai/gpt-4.1-mini" ),
120+ "api_key" : os .environ ["GITHUB_TOKEN" ],
121+ "openai_base_url" : "https://models.github.ai/inference" ,
122+ },
123+ },
124+ "embedder" : {
125+ "provider" : "openai" ,
126+ "config" : {
127+ "model" : "openai/text-embedding-3-small" ,
128+ "api_key" : os .environ ["GITHUB_TOKEN" ],
129+ "openai_base_url" : "https://models.github.ai/inference" ,
130+ },
131+ },
132+ }
113133 elif os .getenv ("OPENAI_API_KEY" ):
114134 mem0_config = {} # Mem0 defaults to OpenAI via OPENAI_API_KEY
115135 else :
116- print ( "[red] Mem0 OSS requires an LLM for memory extraction.[/red] " )
117- print ( "[red] Set API_HOST=azure (with Azure OpenAI) or set OPENAI_API_KEY.[/red] " )
136+ logger . error ( " Mem0 OSS requires an LLM for memory extraction." )
137+ logger . error ( " Set API_HOST=azure (with Azure OpenAI) or set OPENAI_API_KEY." )
118138 return
119139
120140 mem0_client = await AsyncMemory .from_config (mem0_config )
@@ -132,27 +152,25 @@ async def main() -> None:
132152 )
133153
134154 # Step 1: Teach the agent user preferences
135- print ("\n [dim ]--- Step 1: Teaching preferences ---[/dim ]" )
155+ print ("\n [bold ]--- Step 1: Teaching preferences ---[/bold ]" )
136156 print ("[blue]User:[/blue] Remember that my favorite city is Tokyo and I prefer Celsius." )
137157 response = await agent .run ("Remember that my favorite city is Tokyo and I prefer Celsius." )
138158 print (f"[green]Agent:[/green] { response .text } " )
139159
140160 # Step 2: Start a new session — Mem0 should inject remembered facts
141- print ("\n [dim ]--- Step 2: New session — recalling preferences ---[/dim ]" )
161+ print ("\n [bold ]--- Step 2: New session — recalling preferences ---[/bold ]" )
142162 print ("[blue]User:[/blue] What's my favorite city?" )
143163 response = await agent .run ("What's my favorite city?" )
144164 print (f"[green]Agent:[/green] { response .text } " )
145- print ("[dim]Note: Mem0 extracted and stored facts, then injected them into the new session.[/dim]" )
146165
147166 # Step 3: Use a tool, demonstrating memory with tool outputs
148- print ("\n [dim ]--- Step 3: Tool use with memory ---[/dim ]" )
167+ print ("\n [bold ]--- Step 3: Tool use with memory ---[/bold ]" )
149168 print ("[blue]User:[/blue] What's the weather in my favorite city?" )
150169 response = await agent .run ("What's the weather in my favorite city?" )
151170 print (f"[green]Agent:[/green] { response .text } " )
152- print ("[dim]Note: The agent used Mem0 memory to know which city to check.[/dim]" )
153171
154172 # Show what Mem0 has stored
155- print ("\n [dim ]--- Extracted memories ---[/dim ]" )
173+ print ("\n [bold ]--- Extracted memories ---[/bold ]" )
156174 memories = await mem0_client .get_all (user_id = user_id )
157175 for mem in memories .get ("results" , []):
158176 print (f" [cyan]•[/cyan] { mem .get ('memory' , '' )} " )
0 commit comments