Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenAI code interpreter (draft) #37

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
uncomment extra packages
  • Loading branch information
kharvd committed Jun 24, 2023
commit b66c87cc2b67c70787520712cbc3b6076d35567b
16 changes: 11 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
FROM python:3.9.17-alpine
FROM python:3.9.17-bullseye
WORKDIR /app

RUN apk add build-base linux-headers clang
COPY requirements.txt requirements_docker.txt ./
COPY requirements.txt ./
RUN --mount=type=cache,target=/root/.cache/pip pip install -r requirements.txt

COPY requirements_docker.txt ./
RUN --mount=type=cache,target=/root/.cache/pip pip install -r requirements_docker.txt

COPY . .

RUN adduser -D gpt
RUN mkdir -p /mnt/output

RUN adduser --disabled-password gpt
USER gpt
RUN mkdir -p $HOME/.config/gpt-cli
RUN cp /app/gpt.yml $HOME/.config/gpt-cli/gpt.yml


WORKDIR /mnt/output

ENV GPTCLI_ALLOW_CODE_EXECUTION=1
ENTRYPOINT ["python", "gpt.py"]
ENTRYPOINT ["python", "/app/gpt.py"]
7 changes: 3 additions & 4 deletions gpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
import argparse
import sys
import logging

# import google.generativeai as genai
import google.generativeai as genai
import gptcli.anthropic
from gptcli.assistant import (
Assistant,
Expand Down Expand Up @@ -178,8 +177,8 @@ def main():
if config.anthropic_api_key:
gptcli.anthropic.api_key = config.anthropic_api_key

# if config.google_api_key:
# genai.configure(api_key=config.google_api_key)
if config.google_api_key:
genai.configure(api_key=config.google_api_key)

if config.llama_models is not None:
init_llama_models(config.llama_models)
Expand Down
3 changes: 1 addition & 2 deletions gptcli/anthropic.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import os
from typing import Iterator, List

# import anthropic
import anthropic

from gptcli.completion import CompletionProvider, Message

Expand Down
3 changes: 1 addition & 2 deletions gptcli/google.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from typing import Iterator, List

# import google.generativeai as genai
import google.generativeai as genai
from gptcli.completion import CompletionProvider, Message


Expand Down
3 changes: 1 addition & 2 deletions gptcli/llama.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import os
import sys
from typing import Iterator, List, Optional, TypedDict, cast

# from llama_cpp import Completion, CompletionChunk, Llama
from llama_cpp import Completion, CompletionChunk, Llama

from gptcli.completion import CompletionProvider, Message

Expand Down
3 changes: 1 addition & 2 deletions gptcli/openai.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from typing import Any, Iterator, List, cast
import openai

# import tiktoken
import tiktoken

from gptcli.completion import Completion, CompletionProvider, Message

Expand Down
5 changes: 5 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
anthropic==0.2.8
black==23.1.0
google-generativeai==0.1.0rc2
llama-cpp-python==0.1.57
openai==0.27.8
prompt-toolkit==3.0.38
pytest==7.3.1
PyYAML==6.0
rich==13.3.2
tiktoken==0.3.3
tokenizers==0.13.3
typing_extensions==4.5.0
jupyter-client==8.2.0
imgcat==0.5.0
3 changes: 3 additions & 0 deletions requirements_docker.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@ ipython==8.14.0
ipykernel==6.23.2
numpy==1.25.0
matplotlib==3.7.1
scipy==1.10.1
scikit-learn==1.2.2
pandas==2.0.2