-
Notifications
You must be signed in to change notification settings - Fork 0
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
bbf75d1
commit de2b718
Showing
8 changed files
with
1,255 additions
and
3 deletions.
There are no files selected for viewing
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,101 @@ | ||
## Introduction to the LLM Actor Framework | ||
|
||
The LLM (Large Language Model) Actor Framework is a sophisticated and extensible architecture designed to facilitate the | ||
integration and utilization of large language models, such as those provided by OpenAI, in various applications. This | ||
framework abstracts the complexities involved in interacting with these models and provides a structured way to define, | ||
manage, and extend different types of actors that can perform a wide range of tasks, from coding assistance to image | ||
generation and text-to-speech conversion. | ||
|
||
### Core Components | ||
|
||
The framework is built around a few core components, each serving a specific purpose. These components include: | ||
|
||
1. **BaseActor**: The abstract base class that defines the common interface and behavior for all actors. | ||
2. **CodingActor**: An actor specialized in generating and executing code based on natural language instructions. | ||
3. **ImageActor**: An actor designed to transform textual descriptions into images using image generation models. | ||
4. **ParsedActor**: An actor that parses textual input into structured data, such as JSON objects. | ||
5. **SimpleActor**: A straightforward actor that generates text responses based on input questions. | ||
6. **TextToSpeechActor**: An actor that converts text into speech using text-to-speech models. | ||
|
||
### BaseActor | ||
|
||
The `BaseActor` class is the cornerstone of the framework. It defines the essential methods and properties that all | ||
actors must implement or override. These include: | ||
|
||
- **prompt**: A string that defines the initial prompt or instructions for the actor. | ||
- **name**: An optional name for the actor. | ||
- **model**: The language model to be used by the actor. | ||
- **temperature**: A parameter that controls the randomness of the model's output. | ||
|
||
The `BaseActor` class also defines abstract methods such as `respond`, `chatMessages`, and `withModel`, which must be | ||
implemented by subclasses. | ||
|
||
### CodingActor | ||
|
||
The `CodingActor` class extends `BaseActor` and is tailored for coding tasks. It can generate code snippets, execute | ||
them, and handle errors through iterative refinement. Key features include: | ||
|
||
- **interpreterClass**: The class of the interpreter to be used for executing code. | ||
- **symbols**: A map of predefined symbols available in the coding environment. | ||
- **describer**: A type describer that provides descriptions of the available symbols. | ||
- **details**: Additional details or instructions for the actor. | ||
- **fallbackModel**: A fallback language model to be used if the primary model fails. | ||
- **runtimeSymbols**: Symbols available at runtime. | ||
|
||
The `CodingActor` class also defines nested classes and interfaces such as `CodeRequest`, `CodeResult`, | ||
and `ExecutionResult` to encapsulate the request and response structures. | ||
|
||
### ImageActor | ||
|
||
The `ImageActor` class is designed for generating images from textual descriptions. It extends `BaseActor` and adds | ||
properties specific to image generation, such as: | ||
|
||
- **imageModel**: The image generation model to be used. | ||
- **width**: The width of the generated image. | ||
- **height**: The height of the generated image. | ||
|
||
The `ImageActor` class also defines an inner class `ImageResponseImpl` that encapsulates the response, including the | ||
generated image. | ||
|
||
### ParsedActor | ||
|
||
The `ParsedActor` class focuses on parsing textual input into structured data. It extends `BaseActor` and introduces | ||
properties such as: | ||
|
||
- **resultClass**: The class of the result object. | ||
- **exampleInstance**: An example instance of the result class. | ||
- **parsingModel**: The model to be used for parsing. | ||
- **deserializerRetries**: The number of retries for deserialization. | ||
- **describer**: A type describer for the result class. | ||
|
||
The `ParsedActor` class also defines an inner class `ParsedResponseImpl` that encapsulates the parsed response. | ||
|
||
### SimpleActor | ||
|
||
The `SimpleActor` class is a minimalistic actor that generates text responses based on input questions. It | ||
extends `BaseActor` and implements the necessary methods to handle simple question-and-answer interactions. | ||
|
||
### TextToSpeechActor | ||
|
||
The `TextToSpeechActor` class converts text into speech. It extends `BaseActor` and adds properties specific to | ||
text-to-speech conversion, such as: | ||
|
||
- **audioModel**: The audio model to be used. | ||
- **voice**: The voice to be used for speech synthesis. | ||
- **speed**: The speed of the speech. | ||
|
||
The `TextToSpeechActor` class also defines an inner class `SpeechResponseImpl` that encapsulates the speech response, | ||
including the generated audio data. | ||
|
||
### Extensibility and Customization | ||
|
||
The LLM Actor Framework is designed to be highly extensible and customizable. Developers can create new actors by | ||
extending the `BaseActor` class and implementing the required methods. The framework also supports the use of different | ||
language models, interpreters, and type describers, making it adaptable to various use cases and domains. | ||
|
||
### Conclusion | ||
|
||
The LLM Actor Framework provides a robust and flexible foundation for integrating large language models into | ||
applications. By abstracting the complexities of model interaction and providing a structured way to define and manage | ||
actors, the framework empowers developers to harness the full potential of large language models in a wide range of | ||
tasks, from coding assistance to image generation and beyond. |
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,102 @@ | ||
## Overview of Base Application Classes | ||
|
||
This document provides an overview of the base application classes used in the provided code snippets. These classes | ||
form the foundation for various application functionalities, including coding assistance, web development, and testing | ||
different types of actors. | ||
|
||
### 1. `CodingAgent` | ||
|
||
The `CodingAgent` class is designed to facilitate coding assistance using an interpreter. It interacts with the OpenAI | ||
API to generate code based on user input and provides mechanisms to display and execute the generated code. The class | ||
extends `ActorSystem` and utilizes a `CodingActor` to handle code generation. | ||
|
||
**Key Features:** | ||
|
||
- **Initialization:** Takes parameters like API, storage, session, user, UI, interpreter class, symbols, temperature, | ||
details, model, and main task. | ||
- **Actor Management:** Manages a map of actors, with `CodingActor` being the primary actor. | ||
- **Code Request Handling:** Generates code requests and handles the response. | ||
- **Code Display and Feedback:** Displays the generated code and provides feedback mechanisms. | ||
- **Execution:** Executes the generated code and handles execution errors. | ||
|
||
### 2. `ShellToolAgent` | ||
|
||
The `ShellToolAgent` class extends `CodingAgent` and adds functionalities specific to shell tool operations. It provides | ||
mechanisms to export code prototypes, generate data schemas, and create servlets. | ||
|
||
**Key Features:** | ||
|
||
- **Tool Button Creation:** Adds a button to create tools from the generated code. | ||
- **Schema Actor:** Generates data schemas from code prototypes. | ||
- **Servlet Actor:** Converts code prototypes into servlets. | ||
- **OpenAPI Integration:** Generates OpenAPI definitions for the servlets. | ||
- **Test Page Generation:** Creates test pages for the generated servlets. | ||
|
||
### 3. `WebDevApp` | ||
|
||
The `WebDevApp` class is designed to assist in web development. It provides functionalities to translate user ideas into | ||
detailed web application architectures and generate the necessary HTML, CSS, JavaScript, and image files. | ||
|
||
**Key Features:** | ||
|
||
- **Architecture Discussion:** Translates user ideas into detailed web application architectures. | ||
- **File Drafting:** Drafts HTML, CSS, JavaScript, and image files based on the architecture. | ||
- **Code Review:** Reviews and refines the generated code. | ||
- **Task Management:** Manages tasks for drafting and reviewing code. | ||
|
||
### 4. `ProcessInterpreter` | ||
|
||
The `ProcessInterpreter` class provides an implementation of the `Interpreter` interface for running shell commands. It | ||
wraps the provided code and executes it using a specified command. | ||
|
||
**Key Features:** | ||
|
||
- **Command Execution:** Executes shell commands based on the provided definitions. | ||
- **Output Handling:** Handles the output and errors from the executed commands. | ||
- **Code Wrapping:** Wraps the provided code before execution. | ||
|
||
### 5. `SimpleActorTestApp` | ||
|
||
The `SimpleActorTestApp` class is designed to test `SimpleActor` instances. It provides a simple interface for users to | ||
interact with the actor and view the responses. | ||
|
||
**Key Features:** | ||
|
||
- **User Message Handling:** Handles user messages and passes them to the actor. | ||
- **Response Display:** Displays the actor's responses in a user-friendly format. | ||
- **Settings Management:** Manages settings for the actor. | ||
|
||
### 6. `ParsedActorTestApp` | ||
|
||
The `ParsedActorTestApp` class is designed to test `ParsedActor` instances. It provides functionalities to handle user | ||
messages, parse the responses, and display them. | ||
|
||
**Key Features:** | ||
|
||
- **User Message Handling:** Handles user messages and passes them to the actor. | ||
- **Response Parsing:** Parses the actor's responses and displays them in a structured format. | ||
- **Settings Management:** Manages settings for the actor. | ||
|
||
### 7. `ImageActorTestApp` | ||
|
||
The `ImageActorTestApp` class is designed to test `ImageActor` instances. It provides functionalities to handle user | ||
messages, generate images, and display them. | ||
|
||
**Key Features:** | ||
|
||
- **User Message Handling:** Handles user messages and passes them to the actor. | ||
- **Image Generation:** Generates images based on the actor's responses. | ||
- **Response Display:** Displays the generated images and the actor's responses. | ||
- **Settings Management:** Manages settings for the actor. | ||
|
||
### 8. `CodingActorTestApp` | ||
|
||
The `CodingActorTestApp` class is designed to test `CodingActor` instances. It provides functionalities to handle user | ||
messages, generate code, and execute it. | ||
|
||
**Key Features:** | ||
|
||
- **User Message Handling:** Handles user messages and passes them to the actor. | ||
- **Code Generation:** Generates code based on the actor's responses. | ||
- **Code Execution:** Executes the generated code and displays the results. | ||
- **Settings Management:** Manages settings for the actor. |
Oops, something went wrong.