Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/tool calling #6757

Open
wants to merge 11 commits into
base: dev
Choose a base branch
from
65 changes: 65 additions & 0 deletions css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -1090,6 +1090,71 @@ div.svelte-362y77>*, div.svelte-362y77>.form>* {
}
}

#tool-menu {
max-height: calc(100dvh - 135px);
overflow-y: scroll !important;
border-radius: 0;
scrollbar-width: auto;
}

#tool-menu::-webkit-scrollbar {
display: block;
}

#tool-menu label {
width: 100%;
background-color: transparent !important;
background: none;
border: 0;
border-radius: 0;
padding-top: 8px;
padding-bottom: 8px;
position: relative;
min-height: 42px !important;
}

#tool-menu label span {
margin-left: 29px;
}

#tool-menu > :nth-child(2) {
display: none;
}

#tool-menu > :nth-child(3) {
gap: 0.25rem;
}

.tool-menu-label {
display: inline-block;
position: relative;
z-index: var(--layer-4);
border: solid var(--block-title-border-width) var(--block-title-border-color);
border-radius: var(--block-title-radius);
background: var(--block-title-background-fill);
padding: var(--block-title-padding);
color: var(--block-title-text-color);
font-weight: var(--block-title-text-weight);
font-size: var(--block-title-text-size);
line-height: var(--line-sm);
}

.tool-menu-info {
margin-bottom: var(--spacing-lg);
color: var(--block-info-text-color);
font-weight: var(--block-info-text-weight);
font-size: var(--block-info-text-size);
line-height: var(--line-sm);
}

#tool-parameters-menu {
background-color: var(--darker-gray) !important;
}

#tool-action-menu {
background-color: var(--darker-gray) !important;
}

/* ----------------------------------------------
Dark theme
---------------------------------------------- */
Expand Down
12 changes: 12 additions & 0 deletions extensions/openai/completions.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,14 @@ def convert_history(history):


def chat_completions_common(body: dict, is_legacy: bool = False, stream=False, prompt_only=False) -> dict:
# TODO: Implement the API methods for tool calls
# The API spec uses 'tool' instead of 'function' now.
if body.get('tools', []):
raise InvalidRequestError(message="tools is not supported.", param='tools')

if body.get('tool_call', ''):
raise InvalidRequestError(message="tool_call is not supported.", param='tool_call')

if body.get('functions', []):
raise InvalidRequestError(message="functions is not supported.", param='functions')

Expand All @@ -227,6 +235,10 @@ def chat_completions_common(body: dict, is_legacy: bool = False, stream=False, p
for m in messages:
if 'role' not in m:
raise InvalidRequestError(message="messages: missing role", param='messages')
elif m['role'] == 'tool':
raise InvalidRequestError(message="role: tool is not supported.", param='messages')
elif m['role'] == 'ipython':
raise InvalidRequestError(message="role: ipython is not supported.", param='messages')
elif m['role'] == 'function':
raise InvalidRequestError(message="role: function is not supported.", param='messages')

Expand Down
Loading