-
Notifications
You must be signed in to change notification settings - Fork 151
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
576 additions
and
416 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
""" | ||
Copyright (c) Microsoft Corporation. All rights reserved. | ||
Licensed under the MIT License. | ||
""" | ||
|
||
from __future__ import annotations | ||
|
||
from dataclasses import dataclass | ||
from typing import Any, Awaitable, Callable, Dict, Optional, Union | ||
from dataclasses_json import DataClassJsonMixin, dataclass_json | ||
|
||
|
||
@dataclass_json | ||
@dataclass | ||
class OpenAIFunction(DataClassJsonMixin): | ||
""" | ||
Function spec that adheres to OpenAI function calling. | ||
""" | ||
|
||
name: str | ||
""" | ||
Name of the function to be called. | ||
""" | ||
|
||
description: Optional[str] | ||
""" | ||
Description of what the function does. | ||
""" | ||
|
||
parameters: Optional[Dict[str, Any]] | ||
""" | ||
Parameters the function accepts, described as a JSON Schema object. | ||
""" | ||
|
||
handler: Callable[..., Union[str, Awaitable[str]]] | ||
""" | ||
The function handler, may be asynchoronous, takes in any number of | ||
arguments and must return a string. | ||
""" |
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
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.