Closed pleabargain closed 1 month ago
add the following to utils/providers.py:
class OpenRouterProvider(LLMProvider):
def get_client_config(self) -> Dict[str, str]:
return {
"api_key": os.environ.get("OPENROUTER_API_KEY"),
"base_url": "https://openrouter.ai/api/v1",
}
def get_provider_name(self) -> str:
return "openrouter"
PROVIDER_MAP = {
"openai": OpenAIProvider(),
"together": TogetherAIProvider(),
"ollama": OllamaProvider(),
"groq": GroqProvider(),
"anthropic": AnthropicProvider(),
"openrouter": OpenRouterProvider(),
# "google": GoogleProvider(),
-You can test it like:
from sentient import sentient
import asyncio
import nest_asyncio
nest_asyncio.apply()
custom_instructions = """
1. Directly go to youtube.com rather than searching for the song on google!
"""
#use with openrouter
result = asyncio.run(sentient.invoke(
goal="play shape of you on youtube",
task_instructions=custom_instructions,
provider="openrouter",
model="openai/gpt-4o-2024-08-06"))
which model are you trying to use using open router?
pls feel free to open this if you face any issue!
provide support for https://openrouter.ai/