feat: OpenRouter engine, with OPENROUTER_API_KEY env var

This commit is contained in:
Shivering Ocelot committed 2026-05-30 06:06:34 -05:00
1 parent 4e15b44d39
commit 50cd677515
7 files changed
+58 -119

No files matched your search

+4 -4
View File
@@ -3,7 +3,7 @@ import json
import inspect
from string import Template
from inference import LlamaMessage, replicate_llama_completion
from inference import LlamaMessage, replicate_completion
from agent import Agent, AgentField
# Info and defaults
@@ -137,7 +137,7 @@ class CharacterAgent(Agent):
LlamaMessage("system", self.system_prompt),
LlamaMessage("user", content)
]
response = await replicate_llama_completion(self.app, messages)
response = await replicate_completion(self.app, messages)
return response
async def received_message(self, message):
@@ -201,7 +201,7 @@ class CharacterAgent(Agent):
# TODO: Inject system prompt before the last user message
# If not any user message, combine with first system prompt
controller_response = await replicate_llama_completion(self.app, llama_messages)
controller_response = await replicate_completion(self.app, llama_messages)
if self.debug:
await self.app.send_chat_message(
@@ -282,7 +282,7 @@ class CharacterAgent(Agent):
memories = [it.document for it in query_result]
print("rerank memories")
rerank_response = await replicate_llama_completion(self.app, [
rerank_response = await replicate_completion(self.app, [
LlamaMessage("system", rerank_system_prompt),
LlamaMessage("user", rerank_prompt_template.substitute(
conversation=chat_history,