|
52 | 52 | "cell_type": "markdown", |
53 | 53 | "metadata": {}, |
54 | 54 | "source": [ |
55 | | - "When using the OpenAI client library, the `key` and `endpoint` for the Azure OpenAI service will be needed. This will enable the application to make API calls against the Azure OpenAI service.\n", |
| 55 | + "When using the OpenAI client library, the Azure OpenAI `key` and `endpoint` for the service are needed. In this case, ensure the Azure OpenAI `key` and `endpoint` is located in a `.env` file in the root of this project, you will need to create this file. The `.env` file should contain the following values (replace the value with your own `key` and `endpoint`):\n", |
56 | 56 | "\n", |
57 | | - "It is helpful to set these as environment variables, then reference those environment variables from code.\n", |
| 57 | + "AOAI_ENDPOINT = \"https://<resource>.openai.azure.com/\"\n", |
58 | 58 | "\n", |
59 | | - "Here's an example of this using the recommended environment variable names:\n", |
60 | | - "\n", |
61 | | - "```bash\n", |
62 | | - "// Azure OpenAI Key\n", |
63 | | - "export AOAI_KEY=\"REPLACE_WITH_YOUR_KEY_VALUE_HERE\"\n", |
64 | | - "// Azure OpenAI Endpoint\n", |
65 | | - "export AOAI_ENDPOINT=\"REPLACE_WITH_YOUR_ENDPOINT_HERE\"\n", |
66 | | - "```" |
| 59 | + "AOAI_KEY = \"<key>\"\n" |
67 | 60 | ] |
68 | 61 | }, |
69 | 62 | { |
70 | 63 | "cell_type": "markdown", |
71 | 64 | "metadata": {}, |
72 | 65 | "source": [ |
73 | | - "Include the following imports in the python code so the app can use the OpenAI library, as well as `os` to access the environment variables." |
| 66 | + "The following imports are neded in python so the app can use the OpenAI library, as well as `os` to access the environment variables, and `dotenv` is used here to load environment variables from the `.env` file." |
74 | 67 | ] |
75 | 68 | }, |
76 | 69 | { |
|
119 | 112 | ")" |
120 | 113 | ] |
121 | 114 | }, |
| 115 | + { |
| 116 | + "cell_type": "markdown", |
| 117 | + "metadata": {}, |
| 118 | + "source": [ |
| 119 | + "> **Note**: The `api_version` is included to specify the API version for calls to the Azure OpenAI service." |
| 120 | + ] |
| 121 | + }, |
122 | 122 | { |
123 | 123 | "cell_type": "markdown", |
124 | 124 | "metadata": {}, |
|
152 | 152 | "\n", |
153 | 153 | "print(chatResponse.choices[0].message.content)" |
154 | 154 | ] |
| 155 | + }, |
| 156 | + { |
| 157 | + "cell_type": "markdown", |
| 158 | + "metadata": {}, |
| 159 | + "source": [ |
| 160 | + "> **Note**: The [`openai` Python library documentation](https://platform.openai.com/docs/guides/text-generation/chat-completions-api) has further information on making Chat Completion calls to the service." |
| 161 | + ] |
155 | 162 | } |
156 | 163 | ], |
157 | 164 | "metadata": { |
|
0 commit comments