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

Unable to get started #168

Closed
AbrJA opened this issue Jun 21, 2024 · 2 comments
Closed

Unable to get started #168

AbrJA opened this issue Jun 21, 2024 · 2 comments

Comments

@AbrJA
Copy link

AbrJA commented Jun 21, 2024

Thanks for the package,

I'm trying to use it and I followed the steps (create an API KEY, pay for credits) but I get this error:

haskey(ENV, "OPENAI_API_KEY") # This returns true

using PromptingTools

ai"What is the capital of France?"

ERROR: ArgumentError: api_key cannot be empty
Stacktrace:
  [1] auth_header(::OpenAI.OpenAIProvider, api_key::String)
    @ OpenAI ~/.julia/packages/OpenAI/d65zV/src/OpenAI.jl:40
  [2] _request(api::String, provider::OpenAI.OpenAIProvider, api_key::String; method::String, query::Nothing, http_kwargs::@NamedTuple{…}, streamcallback::Nothing, additional_headers::Vector{…}, kwargs::@Kwargs{…})
    @ OpenAI ~/.julia/packages/OpenAI/d65zV/src/OpenAI.jl:159
  [3] _request
    @ ~/.julia/packages/OpenAI/d65zV/src/OpenAI.jl:141 [inlined]
  [4] #openai_request#14
    @ ~/.julia/packages/OpenAI/d65zV/src/OpenAI.jl:205 [inlined]
  [5] openai_request
    @ ~/.julia/packages/OpenAI/d65zV/src/OpenAI.jl:198 [inlined]
  [6] #create_chat#19
    @ ~/.julia/packages/OpenAI/d65zV/src/OpenAI.jl:368 [inlined]
  [7] create_chat
    @ ~/.julia/packages/OpenAI/d65zV/src/OpenAI.jl:362 [inlined]
  [8] #create_chat#184
    @ ~/.julia/packages/PromptingTools/IjEn4/src/llm_openai.jl:79 [inlined]
  [9] create_chat
    @ ~/.julia/packages/PromptingTools/IjEn4/src/llm_openai.jl:74 [inlined]
 [10] macro expansion
    @ ./timing.jl:395 [inlined]
 [11] aigenerate(prompt_schema::PromptingTools.OpenAISchema, prompt::String; verbose::Bool, api_key::String, model::String, return_all::Bool, dry_run::Bool, conversation::Vector{…}, http_kwargs::@NamedTuple{…}, api_kwargs::@NamedTuple{}, kwargs::@Kwargs{})
    @ PromptingTools ~/.julia/packages/PromptingTools/IjEn4/src/llm_openai.jl:514
 [12] aigenerate(prompt::String; model::String, kwargs::@Kwargs{return_all::Bool})
    @ PromptingTools ~/.julia/packages/PromptingTools/IjEn4/src/llm_interface.jl:405
 [13] macro expansion
    @ ~/.julia/packages/PromptingTools/IjEn4/src/macros.jl:39 [inlined]
 [14] top-level scope
    @ Untitled-1:5
Some type information was truncated. Use `show(err)` to see complete types.

I'm using the 0.33.0 version on Julia 1.10.4.

Thanks,

Note: I opened this issue because you asked for it if this error happens in the latest version. You can close it if you want

@AbrJA
Copy link
Author

AbrJA commented Jun 21, 2024

Solved using the third option from here, delete the compiled cache

@svilupp
Copy link
Owner

svilupp commented Aug 7, 2024

Closing at this should have been resolved by #170

@svilupp svilupp closed this as completed Aug 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants