Spaces:
Paused
Paused
Upload folder using huggingface_hub (part 2)
Browse files
src/agentscope/model/_openrouter/__init__.py
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from ._model import OpenRouterChatModel
|
| 2 |
+
|
| 3 |
+
__all__ = ["OpenRouterChatModel"]
|
src/agentscope/model/_openrouter/_model.py
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
"""The OpenRouter chat model implementation."""
|
| 3 |
+
from typing import Literal
|
| 4 |
+
|
| 5 |
+
from .._openai_chat import OpenAIChatModel
|
| 6 |
+
from ...credential._openai_compat import OpenRouterCredential
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
class OpenRouterChatModel(OpenAIChatModel):
|
| 10 |
+
"""The OpenRouter chat model."""
|
| 11 |
+
|
| 12 |
+
type: Literal["openrouter_chat"] = "openrouter_chat"
|
| 13 |
+
"""The type of the chat model."""
|
| 14 |
+
|
| 15 |
+
def __init__(
|
| 16 |
+
self,
|
| 17 |
+
credential: OpenRouterCredential,
|
| 18 |
+
model: str,
|
| 19 |
+
**kwargs,
|
| 20 |
+
) -> None:
|
| 21 |
+
"""Initialize the OpenRouter chat model."""
|
| 22 |
+
super().__init__(
|
| 23 |
+
credential=credential,
|
| 24 |
+
model=model,
|
| 25 |
+
**kwargs,
|
| 26 |
+
)
|
src/agentscope/model/_openrouter/_models/claude-3-haiku.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: anthropic/claude-3-haiku
|
| 2 |
+
api_type: openrouter_chat
|
| 3 |
+
description: Claude 3 Haiku via OpenRouter.
|
| 4 |
+
max_context: 200000
|
| 5 |
+
support_vision: true
|
| 6 |
+
support_function_calling: true
|
| 7 |
+
support_structured_output: true
|