Organize folder structure towards library (#29)

This commit is contained in:
Robin-Manuel Thiel
2024-03-30 09:40:27 +01:00
committed by GitHub
parent fda381a82a
commit 1ede63f9a8
102 changed files with 141 additions and 1173 deletions

View File

@@ -1,64 +0,0 @@
# SemanticKernel Activity Provider for Elsa Workflows 3.x
The project supports running [Microsoft Semantic Kernel](https://github.com/microsoft/semantic-kernel) Skills as workflows using [Elsa Workflows](https://v3.elsaworkflows.io). You can build the workflows as .NET code or in the visual designer.
To run the designer:
```bash
> cd WorkflowsApp
> cp .env_example .env
# Edit the .env file to choose your AI model, add your API Endpoint, and secrets.
> . ./.env
> dotnet build
> dotnet run
# Open browser to the URI in the console output
```
By Default you can use "admin" and "password" to login. Please review [Workflow Security](https://v3.elsaworkflows.io/docs/installation/aspnet-apps-workflow-server) for into on securing the app, using API tokens, and more.
To [invoke](https://v3.elsaworkflows.io/docs/guides/invoking-workflows) a workflow, first it must be "Published". If your workflow has a trigger activity, you can use that. When your workflow is ready, click the "Publish" button. You can also execute the workflow using the API. Then, find the Workflow Definition ID. From a command line, you can use "curl":
```bash
> curl --location 'https://localhost:5001/elsa/api/workflow-definitions/{workflow_definition_id}/execute' \
--header 'Content-Type: application/json' \
--header 'Authorization: ApiKey {api_key}' \
--data '{
}'
```
Once you have the app runing locally, you can login (admin/password - see the [Elsa Workflows](https://v3.elsaworkflows.io) for info about securing). Then you can click "new workflow" to begin building your workflow with semantic kernel skills.
1. Drag workflow Activity blocks into the designer, and examine the settings.
2. Connect the Activities to specify an order of operations.
3. You can use Workfflow Variables to pass state between activities.
1. Create a Workflow Variable, "MyVariable"
2. Click on the Activity that you want to use to populate the variable.
3. In the Settings box for the Activity, Click "Output"
4. Set the "Output" to the variable chosen.
5. Click the Activity that will use the variable. Click on "Settings".
6. Find the text box representing the variable that you want to populate, in this case usually "input".
7. Click the "..." widget above the text box, and select "javascript"
8. Set the value of the text box to
```javascript
`${getMyVariable()}`
```
9. Run the workflow.
## Run via codespaces
The easiest way to run the project is in Codespaces. Codespaces will start a qdrant instance for you.
1. Create a new codespace from the *code* button on the main branch.
2. Once the code space setup is finished, from the terminal:
```bash
> cd cli
cli> cp ../WorkflowsApp/.env_example .
# Edit the .env file to choose your AI model, add your API Endpoint, and secrets.
cli> bash .env
cli> dotnet build
cli> dotnet run --file util/ToDoListSamplePrompt.txt do it
```
You will find the output in the *output/* directory.

View File

@@ -1,103 +0,0 @@
## Prerequisites
- Access to gpt3.5-turbo or preferably gpt4 - [Get access here](https://learn.microsoft.com/en-us/azure/ai-services/openai/overview#how-do-i-get-access-to-azure-openai)
- [Setup a Github app](#how-do-i-setup-the-github-app)
- [Install the Github app](https://docs.github.com/en/apps/using-github-apps/installing-your-own-github-app)
- [Provision the azure resources](#how-do-I-deploy-the-azure-bits)
- [Create labels for the dev team skills](#which-labels-should-i-create)
### How do I setup the Github app?
- [Register a Github app](https://docs.github.com/en/apps/creating-github-apps/registering-a-github-app/registering-a-github-app), with the options listed below:
- Give your App a name and add a description
- Homepage URL: Can be anything (Example: repository URL)
- Add a dummy value for the webhook url, we'll come back to this setting
- Enter a webhook secret, which you'll need later on when filling in the `WebhookSecret` property in the `appsettings.json` file
- Setup the following permissions
- Repository
- Contents - read and write
- Issues - read and write
- Metadata - read only
- Pull requests - read and write
- Subscribe to the following events:
- Issues
- Issue comment
- Allow this app to be installed by any user or organization
- After the app is created, generate a private key, we'll use it later for authentication to Github from the app
### Which labels should I create?
In order for us to know which skill and persona we need to talk with, we are using Labels in Github Issues.
The default bunch of skills and personnas are as follow:
- PM.Readme
- Do.It
- DevLead.Plan
- Developer.Implement
Add them to your repository (They are not there by default).
Once you start adding your own skills, just remember to add the corresponding label to your repository.
## How do I run this locally?
Codespaces are preset for this repo. For codespaces there is a 'free' tier for individual accounts. See: https://github.com/pricing
Start by creating a codespace:
https://docs.github.com/en/codespaces/developing-in-a-codespace/creating-a-codespace-for-a-repository
![Alt text](./images/new-codespace.png)
Within this repo there is a folder "scr\sample-apps\gh-flow" Within this folder there are two files called appsettings.azure.template.json and appsettings.local.template.json. If you run this demo locally, use the local template and if you want to run it within Azure use the Azure template. Rename the selected file to appsettings.json and fill out the config values within the file.
In the Explorer tab in VS Code, find the Solution explorer, right click on the `gh-flow` project and click Debug -> Start new instance
![Alt text](./images/solution-explorer.png)
We'll need to expose the running application to the GH App webhooks, for example using [DevTunnels](https://learn.microsoft.com/en-us/azure/developer/dev-tunnels/overview), but any tool like ngrok can also work.
The following commands will create a persistent tunnel, so we need to only do this once:
```bash
TUNNEL_NAME=_name_yout_tunnel_here_
devtunnel user login
devtunnel create -a $TUNNEL_NAME
devtunnel port create -p 5244 $TUNNEL_NAME
```
and once we have the tunnel created we can just start forwarding with the following command:
```bash
devtunnel host $TUNNEL_NAME
```
Copy the local address (it will look something like https://yout_tunnel_name.euw.devtunnels.ms) and append `/api/github/webhooks` at the end. Using this value, update the Github App's webhook URL and you are ready to go!
Before you go and have the best of times, there is one last thing left to do [load the WAF into the vector DB](#load-the-waf-into-qdrant)
Also, since this project is relying on Orleans for the Agents implementation, there is a [dashboard](https://github.com/OrleansContrib/OrleansDashboard) available at https://yout_tunnel_name.euw.devtunnels.ms/dashboard, with useful metrics and stats related to the running Agents.
## How do I deploy the azure bits?
This repo is setup to use [azd](https://learn.microsoft.com/en-us/azure/developer/azure-developer-cli/overview) to work with the Azure bits. `azd` is installed in the codespace.
Let's start by logging in to Azure using
```bash
azd auth login
```
After we've logged in, we need to create a new environment provision the azure bits.
```bash
ENVIRONMENT=_name_of_your_env
azd env new $ENVIRONMENT
azd provision -e $ENVIRONMENT
```
After the provisioning is done, you can inspect the outputs with the following command
```bash
azd env get-values -e dev
```
As the last step, we also need to [load the WAF into the vector DB](#load-the-waf-into-qdrant)
### Load the WAF into Qdrant.
If you are running the app locally, we have [Qdrant](https://qdrant.tech/) setup in the Codespace and if you are running in Azure, Qdrant is deployed to ACA.
The loader is a project in the `src\apps` folder, called `seed-memory`. We need to fill in the `appsettings.json` file in the `config` folder with the OpenAI details and the Qdrant endpoint, then just run the loader with `dotnet run` and you are ready to go.

View File

@@ -1,34 +0,0 @@
# How does the event flow look like?
```mermaid
graph TD;
NEA([NewAsk event]) -->|Hubber| NEA1[Creation of PM issue, DevLead issue, and new branch];
RR([ReadmeRequested event]) -->|ProductManager| PM1[Generation of new README];
NEA1 --> RR;
PM1 --> RG([ReadmeGenerated event]);
RG -->|Hubber| RC[Post the readme as a new comment on the issue];
RC --> RCC([ReadmeChainClosed event]);
RCC -->|ProductManager| RCR([ReadmeCreated event]);
RCR --> |AzureGenie| RES[Store Readme in blob storage];
RES --> RES2([ReadmeStored event]);
RES2 --> |Hubber| REC[Readme commited to branch and create new PR];
DPR([DevPlanRequested event]) -->|DeveloperLead| DPG[Generation of new development plan];
NEA1 --> DPR;
DPG --> DPGE([DevPlanGenerated event]);
DPGE -->|Hubber| DPGEC[Posting the plan as a new comment on the issue];
DPGEC --> DPCC([DevPlanChainClosed event]);
DPCC -->|DeveloperLead| DPCE([DevPlanCreated event]);
DPCE --> |Hubber| DPC[Creates a Dev issue for each subtask];
DPC([CodeGenerationRequested event]) -->|Developer| CG[Generation of new code];
CG --> CGE([CodeGenerated event]);
CGE -->|Hubber| CGC[Posting the code as a new comment on the issue];
CGC --> CCCE([CodeChainClosed event]);
CCCE -->|Developer| CCE([CodeCreated event]);
CCE --> |AzureGenie| CS[Store code in blob storage and schedule a run in the sandbox];
CS --> SRC([SandboxRunCreated event]);
SRC --> |Sandbox| SRM[Check every minute if the run finished];
SRM --> SRF([SandboxRunFinished event]);
SRF --> |Hubber| SRCC[Code files commited to branch];
```

Binary file not shown.

Before

Width:  |  Height:  |  Size: 302 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 341 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 59 KiB

View File

@@ -1,3 +0,0 @@
# General solution overview
![General overview](./images/overview.png)