Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions edgee/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class InputObject:
messages: list[dict]
tools: list[dict] | None = None
tool_choice: str | dict | None = None
tags: list[str] | None = None


@dataclass
Expand Down Expand Up @@ -188,14 +189,17 @@ def send(
messages = [{"role": "user", "content": input}]
tools = None
tool_choice = None
tags = None
elif isinstance(input, InputObject):
messages = input.messages
tools = input.tools
tool_choice = input.tool_choice
tags = input.tags
else:
messages = input.get("messages", [])
tools = input.get("tools")
tool_choice = input.get("tool_choice")
tags = input.get("tags")

body: dict = {"model": model, "messages": messages}
if stream:
Expand All @@ -204,6 +208,8 @@ def send(
body["tools"] = tools
if tool_choice:
body["tool_choice"] = tool_choice
if tags:
body["tags"] = tags

request = Request(
f"{self.base_url}{API_ENDPOINT}",
Expand Down
Loading