Skip to content

Commit

Permalink
Merge pull request #32 from fosteramanda/main
Browse files Browse the repository at this point in the history
Adding LangChain Quickstart
  • Loading branch information
Derek Legenzoff authored Aug 15, 2023
2 parents 34b6fcb + 8dd46e8 commit ad3941e
Show file tree
Hide file tree
Showing 4 changed files with 429 additions and 0 deletions.
54 changes: 54 additions & 0 deletions Basic_Samples/LangChain/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Introduction
This repository shows how to setup and use Azure OpenAI models' API with LangChain.

## Installation
Install all Python modules and packages listed in the requirements.txt file using the below command.

```python
pip install -r requirements.txt
```

### Microsoft Azure Endpoints
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.

```js
{
"DEPLOYMENT_NAME":"<Model Deployment Name>",
"OPENAI_API_BASE":"https://<Your Azure Resource Name>.openai.azure.com",
"OPENAI_API_VERSION":"<OpenAI API Version>"
}
```

### For getting started:
- Add "OPENAI_API_KEY" as variable name and \<Your API Key Value\> as variable value in the environment variables.
<br>
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.
<br>
WINDOWS Users:
setx OPENAI_API_KEY "REPLACE_WITH_YOUR_KEY_VALUE_HERE"

MACOS/LINUX Users:
export OPENAI_API_KEY="REPLACE_WITH_YOUR_KEY_VALUE_HERE"

- To find your "DEPLOYMENT_NAME" go to the deployments page of the Azure AI Studio. Create a deployment if one does not already exist.
One can start with using your model name as "gpt-35-turbo-0613" or "gpt-4."

- 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.

- Check out versions [here](https://learn.microsoft.com/en-us/azure/cognitive-services/openai/reference).


## Requirements
Python 3.8+ <br>
Jupyter Notebook 6.5.2

<br>

## Trademarks

This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft
trademarks or logos is subject to and must follow
[Microsoft's Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general).
Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.
Any use of third-party trademarks or logos are subject to those third-party's policies.
5 changes: 5 additions & 0 deletions Basic_Samples/LangChain/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"DEPLOYMENT_NAME":"<Model Deployment Name>",
"OPENAI_API_BASE":"https://<Your Azure Resource Name>.openai.azure.com",
"OPENAI_API_VERSION":"<OpenAI API Version>"
}
9 changes: 9 additions & 0 deletions Basic_Samples/LangChain/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Packages needed to call AOAI API with the OpenAI Python API
openai

# Packages needed to run the notebook samples
jupyter

# Other packages needed to run the notebook samples
langchain
json
Loading

0 comments on commit ad3941e

Please sign in to comment.