python-tgpt
python-tgpt copied to clipboard
ERROR : 'choices'
I am working on a project which requires to run pytgpt inside a docker container, but I am getting this strange error:- ERROR : 'choices'
On doing exec inside the container, I am able to run pytgpt (indicates that is successfully installed), but on asking some question, I am getting the same error:- ERROR : 'choices'
It's running on my local environment, but won't work inside a docker container.
I am using Phind as LLM provider, example is given below:-
import pytgpt.phind as phind
llm = phind.PHIND()
try:
data = llm.ask("Hello, how are you?") #getting the error here
print(data)
print(llm.get_message(data))
except Exception as e:
print(e)
For reference, this is my Dockerfile
ARG PYTHON_VERSION=3.11
FROM python:${PYTHON_VERSION}-slim as base
# Prevents Python from writing pyc files.
ENV PYTHONDONTWRITEBYTECODE=1
# Keeps Python from buffering stdout and stderr to avoid situations where
# the application crashes without emitting any logs due to buffering.
ENV PYTHONUNBUFFERED=1
# Install system-level dependencies
RUN apt-get update -y \
&& apt-get upgrade -y \
&& apt-get install -y --no-install-recommends gcc build-essential libpython3-dev libleptonica-dev tesseract-ocr libtesseract-dev python3-pil tesseract-ocr-eng tesseract-ocr-script-latn \
&& rm -rf /var/lib/apt/lists/*
# Create a non-privileged user that the app will run under.
ARG UID=10001
RUN adduser \
--disabled-password \
--gecos "" \
--home "/home/bot" \
--shell "/sbin/nologin" \
--uid "${UID}" \
bot
# Create the home directory and set permissions
RUN chown bot:bot /home/bot
# Download dependencies as a separate step to take advantage of Docker's caching.
# Leverage a cache mount to /root/.cache/pip to speed up subsequent builds.
# Leverage a bind mount to requirements.txt to avoid having to copy them into
# into this layer.
RUN --mount=type=cache,target=/root/.cache/pip \
--mount=type=bind,source=requirements.txt,target=requirements.txt \
pip install --upgrade -r requirements.txt
# Switch to the non-privileged user and set the working directory
USER bot
WORKDIR /home/bot
# Copy the source code into the container.
COPY . .
# Run the application.
CMD ["python", "src/main.py"]
My requirements.txt
python-tgpt[all]
requests