-
Notifications
You must be signed in to change notification settings - Fork 896
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tool calling support for below providers - OpenAI, Groq, Anthropic, AWS, & Mistral. OpenAI compatible SDKs need to changes for tool calling support. Adding utility ToolManager for users to easily supply tools, and parse model's request for tool usage.
- Loading branch information
1 parent
1b5da0e
commit 9946507
Showing
12 changed files
with
865 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
from .client import Client | ||
from .framework.message import Message |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
from .provider_interface import ProviderInterface | ||
from .chat_completion_response import ChatCompletionResponse | ||
from .message import Message |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,10 @@ | ||
from aisuite.framework.message import Message | ||
from typing import Literal, Optional | ||
|
||
|
||
class Choice: | ||
def __init__(self): | ||
self.message = Message() | ||
self.finish_reason: Optional[Literal["stop", "tool_calls"]] = None | ||
self.message = Message( | ||
content=None, tool_calls=None, role="assistant", refusal=None | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,22 @@ | ||
"""Interface to hold contents of api responses when they do not conform to the OpenAI style response""" | ||
|
||
from pydantic import BaseModel | ||
from typing import Literal, Optional | ||
|
||
class Message: | ||
def __init__(self): | ||
self.content = None | ||
|
||
class Function(BaseModel): | ||
arguments: str | ||
name: str | ||
|
||
|
||
class ChatCompletionMessageToolCall(BaseModel): | ||
id: str | ||
function: Function | ||
type: Literal["function"] | ||
|
||
|
||
class Message(BaseModel): | ||
content: Optional[str] | ||
tool_calls: Optional[list[ChatCompletionMessageToolCall]] | ||
role: Optional[Literal["user", "assistant", "system"]] | ||
refusal: Optional[str] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.