Skip to content

Commit 3679c04

Browse files
committed
Update get_llm_profiles() function to use OpenRouter.
1 parent dc6880a commit 3679c04

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

examples/sealos-assistant/main.py

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,27 +37,25 @@
3737

3838

3939
def get_llm_profiles() -> dict:
40-
"""Build LLM profiles from environment variables."""
41-
base_url = os.getenv("OPENAI_BASE_URL", "https://api.openai.com/v1")
42-
api_key = os.getenv("OPENAI_API_KEY")
43-
40+
api_key = os.getenv("OPENROUTER_API_KEY")
4441
if not api_key:
45-
raise ValueError("OPENAI_API_KEY environment variable is required")
42+
raise ValueError("OPENROUTER_API_KEY is required")
4643

4744
return {
4845
"default": {
49-
"provider": "openai",
50-
"base_url": base_url,
46+
"provider": "openrouter",
47+
"client_backend": "httpx",
48+
"base_url": "https://openrouter.ai",
5149
"api_key": api_key,
52-
"chat_model": os.getenv("CHAT_MODEL", "gpt-4o-mini"),
53-
"client_backend": "sdk",
50+
"chat_model": os.getenv("CHAT_MODEL", "anthropic/claude-3.5-sonnet"),
51+
"embed_model": os.getenv("EMBED_MODEL", "openai/text-embedding-3-small"),
5452
},
5553
"embedding": {
56-
"provider": "openai",
57-
"base_url": base_url,
54+
"provider": "openrouter",
55+
"client_backend": "httpx",
56+
"base_url": "https://openrouter.ai",
5857
"api_key": api_key,
59-
"embed_model": os.getenv("EMBED_MODEL", "text-embedding-3-small"),
60-
"client_backend": "sdk",
58+
"embed_model": os.getenv("EMBED_MODEL", "openai/text-embedding-3-small"),
6159
},
6260
}
6361

@@ -283,4 +281,4 @@ async def recall(query: str, limit: int = 5):
283281
port = int(os.getenv("PORT", 8000))
284282

285283
print(f"Starting MemU Assistant on {host}:{port}")
286-
uvicorn.run("main:app", host=host, port=port, reload=True)
284+
uvicorn.run("main:app", host=host, port=port, reload=True)

0 commit comments

Comments
 (0)