Skip to content

Commit

Permalink
GCP credential fixes (#23)
Browse files Browse the repository at this point in the history
* Adds Vertex as an option, query param saving

* GCP credential fixes
  • Loading branch information
jacoblee93 authored Oct 20, 2023
1 parent 5dd0929 commit 4f007ac
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy-production.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- uses: actions/checkout@v3
- uses: superfly/flyctl-actions/setup-flyctl@master
- name: Write Google Vertex credentials file
run: echo "${{ secrets.GOOGLE_VERTEX_AI_CREDENTIALS }}" > .google_vertex_ai_credentials.json
run: echo "${{ secrets.GOOGLE_VERTEX_AI_CREDENTIALS }}" > ./.google_vertex_ai_credentials.json
- run: flyctl deploy --wait-timeout 600
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ COPY ./pyproject.toml ./poetry.lock* ./

RUN poetry install --no-interaction --no-ansi --no-root --no-directory

COPY ./*.py ./
COPY ./*.py ./.google_vertex_ai_credentials.jso[n] ./

RUN poetry install --no-interaction --no-ansi

Expand Down
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@ If you'd like to add or swap in different base retrievers (e.g. if you want to u
export OPENAI_API_KEY=
export TAVILY_API_KEY=
# for Anthropic and Vertex models
# for Anthropic
# remove models from code if unused
ANTHROPIC_API_KEY=
GOOGLE_APPLICATION_CREDENTIALS=
# if you'd like to use the You.com retriever
export YDC_API_KEY=
Expand All @@ -36,6 +35,10 @@ export LANGCHAIN_ENDPOINT="https://api.smith.langchain.com"
export LANGCHAIN_API_KEY=
export LANGCHAIN_PROJECT=
```

You will also need to put your Google Cloud credentials in a JSON file under `.google_vertex_ai_credentials.json` in the main directory if you would like to
use Google Vertex as an option. If you're not using Vertex, you'll need to remove `ChatVertexAI` from `main.py`.

3. Start the Python backend with `poetry run make start`.
4. Install frontend dependencies by running `cd nextjs`, then `yarn`.
5. Run the frontend with `yarn dev` for frontend.
Expand Down
4 changes: 4 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,10 @@ def create_chain(
)


dir_path = os.path.dirname(os.path.realpath(__file__))

os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = dir_path + "/" + ".google_vertex_ai_credentials.json"

llm = ChatOpenAI(
model="gpt-3.5-turbo-16k",
# model="gpt-4",
Expand Down

0 comments on commit 4f007ac

Please sign in to comment.