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

Remove getpass add prompt_toolkit #991

Merged
merged 2 commits into from
Feb 4, 2024
Merged
Changes from all commits
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
7 changes: 4 additions & 3 deletions interpreter/core/computer/ai/ai.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import getpass
import os
from concurrent.futures import ThreadPoolExecutor

import openai
import tiktoken
from prompt_toolkit import prompt


def split_into_chunks(text, tokens, model, overlap):
Expand Down Expand Up @@ -106,9 +106,10 @@ def query(self, text, query, custom_reduce_query=None):
# Retrieve OpenAI API key
openai_api_key = os.getenv("OPENAI_API_KEY")
if openai_api_key is None:
openai_api_key = getpass.getpass(
prompt="Please enter your OpenAI API key: "
openai_api_key = prompt(
"Please enter your OpenAI API key: ", is_password=True
)

openai.api_key = openai_api_key

model = "gpt-3.5-turbo"
Expand Down
Loading