chore: initial import of standalone agentscope project
Some checks failed
Pre-commit / run (ubuntu-latest) (push) Has been cancelled
Deploy Sphinx documentation to Pages / build_en (ubuntu-latest, 3.10) (push) Has been cancelled
Deploy Sphinx documentation to Pages / build_zh (ubuntu-latest, 3.10) (push) Has been cancelled
Python Unittest Coverage / test (macos-15, 3.10) (push) Has been cancelled
Python Unittest Coverage / test (macos-15, 3.11) (push) Has been cancelled
Python Unittest Coverage / test (macos-15, 3.12) (push) Has been cancelled
Python Unittest Coverage / test (ubuntu-latest, 3.10) (push) Has been cancelled
Python Unittest Coverage / test (ubuntu-latest, 3.11) (push) Has been cancelled
Python Unittest Coverage / test (ubuntu-latest, 3.12) (push) Has been cancelled
Python Unittest Coverage / test (windows-latest, 3.10) (push) Has been cancelled
Python Unittest Coverage / test (windows-latest, 3.11) (push) Has been cancelled
Python Unittest Coverage / test (windows-latest, 3.12) (push) Has been cancelled
Some checks failed
Pre-commit / run (ubuntu-latest) (push) Has been cancelled
Deploy Sphinx documentation to Pages / build_en (ubuntu-latest, 3.10) (push) Has been cancelled
Deploy Sphinx documentation to Pages / build_zh (ubuntu-latest, 3.10) (push) Has been cancelled
Python Unittest Coverage / test (macos-15, 3.10) (push) Has been cancelled
Python Unittest Coverage / test (macos-15, 3.11) (push) Has been cancelled
Python Unittest Coverage / test (macos-15, 3.12) (push) Has been cancelled
Python Unittest Coverage / test (ubuntu-latest, 3.10) (push) Has been cancelled
Python Unittest Coverage / test (ubuntu-latest, 3.11) (push) Has been cancelled
Python Unittest Coverage / test (ubuntu-latest, 3.12) (push) Has been cancelled
Python Unittest Coverage / test (windows-latest, 3.10) (push) Has been cancelled
Python Unittest Coverage / test (windows-latest, 3.11) (push) Has been cancelled
Python Unittest Coverage / test (windows-latest, 3.12) (push) Has been cancelled
This commit is contained in:
22
src/agentscope/types/__init__.py
Normal file
22
src/agentscope/types/__init__.py
Normal file
@@ -0,0 +1,22 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""The types in agentscope"""
|
||||
|
||||
from ._hook import (
|
||||
AgentHookTypes,
|
||||
ReActAgentHookTypes,
|
||||
)
|
||||
from ._object import Embedding
|
||||
from ._json import (
|
||||
JSONPrimitive,
|
||||
JSONSerializableObject,
|
||||
)
|
||||
from ._tool import ToolFunction
|
||||
|
||||
__all__ = [
|
||||
"AgentHookTypes",
|
||||
"ReActAgentHookTypes",
|
||||
"Embedding",
|
||||
"JSONPrimitive",
|
||||
"JSONSerializableObject",
|
||||
"ToolFunction",
|
||||
]
|
||||
25
src/agentscope/types/_hook.py
Normal file
25
src/agentscope/types/_hook.py
Normal file
@@ -0,0 +1,25 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""The agent hooks types."""
|
||||
from typing import Literal
|
||||
|
||||
AgentHookTypes = (
|
||||
str
|
||||
| Literal[
|
||||
"pre_reply",
|
||||
"post_reply",
|
||||
"pre_print",
|
||||
"post_print",
|
||||
"pre_observe",
|
||||
"post_observe",
|
||||
]
|
||||
)
|
||||
|
||||
ReActAgentHookTypes = (
|
||||
AgentHookTypes
|
||||
| Literal[
|
||||
"pre_reasoning",
|
||||
"post_reasoning",
|
||||
"pre_acting",
|
||||
"post_acting",
|
||||
]
|
||||
)
|
||||
21
src/agentscope/types/_json.py
Normal file
21
src/agentscope/types/_json.py
Normal file
@@ -0,0 +1,21 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""The JSON related types"""
|
||||
|
||||
from typing import Union
|
||||
|
||||
JSONPrimitive = Union[
|
||||
str,
|
||||
int,
|
||||
float,
|
||||
bool,
|
||||
None,
|
||||
]
|
||||
|
||||
JSONSerializableObject = Union[
|
||||
JSONPrimitive,
|
||||
list["JSONSerializableObject"],
|
||||
dict[
|
||||
str,
|
||||
"JSONSerializableObject",
|
||||
],
|
||||
]
|
||||
5
src/agentscope/types/_object.py
Normal file
5
src/agentscope/types/_object.py
Normal file
@@ -0,0 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""The object types in agentscope."""
|
||||
from typing import List
|
||||
|
||||
Embedding = List[float]
|
||||
36
src/agentscope/types/_tool.py
Normal file
36
src/agentscope/types/_tool.py
Normal file
@@ -0,0 +1,36 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""The tool related types"""
|
||||
|
||||
from typing import (
|
||||
Callable,
|
||||
Union,
|
||||
Awaitable,
|
||||
AsyncGenerator,
|
||||
Generator,
|
||||
Coroutine,
|
||||
Any,
|
||||
TYPE_CHECKING,
|
||||
)
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..tool import ToolResponse
|
||||
else:
|
||||
ToolResponse = "ToolResponse"
|
||||
|
||||
ToolFunction = Callable[
|
||||
...,
|
||||
Union[
|
||||
# sync function
|
||||
ToolResponse,
|
||||
# async function
|
||||
Awaitable[ToolResponse],
|
||||
# sync generator function
|
||||
Generator[ToolResponse, None, None],
|
||||
# async generator function
|
||||
AsyncGenerator[ToolResponse, None],
|
||||
# async function that returns async generator
|
||||
Coroutine[Any, Any, AsyncGenerator[ToolResponse, None]],
|
||||
# async function that returns sync generator
|
||||
Coroutine[Any, Any, Generator[ToolResponse, None, None]],
|
||||
],
|
||||
]
|
||||
Reference in New Issue
Block a user