Skip to content

Commit

Permalink
Merge branch 'master' into feature/multi-agent
Browse files Browse the repository at this point in the history
  • Loading branch information
Appointat committed Nov 12, 2023
2 parents f50ba8b + a8639ac commit cfb95b3
Show file tree
Hide file tree
Showing 99 changed files with 1,275 additions and 395 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/pytest_package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ jobs:
OPENAI_API_KEY: "${{ secrets.OPENAI_API_KEY }}"
GOOGLE_API_KEY: "${{ secrets.GOOGLE_API_KEY }}"
SEARCH_ENGINE_ID: "${{ secrets.SEARCH_ENGINE_ID }}"
OPENWEATHERMAP_API_KEY: "${{ secrets.OPENWEATHERMAP_API_KEY }}"
run: poetry run pytest --fast-test-mode test/

pytest_package_llm_test:
Expand All @@ -42,6 +43,7 @@ jobs:
OPENAI_API_KEY: "${{ secrets.OPENAI_API_KEY }}"
GOOGLE_API_KEY: "${{ secrets.GOOGLE_API_KEY }}"
SEARCH_ENGINE_ID: "${{ secrets.SEARCH_ENGINE_ID }}"
OPENWEATHERMAP_API_KEY: "${{ secrets.OPENWEATHERMAP_API_KEY }}"
run: poetry run pytest --llm-test-only test/

pytest_package_very_slow_test:
Expand All @@ -57,4 +59,5 @@ jobs:
OPENAI_API_KEY: "${{ secrets.OPENAI_API_KEY }}"
GOOGLE_API_KEY: "${{ secrets.GOOGLE_API_KEY }}"
SEARCH_ENGINE_ID: "${{ secrets.SEARCH_ENGINE_ID }}"
OPENWEATHERMAP_API_KEY: "${{ secrets.OPENWEATHERMAP_API_KEY }}"
run: poetry run pytest --very-slow-test-only test/
13 changes: 12 additions & 1 deletion apps/agents/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,15 @@
Run the app:
```
python agents.py --api-key=YOUR-OPENAI-API-KEY
```
```

# Deploy the app to Huggingface

This app in Camel repo does not get deployed to Huggingface automatically. The process of deployment is manual at the moment.
1. Make changes in Camel (this) repo, and thoroughly debug them on a dev machine.
2. Tag the commit that you want to deploy with tag hf_spaces_{X+1} where X must be looked up in [HF repo sync script](https://huggingface.co/spaces/camel-ai/camel-agents/blob/main/sync.sh). Do not forget to `git push --tags`.
3. Clone [HF repo](https://huggingface.co/spaces/camel-ai/camel-agents/) locally.
4. Update the tag.
5. Synchronize the changes by running [HF repo sync script](https://huggingface.co/spaces/camel-ai/camel-agents/blob/main/sync.sh)
6. Commit and push to HF.
7. HF will deploy the app automatically. Make sure that the app is built well on HF and is up and running.
13 changes: 4 additions & 9 deletions apps/agents/agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,12 @@

import gradio as gr
import openai
import openai.error
import tenacity

from apps.agents.text_utils import split_markdown_code
from camel.agents import TaskSpecifyAgent
from camel.messages import BaseMessage
from camel.societies import RolePlaying
from camel.typing import TaskType
from camel.types import TaskType

REPO_ROOT = os.path.realpath(
os.path.join(os.path.dirname(os.path.abspath(__file__)), "../.."))
Expand Down Expand Up @@ -196,8 +194,7 @@ def role_playing_start(
extend_task_specify_meta_dict=meta_dict,
output_language=language,
)
except (openai.error.RateLimitError, tenacity.RetryError,
RuntimeError) as ex:
except (openai.RateLimitError, RuntimeError) as ex:
print("OpenAI API exception 0 " + str(ex))
return (state, str(ex), "", [], gr.update())

Expand Down Expand Up @@ -247,8 +244,7 @@ def role_playing_chat_init(state) -> \
try:
init_assistant_msg: BaseMessage
init_assistant_msg, _ = session.init_chat()
except (openai.error.RateLimitError, tenacity.RetryError,
RuntimeError) as ex:
except (openai.RateLimitError, RuntimeError) as ex:
print("OpenAI API exception 1 " + str(ex))
state.session = None
return state, state.chat, gr.update()
Expand Down Expand Up @@ -289,8 +285,7 @@ def role_playing_chat_cont(state) -> \
try:
assistant_response, user_response = session.step(
state.saved_assistant_msg)
except (openai.error.RateLimitError, tenacity.RetryError,
RuntimeError) as ex:
except (openai.RateLimitError, RuntimeError) as ex:
print("OpenAI API exception 2 " + str(ex))
state.session = None
return state, state.chat, gr.update(), gr.update()
Expand Down
4 changes: 2 additions & 2 deletions camel/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
# =========== Copyright 2023 @ CAMEL-AI.org. All Rights Reserved. ===========
import camel.agents
import camel.configs
import camel.functions
import camel.generators
import camel.messages
import camel.prompts
import camel.typing
import camel.types
import camel.utils
import camel.functions

__version__ = '0.1.0'

Expand Down
Loading

0 comments on commit cfb95b3

Please sign in to comment.