Skip to content

Commit

Permalink
Switch the example to use mesop UI instead of console UI in adapter d…
Browse files Browse the repository at this point in the history
…ocs (#465)

* Update example to use mesop interface in autogen docs

* Update example to use mesop interface in 'using non-openai models' doc section

* Update example to use mesop interface in 'using non-openai models' doc section

* Remove unwanted tests

* Exclude Mesop examples in tests for Python 3.9

* Add mesop doc_src examples inside a sub directory

* Revert changes in test file

* Fix tests

* Fix review comments
  • Loading branch information
harishmohanraj authored Oct 23, 2024
1 parent 14b086a commit aac94b6
Show file tree
Hide file tree
Showing 14 changed files with 202 additions and 264 deletions.
1 change: 0 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
*.jpg filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
app/public/public-banner.png filter=lfs diff=lfs merge=lfs -text
docs/docs/en/tutorial/giphy/images/gifs.png filter=lfs diff=lfs merge=lfs -text
docs/docs/en/tutorial/giphy/images/initial_message.png filter=lfs diff=lfs merge=lfs -text
Expand Down
20 changes: 20 additions & 0 deletions .secrets.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,26 @@
"is_secret": false
}
],
"docs/docs/en/user-guide/runtimes/autogen/index.md": [
{
"type": "Secret Keyword",
"filename": "docs/docs/en/user-guide/runtimes/autogen/index.md",
"hashed_secret": "73b01af8d354687c7c330d91a744f9906b9f30da",
"is_verified": false,
"line_number": 46,
"is_secret": false
}
],
"docs/docs/en/user-guide/runtimes/autogen/using_non_openai_models.md": [
{
"type": "Secret Keyword",
"filename": "docs/docs/en/user-guide/runtimes/autogen/using_non_openai_models.md",
"hashed_secret": "29df8e701c64566b0035b6283fb2f7b41a0d65f2",
"is_verified": false,
"line_number": 55,
"is_secret": false
}
],
"docs/docs_src/getting_started/nats_n_fastapi/nats-server.conf": [
{
"type": "Secret Keyword",
Expand Down
4 changes: 2 additions & 2 deletions docs/docs/en/getting-started/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -393,11 +393,11 @@ Once everything is set up, you can run your FastAgency application using the fol
```

!!! danger "Currently not working on **MacOS**"
The above command is currently not working on **MacOS**, please use the alternative way of starting the application from below ([#362](https://github.com/airtai/fastagency/issues/362)).
The above command is currently not working on **MacOS**, please use the alternative way of starting the application from below ([#362](https://github.com/airtai/fastagency/issues/362){target="_blank"}).

2. Using [Gunicorn](https://gunicorn.org/){target="_blank"} WSGI HTTP server:

The preferred way to run the Mesop application is using a Python WSGI HTTP server like [Gunicorn](https://gunicorn.org/){target="_blank"}. First, you need to install it using package manager such as `pip` and then run it as follows:
The preferred way to run the [**Mesop**](https://google.github.io/mesop/){target="_blank"} application is using a Python WSGI HTTP server like [**Gunicorn**](https://gunicorn.org/){target="_blank"}. First, you need to install it using package manager such as `pip` and then run it as follows:

!!! note "Terminal (using [Gunicorn](https://gunicorn.org/){target="_blank"})"
```
Expand Down
4 changes: 2 additions & 2 deletions docs/docs/en/tutorial/giphy/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,11 @@ There are two options of running a Mesop application:
```

!!! danger "Currently not working on **MacOS**"
The above command is currently not working on **MacOS**, please use the alternative way of starting the application from below ([#362](https://github.com/airtai/fastagency/issues/362)).
The above command is currently not working on **MacOS**, please use the alternative way of starting the application from below ([#362](https://github.com/airtai/fastagency/issues/362){target="_blank"}).

2. Using [Gunicorn](https://gunicorn.org/){target="_blank"} WSGI HTTP server:

The preferred way to run the Mesop application is using a Python WSGI HTTP server like [Gunicorn](https://gunicorn.org/){target="_blank"}. First, you need to install it using package manager such as `pip` and then run it as follows:
The preferred way to run the [**Mesop**](https://google.github.io/mesop/){target="_blank"} application is using a Python WSGI HTTP server like [**Gunicorn**](https://gunicorn.org/){target="_blank"}. First, you need to install it using package manager such as `pip` and then run it as follows:

!!! note "Terminal (using [Gunicorn](https://gunicorn.org/){target="_blank"})"
```
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
150 changes: 95 additions & 55 deletions docs/docs/en/user-guide/runtimes/autogen/index.md

Large diffs are not rendered by default.

198 changes: 60 additions & 138 deletions docs/docs/en/user-guide/runtimes/autogen/using_non_openai_models.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/docs/en/user-guide/ui/mesop/basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,9 @@ There are two options of running a Mesop application:
!!! danger "Currently not working on **MacOS**"
The above command is currently not working on **MacOS**, please use the alternative way of starting the application from below ([#362](https://github.com/airtai/fastagency/issues/362){target="_blank"}).

2. Using [Gunicorn](https://gunicorn.org/){target="_blank"} WSGI HTTP server:
2. Using [**Gunicorn**](https://gunicorn.org/){target="_blank"} WSGI HTTP server:

The preferred way to run the Mesop application is using a Python WSGI HTTP server like [Gunicorn](https://gunicorn.org/){target="_blank"}. First, you need to install it using package manager such as `pip` and then run it as follows:
The preferred way to run the [**Mesop**](https://google.github.io/mesop/){target="_blank"} application is using a Python WSGI HTTP server like [**Gunicorn**](https://gunicorn.org/){target="_blank"}. First, you need to install it using package manager such as `pip` and then run it as follows:

!!! note "Terminal (using [Gunicorn](https://gunicorn.org/){target="_blank"})"
```
Expand Down
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from fastagency import UI, FastAgency
from fastagency.api.openapi import OpenAPI
from fastagency.runtimes.autogen import AutoGenWorkflows
from fastagency.ui.console import ConsoleUI
from fastagency.ui.mesop import MesopUI

llm_config = {
"config_list": [
Expand All @@ -23,6 +23,12 @@

weather_api = OpenAPI.create(openapi_url=openapi_url)

weather_agent_system_message = """You are a weather agent. When asked
for weather, always call the function to get real-time data immediately.
Do not respond until the data is retrieved. Provide the actual weather
concisely based only on the real-time data from the function. Do not
use any pre-existing knowledge or memory."""

wf = AutoGenWorkflows()


Expand All @@ -41,10 +47,11 @@ def weather_workflow(
system_message="You are a user agent",
llm_config=llm_config,
human_input_mode="NEVER",
code_execution_config=False
)
weather_agent = ConversableAgent(
name="Weather_Agent",
system_message="You are a weather agent",
system_message=weather_agent_system_message,
llm_config=llm_config,
human_input_mode="NEVER",
)
Expand Down Expand Up @@ -74,4 +81,4 @@ def weather_workflow(
return chat_result.summary # type: ignore[no-any-return]


app = FastAgency(provider=wf, ui=ConsoleUI())
app = FastAgency(provider=wf, ui=MesopUI())
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from fastagency import UI, FastAgency
from fastagency.api.openapi import OpenAPI
from fastagency.runtimes.autogen import AutoGenWorkflows
from fastagency.ui.console import ConsoleUI
from fastagency.ui.mesop import MesopUI

llm_config = {
"config_list": [
Expand All @@ -24,12 +24,11 @@
openapi_url = "https://weather.tools.fastagency.ai/openapi.json"
weather_api = OpenAPI.create(openapi_url=openapi_url)

weather_agent_system_message = """You are a real-time weather agent. When asked
weather_agent_system_message = """You are a weather agent. When asked
about the weather for a specific city, NEVER provide any information from
memory. ALWAYS respond with: "Please wait while I fetch the weather data for
[city name]..." and immediately call the provided function to retrieve
real-time data for that city. Be concise in your response. Only handle one
city request at a time."""
memory. ALWAYS respond with: "Please hold on while I retrieve the real-time
weather data for [city name]." and immediately call the provided function to
retrieve real-time data for that city. Be concise in your response."""

wf = AutoGenWorkflows()

Expand All @@ -48,6 +47,7 @@ def weather_workflow(
system_message="You are a user agent",
llm_config=llm_config,
human_input_mode="NEVER",
code_execution_config=False
)
weather_agent = ConversableAgent(
name="Weather_Agent",
Expand Down Expand Up @@ -81,4 +81,4 @@ def weather_workflow(
return chat_result.summary # type: ignore[no-any-return]


app = FastAgency(provider=wf, ui=ConsoleUI())
app = FastAgency(provider=wf, ui=MesopUI())
1 change: 1 addition & 0 deletions tests/docs_src/test_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ def test_submodules(module: str) -> None:
module.startswith("docs_src.user_guide.ui.mesop")
or module == "docs_src.tutorial.giphy"
or module == "docs_src.tutorial.whatsapp"
or module == "docs_src.user_guide.runtimes.autogen.mesop"
):
pass
elif ("mesop" in module) or ("giphy" in module) or ("whatsapp" in module):
Expand Down
25 changes: 0 additions & 25 deletions tests/docs_src/user_guide/runtimes/autogen/test_main.py

This file was deleted.

This file was deleted.

0 comments on commit aac94b6

Please sign in to comment.