Skip to content

Commit

Permalink
fix aoai llm doc
Browse files Browse the repository at this point in the history
  • Loading branch information
Jack-Q committed Oct 9, 2024
1 parent 15bead1 commit 770fe0f
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 29 deletions.
5 changes: 0 additions & 5 deletions taskweaver/llm/openai.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,6 @@ def _configure(self) -> None:

# openai specific config
self.api_version = self._get_str("api_version", "2024-06-01")
self.api_auth_type = self._get_enum(
"api_auth_type",
["openai", "azure", "azure_ad"],
"openai",
)
is_azure_ad_login = self.api_type == "azure_ad"
self.aad_auth_mode = self._get_enum(
"aad_auth_mode",
Expand Down
50 changes: 26 additions & 24 deletions website/docs/llms/aoai.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,40 +8,42 @@ description: Using LLMs from OpenAI/AOAI
1. Create an account on [Azure OpenAI](https://azure.microsoft.com/en-us/products/ai-services/openai-service) and get your API key.
2. Create a new deployment of the model and get the deployment name.
3. Add the following to your `taskweaver_config.json` file:
```jsonc showLineNumbers
{
"llm.api_base":"YOUR_AOAI_ENDPOINT", // in the format of https://<my-resource>.openai.azure.com"
"llm.api_key":"YOUR_API_KEY",
"llm.api_type":"azure",
"llm.auth_mode":"api-key",
"llm.model":"gpt-4-1106-preview", // this is known as deployment_name in Azure OpenAI
"llm.response_format": "json_object"
}
```
```jsonc showLineNumbers
{
"llm.api_base":"YOUR_AOAI_ENDPOINT", // in the format of https://<my-resource>.openai.azure.com"
"llm.api_key":"YOUR_API_KEY",
"llm.api_type":"azure",
"llm.model":"gpt-4-1106-preview", // this is known as deployment_name in Azure OpenAI
"llm.response_format": "json_object",
"llm.azure.api_version": "2024-06-01"
}
```

:::info
For model versions or after `1106`, `llm.response_format` can be set to `json_object`.
However, for the earlier models, which do not support JSON response explicitly, `llm.response_format` should be set to `null`.
:::
:::info
For model versions or after `1106`, `llm.response_format` can be set to `json_object`.
However, for the earlier models, which do not support JSON response explicitly, `llm.response_format` should be set to `null`.
:::

4. Start TaskWeaver and chat with TaskWeaver.
You can refer to the [Quick Start](../quickstart.md) for more details.

You can refer to the [Quick Start](../quickstart.md) for more details.

## Using Entra Authentication

1. Create an account on [Azure OpenAI](https://azure.microsoft.com/en-us/products/ai-services/openai-service) and
[assign the proper Azure RBAC Role](https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/role-based-access-control) to your account (or service principal).
2. Create a new deployment of the model and get the deployment name.
3. Add the following to your `taskweaver_config.json` file:
```jsonc showLineNumbers
{
"llm.api_base":"YOUR_AOAI_ENDPOINT", // in the format of https://<my-resource>.openai.azure.com"
"llm.api_type":"azure_ad",
"llm.auth_mode":"default_azure_credential",
"llm.model":"gpt-4-1106-preview", // this is known as deployment_name in Azure OpenAI
"llm.response_format": "json_object"
}
```
```jsonc showLineNumbers
{
"llm.api_base":"YOUR_AOAI_ENDPOINT", // in the format of https://<my-resource>.openai.azure.com"
"llm.api_type":"azure_ad",
"llm.model":"gpt-4-1106-preview", // this is known as deployment_name in Azure OpenAI
"llm.response_format": "json_object",
"llm.azure_ad.api_version": "2024-06-01",
"llm.azure_ad.aad_auth_mode": "default_azure_credential"
}
```
4. Install extra dependencies:
```bash
pip install azure-identity
Expand Down

0 comments on commit 770fe0f

Please sign in to comment.