Giter Site home page Giter Site logo

Traceback errors and KeyError about developer HOT 2 OPEN

smol-ai avatar smol-ai commented on July 23, 2024
Traceback errors and KeyError

from developer.

Comments (2)

therealron avatar therealron commented on July 23, 2024

I'm getting the same error. Did you find out what was wrong?

from developer.

boylucky avatar boylucky commented on July 23, 2024

I solved the problem with KeyError: 'OPENAI_API_KEY' mentioned above by adding the API key directly to main_no_modal.py on line 26: openai.api_key = "paste here your api key"

next solution of the same problem could be also to install python-dotenv:

pip install python-dotenv

Anyway then I am getting another error in the main_no_modal.py:

Note: The user may choose to name the files differently or store them in a different directory.
Traceback (most recent call last):
File "C:\Github\developer\main_no_modal.py", line 230, in
main(prompt, directory, file)
File "C:\Github\developer\main_no_modal.py", line 135, in main
list_actual = ast.literal_eval(filepaths_string)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\boylucky\AppData\Local\Programs\Python\Python311\Lib\ast.py", line 64, in literal_eval
node_or_string = parse(node_or_string.lstrip(" \t"), mode='eval')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\boylucky\AppData\Local\Programs\Python\Python311\Lib\ast.py", line 50, in parse
return compile(source, filename, mode, flags,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1
I assume you want me to generate the filepaths for creating a python script that counts from 100 to 1. Here are the filepaths:
^^^^^^
SyntaxError: invalid syntax

Any help will be appreciated. By the way I am using the python virtual environments instead of modal. All the modules from requirements.txt were installed.

In the end I assigned to modal and then looks the smol-ai works ok. But with modal I get many errors when trying to run with GPT-4 API. Command used:
modal run main.py --prompt "Write a python script which will count from 100 to 1" --model=gpt-4

Traceback (most recent call last):
File "/pkg/modal/_container_entrypoint.py", line 330, in handle_input_exception
yield
File "/pkg/modal/_container_entrypoint.py", line 403, in call_function_sync
res = fun(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^
File "/root/main.py", line 55, in generate_response
response = openai.ChatCompletion.create(**params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/openai/api_resources/chat_completion.py", line 25, in create
return super().create(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/openai/api_resources/abstract/engine_api_resource.py", line 153, in create
response, _, api_key = requestor.request(
^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/openai/api_requestor.py", line 230, in request
resp, got_stream = self._interpret_response(result, stream)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/openai/api_requestor.py", line 624, in _interpret_response
self._interpret_response_line(
File "/usr/local/lib/python3.11/site-packages/openai/api_requestor.py", line 687, in _interpret_response_line
raise self.handle_error_response(
openai.error.InvalidRequestError: The model: gpt-4 does not exist

When running without gpt-4 parameter then the smol-ai succeed.

Thanks in advance for help.

from developer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.