Skip to content

Commit c12d668

Browse files
authored
Langchain 0.2 (#24)
* langchain==0.2 * python 3.12 * langchain_community * readme update
1 parent 6639c93 commit c12d668

7 files changed

+23
-19
lines changed

Dockerfile

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2023 Nils Knieling
1+
# Copyright 2023-2024 Nils Knieling
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -12,16 +12,16 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
# The python:3.11-slim tag points to the latest release based on Debian 12 (bookworm)
16-
FROM python:3.11-slim
15+
# The python:3.12-slim tag points to the latest release based on Debian 12 (bookworm)
16+
FROM python:3.12-slim
1717

1818
# Labels
1919
LABEL org.opencontainers.image.title "OpenAI API for Google Cloud Vertex AI"
2020
LABEL org.opencontainers.image.description "Drop-in replacement REST API for Google Cloud Vertex AI that is compatible with the OpenAI API specifications"
21-
LABEL org.opencontainers.image.url "https://hub.docker.com/r/cyclenerd/google-cloud-gcp-openai-api"
21+
LABEL org.opencontainers.image.url "https://github.com/Cyclenerd/google-cloud-gcp-openai-api"
2222
LABEL org.opencontainers.image.authors "https://github.com/Cyclenerd/google-cloud-gcp-openai-api/graphs/contributors"
2323
LABEL org.opencontainers.image.documentation "https://github.com/Cyclenerd/google-cloud-gcp-openai-api/blob/master/README.md"
24-
LABEL org.opencontainers.image.source "https://github.com/Cyclenerd/google-cloud-gcp-openai-api/pkgs/container/google-cloud-gcp-openai-api"
24+
LABEL org.opencontainers.image.source "https://github.com/Cyclenerd/google-cloud-gcp-openai-api/blob/master/Dockerfile"
2525

2626
# Log Python messages immediately instead of being buffered
2727
ENV PYTHONUNBUFFERED True

README.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -91,16 +91,19 @@ bash deploy.sh
9191
9292
## Running Locally
9393
94-
The software was tested on GNU/Linux and macOS with Python 3.11.
94+
The software was tested on GNU/Linux and macOS with Python 3.12.
9595
If you want to use the software under Windows, you must set the environment variables with `set` instead of `export`.
96+
9697
You should also create a [virtual environment](https://docs.python.org/3/library/venv.html) with the version of Python you want to use, and activate it before proceeding.
9798
9899
You also need the [Google Cloud CLI](https://cloud.google.com/sdk/docs/install).
99100
The Google Cloud CLI includes the `gcloud` command-line tool.
100101
101-
Install requirements:
102+
Initiate a Python virtual environment and install requirements:
102103
103104
```bash
105+
python3 -m venv .venv && \
106+
source .venv/bin/activate && \
104107
pip install -r requirements.txt
105108
```
106109

Vertex_AI_Chat.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
},
99
"outputs": [],
1010
"source": [
11-
"# Copyright 2023 Nils Knieling\n",
11+
"# Copyright 2023-2024 Nils Knieling\n",
1212
"#\n",
1313
"# Licensed under the Apache License, Version 2.0 (the \"License\");\n",
1414
"# you may not use this file except in compliance with the License.\n",

chatbot-ui.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22

3-
# Copyright 2023 Nils Knieling
3+
# Copyright 2023-2024 Nils Knieling
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.

deploy.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22

3-
# Copyright 2023 Nils Knieling
3+
# Copyright 2023-2024 Nils Knieling
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.

requirements.txt

+8-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
fastapi==0.109.1
2-
uvicorn==0.24.0
3-
pydantic==1.10.13
4-
sse-starlette==1.8.2
5-
langchain==0.1.11
6-
transformers==4.38.0
7-
google-cloud-aiplatform==1.38.1
1+
fastapi==0.111.0
2+
uvicorn==0.30.1
3+
pydantic==1.10.15
4+
sse-starlette==2.1.0
5+
langchain==0.2.1
6+
langchain-community==0.2.1
7+
transformers==4.41.2
8+
google-cloud-aiplatform==1.53.0

vertex.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env python3
22

3-
# Copyright 2023 Nils Knieling
3+
# Copyright 2023-2024 Nils Knieling
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.
@@ -35,7 +35,7 @@
3535

3636
# LangChain
3737
import langchain
38-
from langchain.chat_models import ChatVertexAI
38+
from langchain_community.chat_models import ChatVertexAI
3939
from langchain.chains import ConversationChain
4040
from langchain.memory import ConversationBufferMemory
4141

0 commit comments

Comments
 (0)