|
| 1 | +# Introduction |
| 2 | +This repository shows how to setup and use Azure OpenAI models' API with LangChain. |
| 3 | + |
| 4 | +## Installation |
| 5 | +Install all Python modules and packages listed in the requirements.txt file using the below command. |
| 6 | + |
| 7 | +```python |
| 8 | +pip install -r requirements.txt |
| 9 | +``` |
| 10 | + |
| 11 | +### Microsoft Azure Endpoints |
| 12 | +In order to use the Open AI library or REST API with Microsoft Azure endpoints, you need to set DEPLOYMENT_NAME, OPENAI_API_BASE & OPENAI_API_VERSION in _config.json_ file. |
| 13 | + |
| 14 | +```js |
| 15 | +{ |
| 16 | + "DEPLOYMENT_NAME":"<Model Deployment Name>", |
| 17 | + "OPENAI_API_BASE":"https://<Your Azure Resource Name>.openai.azure.com", |
| 18 | + "OPENAI_API_VERSION":"<OpenAI API Version>" |
| 19 | +} |
| 20 | +``` |
| 21 | + |
| 22 | +### For getting started: |
| 23 | +- Add "OPENAI_API_KEY" as variable name and \<Your API Key Value\> as variable value in the environment variables. |
| 24 | +<br> |
| 25 | +One can get the OPENAI_API_KEY value from the Azure Portal. Go to https://portal.azure.com, find your resource and then under "Resource Management" -> "Keys and Endpoints" look for one of the "Keys" values. |
| 26 | + <br> |
| 27 | + |
| 28 | + WINDOWS Users: |
| 29 | + setx OPENAI_API_KEY "REPLACE_WITH_YOUR_KEY_VALUE_HERE" |
| 30 | + |
| 31 | + MACOS/LINUX Users: |
| 32 | + export OPENAI_API_KEY="REPLACE_WITH_YOUR_KEY_VALUE_HERE" |
| 33 | + |
| 34 | +- To find your "DEPLOYMENT_NAME" go to the deployments page of the Azure AI Studio. Create a deployment if one does not already exist. |
| 35 | +One can start with using your model name as "gpt-35-turbo-0613" or "gpt-4." |
| 36 | + |
| 37 | +- To find your "OPENAI_API_BASE" go to https://portal.azure.com, find your resource and then under "Resource Management" -> "Keys and Endpoints" look for the "Endpoint" value. |
| 38 | + |
| 39 | +- Check out versions [here](https://learn.microsoft.com/en-us/azure/cognitive-services/openai/reference). |
| 40 | + |
| 41 | + |
| 42 | +## Requirements |
| 43 | +Python 3.8+ <br> |
| 44 | +Jupyter Notebook 6.5.2 |
| 45 | + |
| 46 | +<br> |
| 47 | + |
| 48 | +## Trademarks |
| 49 | + |
| 50 | +This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft |
| 51 | +trademarks or logos is subject to and must follow |
| 52 | +[Microsoft's Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general). |
| 53 | +Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. |
| 54 | +Any use of third-party trademarks or logos are subject to those third-party's policies. |
0 commit comments