Skip to content

Commit

Permalink
docs: added documentation for Google, HuggingFace and LangChain
Browse files Browse the repository at this point in the history
Signed-off-by: Kannav02 <[email protected]>
  • Loading branch information
Kannav02 committed Jan 15, 2025
1 parent 7bf3e61 commit b2f94b1
Showing 1 changed file with 87 additions and 2 deletions.
89 changes: 87 additions & 2 deletions backend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,88 @@ copy .env.example .env

### Setting Up Google API Key and Credentials Variables

### Setting Up Langchain Variables
There are 2 variables that needs to be set up

- `GOOGLE_API_KEY`

This key is used to access the various google cloud functions.
- Go to [Google Cloud Console](https://console.cloud.google.com/)
- Create new project or select existing one
- Enable required APIs:
- Google Gemini API
- Vertex AI API
- Go to APIs & Services > Credentials
- Click "Create Credentials" > "API Key"
- Copy the generated key and it to the `.env` file

- `GOOGLE_APPLICATION_CREDENTIALS`
Since most of the GCP functions / services would be used by our app, we need to have a special credential that would allow `ORAssistant`'s access to the GCP
Steps to set up Service Account Credentials:
- In Google Cloud Console, go to IAM & Admin > Service Accounts
- Click "Create Service Account"
Fill in service account details
- Grant required roles:
- Vertex AI User
- Vertex AI Service Agent
- Create key (JSON format)
- Download JSON file
- Store securely and add path to .env:
`GOOGLE_APPLICATION_CREDENTIALS=/path/to/credentials.json`

NOTE: The user might need billing to be set up on google cloud account and make sure to name the file as `credentials.json` as this would be ignored by `.git` and wouldn't be exposed on Github

### Setting Up LangChain Variables

There are 4 variables that needs to be set up

- `LANGCHAIN_TRACING_V2`

This is used to enable LangChain's debugging and monitoring features,
can be set to either `true` or `false`

- `LANGCHAIN_ENDPOINT`

The URL endpoint for LangSmith (LangChain's monitoring platform).
Default value should be "https://api.smith.langchain.com" for cloud-hosted LangSmith.
Used to send trace data, metrics, and debugging information from your LangChain applications.

- `LANGCHAIN_API_KEY`

API key required to authenticate with LangSmith platform.
- Get your key from: https://smith.langchain.com/
- Create account if you don't have one
- Navigate to Settings > API Keys
- Create new API key
- Format: starts with "lsv2_" followed by a unique string

- `LANGCHAIN_PROJECT`
Project identifier in LangSmith to organize and track your traces.
- Create new project in LangSmith dashboard
- Use the project name or ID provided
- Example: "my-rag-project"
- Helps organize different applications/environments
- Multiple apps can share same project


### Setting Up Huggingface User Access Token

To set up the `HF_TOKEN` variable in `.env` file , go through the following instructions:

- Go the official website for [Huggingface](https://huggingface.co/) and either Login or Sign up.
-
- On the main page click on user access token

![User Access Token Image](./assets/user_access_token.png)

- Click on create access token

![Create Access Token](./assets/token_page.png)
- Provide only Read Instruction for the token and Click on Generate Token

![Permission Token](./assets/permission_token.png)


Provide the value for `HF_TOKEN` with the token that is generated

## Running the Application

### Install Required Packages
Expand All @@ -39,6 +113,17 @@ Ensure you have the necessary dependencies installed by running:
```bash
pip install -r requirements.txt
```
### Docker Command

If you want to run an isolated container for backend, you can use the following command

```
docker build -t (image_name) .
```

Make sure you are in the backend folder before running the above command\

NOTE: The project does support a `docker-compose` file that would run all of the containers together

## License

Expand Down

0 comments on commit b2f94b1

Please sign in to comment.