Skip to content

Commit

Permalink
Merge pull request EmergenceAI#63 from cedricvidal/azure_support
Browse files Browse the repository at this point in the history
Add support for configuring AutoGen's `api_type` and `api_version` in order to support Azure models
  • Loading branch information
teaxio authored Jul 4, 2024
2 parents 896d23c + 7fc2a0d commit 6cae89c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ While Agent-E is growing, it is already equipped to handle a versatile range of
- .env file in project root is needed with the following (sample `.env-example` is included for convience):
- Follow the directions in the sample file
- You will need to set `AUTOGEN_MODEL_NAME` (for example `gpt-4-turbo-preview`) and `AUTOGEN_MODEL_API_KEY`
- If you are using a model other than OpenAI, you need to set `AUTOGEN_MODEL_BASE_URL` for example `https://api.groq.com/openai/v1`
- If you are using a model other than OpenAI, you need to set `AUTOGEN_MODEL_BASE_URL` for example `https://api.groq.com/openai/v1` or `https://<REPLACE_AI_SERVICES>.openai.azure.com` on [Azure](https://azure.microsoft.com/).
- For [Azure](https://azure.microsoft.com/), you'll also need to configure `AUTOGEN_MODEL_API_TYPE=azure` and `AUTOGEN_MODEL_API_VERSION` (for example `2023-03-15-preview`) variables.
- If you want to use local chrome browser over playwright browser, go to chrome://version/ in chrome, find the path to your profile and set `BROWSER_STORAGE_DIR` to the path value

### pip issues
Expand Down
6 changes: 6 additions & 0 deletions ae/core/autogen_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@ async def create(cls, agents_needed: list[str] | None = None, max_chat_round: in
if os.getenv("AUTOGEN_MODEL_BASE_URL"):
model_info["base_url"] = os.getenv("AUTOGEN_MODEL_BASE_URL") # type: ignore

if os.getenv("AUTOGEN_MODEL_API_TYPE"):
model_info["api_type"] = os.getenv("AUTOGEN_MODEL_API_TYPE") # type: ignore

if os.getenv("AUTOGEN_MODEL_API_VERSION"):
model_info["api_version"] = os.getenv("AUTOGEN_MODEL_API_VERSION") # type: ignore

env_var: list[dict[str, str]] = [model_info]
with tempfile.NamedTemporaryFile(delete=False, mode='w') as temp:
json.dump(env_var, temp)
Expand Down
6 changes: 3 additions & 3 deletions ae/core/prompts.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
Return Format:
Your reply will strictly be a well-fromatted JSON with four attributes.
"plan": This contains the high-level plan. This is optional and needs to be present only when a task starts and when the plan needs to be revised.
"next_step": A detailed next step consistent with the plan. The next step will be delegated to the helper to execute. This needs to be present for every response except when terminating
"plan": This is a string that contains the high-level plan. This is optional and needs to be present only when a task starts and when the plan needs to be revised.
"next_step": This is a string that contains a detailed next step that is consistent with the plan. The next step will be delegated to the helper to execute. This needs to be present for every response except when terminating
"terminate": yes/no. Return yes when the exact task is complete without any compromises or you are absolutely convinced that the task cannot be completed, no otherwise. This is mandatory for every response.
"final_response": This is the final answer that will be returned to the user. In search tasks, unless explicitly stated, you will provide the single best suited result in the response instead of listing multiple options. This attribute only needs to be present when terminate is true.
"final_response": This is the final answer string that will be returned to the user. In search tasks, unless explicitly stated, you will provide the single best suited result in the response instead of listing multiple options. This attribute only needs to be present when terminate is true.
Capabilities and limitation of the helper:
1. Helper can navigate to urls, perform simple interactions on a page or answer any question you may have about the current page.
Expand Down

0 comments on commit 6cae89c

Please sign in to comment.