This repository has been archived by the owner on Aug 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
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
1 parent
1a031ff
commit c2d42b9
Showing
6 changed files
with
57 additions
and
5 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
examples/fast-api-server/library/piedpiper/search_web_about_hooli.yaml
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
2 changes: 1 addition & 1 deletion
2
examples/fast-api-server/library/piedpiper/send_purchase_inquiry_email.yaml
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
24 changes: 24 additions & 0 deletions
24
packages/openassistants/openassistants/contrib/index_function.py
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,24 @@ | ||
from typing import Awaitable, Callable, List, Literal, Sequence | ||
|
||
from openassistants.data_models.function_output import FunctionOutput, TextOutput | ||
from openassistants.functions.base import ( | ||
BaseFunction, | ||
FunctionExecutionDependency, | ||
) | ||
from openassistants.functions.utils import AsyncStreamVersion | ||
|
||
|
||
class IndexFunction(BaseFunction): | ||
type: Literal["IndexFunction"] = "IndexFunction" | ||
functions: Callable[[], Awaitable[List[BaseFunction]]] | ||
|
||
async def execute( | ||
self, deps: FunctionExecutionDependency | ||
) -> AsyncStreamVersion[Sequence[FunctionOutput]]: | ||
output = "" | ||
for function in await self.functions(): | ||
if function.type == "IndexFunction": | ||
continue | ||
output += f"""**{function.display_name}** | ||
{function.description}\n\n""" | ||
yield [TextOutput(text=output)] |
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