types
¶
ASSISTANT_ROLE
module-attribute
¶
ASSISTANT_ROLE = MessageRole(ASSISTANT)
The assistant role with name not specified.
MaybeOneOrMany
module-attribute
¶
A type that can be either a single item, a sequence of items, or None.
OneOrMany
module-attribute
¶
A type that can be either a single item or a sequence of items.
SYSTEM_ROLE
module-attribute
¶
SYSTEM_ROLE = MessageRole(SYSTEM)
The system role with name not specified.
String
module-attribute
¶
String: TypeAlias = Union[StringFuture, str]
String is a type alias for StringFuture or str.
Audio
¶
Bases: ContentPart
Represent an audio in the message.
Source code in src/appl/core/types/content.py
from_file
classmethod
¶
Construct an audio prompt from an audio file.
Source code in src/appl/core/types/content.py
from_url
classmethod
¶
Construct an audio prompt from an audio URL.
Source code in src/appl/core/types/content.py
get_dict
¶
CallFuture
¶
CallFuture(
func: Callable[..., R],
*args: Any,
executor_type: ExecutorType = ExecutorType.GENERAL_THREAD_POOL,
lazy_eval: bool = False,
**kwargs: Any
)
Bases: FutureValue
, Generic[R]
Represent a function call that may not be ready yet.
Parameters:
-
func
(Callable[..., R]
) –The function to call.
-
*args
(Any
, default:()
) –The arguments of the function.
-
executor_type
(ExecutorType
, default:GENERAL_THREAD_POOL
) –The type of the executor to run the call.
-
lazy_eval
(bool
, default:False
) –Whether to delay the start of the call until needed.
-
**kwargs
(Any
, default:{}
) –The keyword arguments of the function.
Source code in src/appl/core/types/futures.py
result
¶
Get the result of the call.
Source code in src/appl/core/types/futures.py
CmpStringFuture
¶
CmpStringFuture(
a: StringFuture,
b: StringFuture,
op: Callable[[str, str], bool],
)
Bases: FutureValue
Represent a comparison between a StringFuture and another value.
Source code in src/appl/core/types/futures.py
CompletionRequestEvent
¶
Bases: TraceEventBase
A class representing a completion request event.
CompletionResponseEvent
¶
Bases: TraceEventBase
A class representing a completion response event.
metadata
class-attribute
instance-attribute
¶
The meta data of the event.
ContentList
¶
Bases: BaseModel
Represent a list of contents containing text, images and audio.
Source code in src/appl/core/types/content.py
append
¶
append(content: ContentPart) -> None
Append a content to the list.
If the last content is a string, it will be concatenated with the new content.
Source code in src/appl/core/types/content.py
extend
¶
extend(contents: list[ContentPart]) -> None
get_contents
¶
ContentPart
¶
ExecutorNotFoundError
¶
FunctionCallEvent
¶
Bases: TraceEventBase
A class representing a function call event.
FunctionReturnEvent
¶
Bases: TraceEventBase
A class representing a function return event.
metadata
class-attribute
instance-attribute
¶
The meta data of the event.
FutureValue
¶
GenerationInitEvent
¶
Bases: TraceEventBase
A class representing a generation init event.
GenerationResponseEvent
¶
Bases: TraceEventBase
A class representing a generation response event.
metadata
class-attribute
instance-attribute
¶
The meta data of the event.
GitInfo
dataclass
¶
GitInfo(
user: Optional[str] = None,
email: Optional[str] = None,
branch: Optional[str] = None,
commit_hash: Optional[str] = None,
)
Git information.
GlobalExecutors
¶
The global executors.
get_executor
¶
get_executor(
executor_type: ExecutorType,
) -> Union[ThreadPoolExecutor, ProcessPoolExecutor]
Get the executor of a given type.
Source code in src/appl/core/types/executor.py
set_executor
¶
set_executor(
executor_type: ExecutorType,
executor: Optional[
Union[ThreadPoolExecutor, ProcessPoolExecutor]
],
) -> None
Set the global executors.
Source code in src/appl/core/types/executor.py
Image
¶
Bases: ContentPart
Represent an image in the message.
See the guide for more information about the detail level.
Source code in src/appl/core/types/content.py
from_file
classmethod
¶
Construct an image prompt from an image file.
from_image
classmethod
¶
Construct an image prompt from a PIL ImageFile.
Source code in src/appl/core/types/content.py
get_dict
¶
MessageRole
¶
Bases: BaseModel
The role of the message owner.
Parameters:
-
type
(Optional[Union[str, MessageRoleType]]
, default:None
) –The type of the role.
-
name
(Optional[str]
, default:None
) –An optional name for the role, differentiate between roles of the same type."
Source code in src/appl/core/types/role.py
MetaData
dataclass
¶
MetaData(
appl_version: str,
cwd: str,
run_cmd: str,
git_info: GitInfo,
exec_file_path: str,
exec_file_basename: str,
start_time: str,
dotenvs: List[str],
appl_config_files: List[str],
log_file: Optional[str] = None,
trace_file: Optional[str] = None,
)
Metadata for the run.
ResponseType
¶
The type of generation response.
UNFINISHED
class-attribute
instance-attribute
¶
The response is not finished.
StringFuture
¶
Bases: FutureValue
, BaseModel
StringFuture is a string that may not be ready yet.
Source code in src/appl/core/types/futures.py
from_list
classmethod
¶
from_list(content: List[Any]) -> StringFuture
join
¶
join(iterable: Iterable[StringFuture]) -> StringFuture
Concatenate any number of strings.
The StringFuture whose method is called is inserted in between each given StringFuture. The result is returned as a new StringFuture.
Source code in src/appl/core/types/futures.py
materialized
¶
materialized() -> StringFuture
TextContent
¶
TextContent(text: String)
Bases: ContentPart
Represent a text in the message.
Source code in src/appl/core/types/content.py
get_dict
¶
TraceEngineBase
¶
Bases: ABC
A base class for trace engines.
min_timestamp
cached
property
¶
min_timestamp: float
The minimum time stamp of the events in the trace.
trace_nodes
abstractmethod
property
¶
The dictionary of trace nodes in the trace.
append
abstractmethod
¶
append(event: TraceEventBase) -> None
TraceEventBase
¶
Bases: BaseModel
A base class for trace events.
TraceNode
¶
Bases: BaseModel
The node of a trace tree containing information about trace events.
args
class-attribute
instance-attribute
¶
The arguments of the trace node.
children
class-attribute
instance-attribute
¶
The children of the trace node.
metadata
class-attribute
instance-attribute
¶
The meta data of the trace node.
parent
class-attribute
instance-attribute
¶
The parent of the trace node.
is_string
¶
is_thread_executor
¶
is_thread_executor(executor_type: ExecutorType) -> bool