Skip to content

Commit

Permalink
Fix broken docs code and links (#549)
Browse files Browse the repository at this point in the history
* Fix docs for console basics

* Fix broken links in docs

* Commit cookiecutter generated files
  • Loading branch information
kumaranvpl authored Nov 11, 2024
1 parent cc5e29d commit d0bef46
Show file tree
Hide file tree
Showing 62 changed files with 1,188 additions and 77 deletions.
8 changes: 4 additions & 4 deletions docs/docs/en/user-guide/runtimes/autogen/whatsapp.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ The example starts by importing the necessary modules from **AutoGen** and **Fas
{!> docs_src/user_guide/runtimes/autogen/whatsapp.py [ln:1-9] !}
```

To create a [**`WhatsAppAgent`**](../../../api/fastagency/runtimes/autogen/agents/whatsapp/WhatsAppAgentt.md), simply import [**`WhatsAppAgent`**](../../../api/fastagency/runtimes/autogen/agents/whatsapp/WhatsAppAgentt.md), which comes with built-in WhatsApp capabilities, and use it as needed.
To create a [**`WhatsAppAgent`**](../../../api/fastagency/runtimes/autogen/agents/whatsapp/WhatsAppAgent.md), simply import [**`WhatsAppAgent`**](../../../api/fastagency/runtimes/autogen/agents/whatsapp/WhatsAppAgent.md), which comes with built-in WhatsApp capabilities, and use it as needed.

=== "Enhancing an existing agent"
```
Expand All @@ -64,7 +64,7 @@ The example starts by importing the necessary modules from **AutoGen** and **Fas
To enhance existing agents with WhatsApp communication capability, import [**`WhatsAppTool`**](../../../api/fastagency/runtimes/autogen/tools/whatsapp/WhatsAppTool.md) from FastAgency and [**`ConversableAgent`**](https://microsoft.github.io/autogen/docs/reference/agentchat/conversable_agent/){target="_blank"} from [AutoGen](https://microsoft.github.io/autogen){target="_blank"}.

#### 2. **Configure the Language Model (LLM)**
Here, the large language model is configured to use the `gpt-4o` model, and the API key is retrieved from the environment. This setup ensures that both the user and [**`WhatsAppAgent`**](../../../api/fastagency/runtimes/autogen/agents/whatsapp/WhatsAppAgentt.md) can interact effectively.
Here, the large language model is configured to use the `gpt-4o` model, and the API key is retrieved from the environment. This setup ensures that both the user and [**`WhatsAppAgent`**](../../../api/fastagency/runtimes/autogen/agents/whatsapp/WhatsAppAgent.md) can interact effectively.

```python
{! docs_src/user_guide/runtimes/autogen/whatsapp.py [ln:11-19] !}
Expand All @@ -86,7 +86,7 @@ Here, the large language model is configured to use the `gpt-4o` model, and the

When initiating the [**`WhatsAppAgent`**](../../../api/fastagency/runtimes/autogen/agents/whatsapp/WhatsAppAgent.md), the executor parameter must be provided. This can be either a single instance of [**`ConversableAgent`**](https://microsoft.github.io/autogen/docs/reference/agentchat/conversable_agent/){target="_blank"} or a `list of `[**`ConversableAgent`**](https://microsoft.github.io/autogen/docs/reference/agentchat/conversable_agent/){target="_blank"} instances.

The [**`WhatsAppAgent`**](../../../api/fastagency/runtimes/autogen/agents/whatsapp/WhatsAppAgentt.md) relies on the executor agent(s) to execute the sending of WhatsApp messages. In this example, the `whatsapp_agent` agent will call the `user_agent` agent with the necessary instructions when contacting the WhatsApp API required, and the `user_agent` will execute those instructions.
The [**`WhatsAppAgent`**](../../../api/fastagency/runtimes/autogen/agents/whatsapp/WhatsAppAgent.md) relies on the executor agent(s) to execute the sending of WhatsApp messages. In this example, the `whatsapp_agent` agent will call the `user_agent` agent with the necessary instructions when contacting the WhatsApp API required, and the `user_agent` will execute those instructions.

=== "Enhancing an existing agent"

Expand All @@ -113,7 +113,7 @@ Here, the large language model is configured to use the `gpt-4o` model, and the
The `caller` relies on the executor agent(s) to execute the WhatsApp tasks. In this example, the `assistant_agent` agent will call the `user_agent` agent with the necessary instructions when WhatsApp interaction is required, and the `user_agent` will execute those instructions.

#### 4. **Enable Agent Interaction and Chat**
Here, the user agent starts a conversation with the [**`WhatsAppAgent`**](../../../api/fastagency/runtimes/autogen/agents/whatsapp/WhatsAppAgentt.md), which will send a message to the specified number. The conversation is then summarized using a method provided by the LLM.
Here, the user agent starts a conversation with the [**`WhatsAppAgent`**](../../../api/fastagency/runtimes/autogen/agents/whatsapp/WhatsAppAgent.md), which will send a message to the specified number. The conversation is then summarized using a method provided by the LLM.

=== "Using WhatsAppAgent"

Expand Down
16 changes: 11 additions & 5 deletions docs/docs/en/user-guide/ui/console/basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ This example demonstrates how to create a workflow where a student agent interac
We begin by importing the necessary modules from **FastAgency** and **AutoGen**. These imports provide the essential building blocks for creating agents, workflows, and integrating the ConsoleUI.

```python
{! docs_src/getting_started/mesop/my_fastagency_app/my_fastagency_app/local/main_console.py [ln:1-8] !}
{! docs_src/getting_started/mesop/my_fastagency_app/my_fastagency_app/workflow.py [ln:1-6] !}
```

- **ConversableAgent**: This class allows the creation of agents that can engage in conversational tasks.
Expand All @@ -38,7 +38,7 @@ We begin by importing the necessary modules from **FastAgency** and **AutoGen**.
Next, we configure the language model that will power the agents. In this case, we're using **gpt-4o-mini**, and the API key is retrieved from the environment.

```python
{! docs_src/getting_started/mesop/my_fastagency_app/my_fastagency_app/local/main_console.py [ln:9-19] !}
{! docs_src/getting_started/mesop/my_fastagency_app/my_fastagency_app/workflow.py [ln:9-17] !}
```

- **Explanation**: The configuration specifies the LLM model and API key used for powering the conversation between agents. The temperature is set to `0.0` to ensure deterministic responses from the agents, making interactions consistent and reliable. This is particularly useful for scenarios where repeatability and predictability are required, such as testing.
Expand All @@ -47,7 +47,7 @@ Next, we configure the language model that will power the agents. In this case,
Here, we define a simple workflow where the **Student Agent** interacts with the **Teacher Agent**. The student asks questions, and the teacher responds as a math teacher. The workflow is registered using **AutoGenWorkflows**.

```python
{! docs_src/getting_started/mesop/my_fastagency_app/my_fastagency_app/local/main_console.py [ln:20-52] !}
{! docs_src/getting_started/mesop/my_fastagency_app/my_fastagency_app/workflow.py [ln:22-51] !}
```

- **Agent Overview**: The **Student Agent** is configured with a system message, "You are a student willing to learn," and will initiate questions during the interaction. The **Teacher Agent**, on the other hand, is set up as a math teacher and will respond to the student's questions.
Expand All @@ -57,22 +57,28 @@ Here, we define a simple workflow where the **Student Agent** interacts with the
Finally, we instantiate **[ConsoleUI](../../../../api/fastagency/ui/console/ConsoleUI.md)** to link the workflow to a text-based console interface. This allows the user to interact with the agents via the terminal.

```python
{! docs_src/getting_started/mesop/my_fastagency_app/my_fastagency_app/local/main_console.py [ln:54] !}
{! docs_src/getting_started/mesop/my_fastagency_app/my_fastagency_app/local/main_console.py [ln:1-12] !}
```

- **Explanation**: Here, we set up the **ConsoleUI** as the user interface for the workflow, which will allow the entire agent interaction to take place within the terminal.


### Complete Application Code

<details>
<summary>workflow.py</summary>
```python
{! docs_src/getting_started/mesop/my_fastagency_app/my_fastagency_app/workflow.py !}
```
</details>

<details>
<summary>main.py</summary>
```python
{! docs_src/getting_started/mesop/my_fastagency_app/my_fastagency_app/local/main_console.py !}
```
</details>


### Running the Application

Once the workflow is set up, you can run the application using the **FastAgency CLI**. Navigate to the directory where the script is located and run the following command:
Expand Down
8 changes: 4 additions & 4 deletions docs/docs/en/user-guide/ui/mesop/basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ We begin by importing the necessary modules from **FastAgency** and **AutoGen**.
{!> docs_src/user_guide/ui/mesop/main_mesop_auth.py [ln:1-15] !}
```

- [**`FirebaseAuth`**](../../../../api/fastagency/ui/mesop/firebase_auth/FirebaseAuth.md) and [**`FirebaseConfig`**](../../../../api/fastagency/ui/mesop/firebase_auth/FirebaseConfig.md): These classes enable you to integrate Firebase authentication into your Mesop application.
- [**`FirebaseAuth`**](../../../../api/fastagency/ui/mesop/auth/firebase/FirebaseAuth.md) and [**`FirebaseConfig`**](../../../../api/fastagency/ui/mesop/auth/firebase/FirebaseConfig.md): These classes enable you to integrate Firebase authentication into your Mesop application.

- **ConversableAgent**: This class allows the creation of agents that can engage in conversational tasks.
- **[FastAgency](../../../../api/fastagency/FastAgency.md)**: The core class responsible for orchestrating workflows and connecting them with UIs.
Expand Down Expand Up @@ -221,11 +221,11 @@ Finally, we instantiate **[MesopUI](../../../../api/fastagency/ui/mesop/MesopUI.

- **Create Firebase Configuration**:

Initialize the [**`FirebaseConfig`**](../../../../api/fastagency/ui/mesop/firebase_auth/FirebaseConfig.md) class by passing the necessary values from your Firebase configuration.
Initialize the [**`FirebaseConfig`**](../../../../api/fastagency/ui/mesop/auth/firebase/FirebaseConfig.md) class by passing the necessary values from your Firebase configuration.

- **Initialize Firebase Authentication**:

Instiantiate the [**`FirebaseAuth`**](../../../../api/fastagency/ui/mesop/firebase_auth/FirebaseAuth.md) with Google as the sign-in method and pass the Firebase configuration.
Instiantiate the [**`FirebaseAuth`**](../../../../api/fastagency/ui/mesop/auth/firebase/FirebaseAuth.md) with Google as the sign-in method and pass the Firebase configuration.

!!! note
Currently, [**Firebase**](https://firebase.google.com){target="_blank"} is the only supported authentication provider, with Google as the available sign-in method. Future releases will introduce more sign-in options within Firebase and expand support for additional authentication providers.
Expand Down Expand Up @@ -317,7 +317,7 @@ The outputs will vary based on the interface, here is the output of the last ter
```
=== "Without Authentication"

![Initial message](../../../getting-started/images/chat.png)
![Initial message](../../getting-started/images/chat.png)

=== "With Authentication"

Expand Down
6 changes: 5 additions & 1 deletion docs/docs_src/getting_started/fastapi/folder_structure.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ my_fastagency_app
├── scripts
│   ├── build_docker.sh
│   ├── deploy_to_fly_io.sh
│   └── run_docker.sh
│   ├── lint-pre-commit.sh
│   ├── lint.sh
│   ├── run_docker.sh
│   ├── static-analysis.sh
│   └── static-pre-commit.sh
├── tests
│   ├── __init__.py
│   ├── conftest.py
Expand Down
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"./docker-compose.yml"
],
"service": "python-3.12-my_fastagency_app",

"secrets": {
"OPENAI_API_KEY": {
"description": "This key is optional and only needed if you are working on OpenAI-related code. Leave it blank if not required. You can always set it later as an environment variable in the codespace terminal."
Expand Down Expand Up @@ -63,4 +63,4 @@
]
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
version: '3'

services:
# nosemgrep: yaml.docker-compose.security.writable-filesystem-service.writable-filesystem-service
python-3.12-my_fastagency_app:
image: mcr.microsoft.com/devcontainers/python:3.12
container_name: my_fastagency_app-${USER}-python-3.12
volumes:
- ../:/workspaces/my_fastagency_app:cached
command: sleep infinity

env_file:
- ./devcontainer.env
security_opt:
- no-new-privileges:true
networks:
- my_fastagency_app-network

networks:
my_fastagency_app-network:
name: my_fastagency_app-${USER}-network
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
# GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
# Python
- package-ecosystem: "pip" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,3 @@ jobs:
run: pytest
env:
CONTEXT: ${{ runner.os }}-py${{ matrix.python-version }}

18 changes: 18 additions & 0 deletions docs/docs_src/getting_started/fastapi/my_fastagency_app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
__pycache__
dist
.idea
venv*
.venv*
.env
.env*
*.lock
.vscode
.pypirc
.pytest_cache
.ruff_cache
.mypy_cache
.coverage*
.cache
htmlcov
token
.DS_Store
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files

- repo: local
hooks:
- id: lint
name: Linter
entry: "scripts/lint-pre-commit.sh"
language: python
# language_version: python3.12
types: [python]
require_serial: true
verbose: true

- repo: local
hooks:
- id: static-analysis
name: Static analysis
entry: "scripts/static-pre-commit.sh"
language: python
# language_version: python3.12
types: [python]
require_serial: true
verbose: true

- repo: https://github.com/Yelp/detect-secrets
rev: v1.5.0
hooks:
- id: detect-secrets
args: ["--baseline", ".secrets.baseline"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
{
"version": "1.5.0",
"plugins_used": [
{
"name": "ArtifactoryDetector"
},
{
"name": "AWSKeyDetector"
},
{
"name": "AzureStorageKeyDetector"
},
{
"name": "Base64HighEntropyString",
"limit": 4.5
},
{
"name": "BasicAuthDetector"
},
{
"name": "CloudantDetector"
},
{
"name": "DiscordBotTokenDetector"
},
{
"name": "GitHubTokenDetector"
},
{
"name": "GitLabTokenDetector"
},
{
"name": "HexHighEntropyString",
"limit": 3.0
},
{
"name": "IbmCloudIamDetector"
},
{
"name": "IbmCosHmacDetector"
},
{
"name": "IPPublicDetector"
},
{
"name": "JwtTokenDetector"
},
{
"name": "KeywordDetector",
"keyword_exclude": ""
},
{
"name": "MailchimpDetector"
},
{
"name": "NpmDetector"
},
{
"name": "OpenAIDetector"
},
{
"name": "PrivateKeyDetector"
},
{
"name": "PypiTokenDetector"
},
{
"name": "SendGridDetector"
},
{
"name": "SlackDetector"
},
{
"name": "SoftlayerDetector"
},
{
"name": "SquareOAuthDetector"
},
{
"name": "StripeDetector"
},
{
"name": "TelegramBotTokenDetector"
},
{
"name": "TwilioKeyDetector"
}
],
"filters_used": [
{
"path": "detect_secrets.filters.allowlist.is_line_allowlisted"
},
{
"path": "detect_secrets.filters.common.is_ignored_due_to_verification_policies",
"min_level": 2
},
{
"path": "detect_secrets.filters.heuristic.is_indirect_reference"
},
{
"path": "detect_secrets.filters.heuristic.is_likely_id_string"
},
{
"path": "detect_secrets.filters.heuristic.is_lock_file"
},
{
"path": "detect_secrets.filters.heuristic.is_not_alphanumeric_string"
},
{
"path": "detect_secrets.filters.heuristic.is_potential_uuid"
},
{
"path": "detect_secrets.filters.heuristic.is_prefixed_with_dollar_sign"
},
{
"path": "detect_secrets.filters.heuristic.is_sequential_string"
},
{
"path": "detect_secrets.filters.heuristic.is_swagger_file"
},
{
"path": "detect_secrets.filters.heuristic.is_templated_secret"
}
],
"results": {},
"generated_at": "2024-11-07T10:08:12Z"
}
Loading

0 comments on commit d0bef46

Please sign in to comment.