morph-labs/rift

Agents are not Detecting API Key Set in rift.openaiKey Field in settings.json

nadelacruz opened this issue · 1 comments

Steps to Reproduce:

  1. Set Chat Model and Code Edit Model to openai:gpt-4
  2. Add OpenAI API key in settings.json
  3. Run Smol Developer Agent
  4. Input 'a hello world app in python'

Notes:

  • OS: Fedora 38, Linux Kernel: 6.4.11-200.fc38.x86_64
  • Shell: fish, version 3.6.1

settings.json
Screenshot from 2023-08-23 02-25-04

Morph Server Output:

[02:20:14] INFO [on_create] agent_cls.params_cls=<class lsp.py:304
'rift.agents.smol.SmolAgentParams'>

[Info - 2:20:14 AM] [on_create] agent_cls.params_cls=<class 'rift.agents.smol.SmolAgentParams'>
INFO found rift.openaiKey in settings, setting abstract.py:281
OPENAI_API_KEY environment variable
INFO <smol_dev> 0b69ab90 running abstract.py:341

[Info - 2:20:14 AM] found rift.openaiKey in settings, setting OPENAI_API_KEY environment variable

[Info - 2:20:14 AM] <smol_dev> 0b69ab90 running

[02:20:29] INFO [resolve_inline_uris] user_response='a hello context.py:54
world app in python'

[Info - 2:20:29 AM] [resolve_inline_uris] user_response='a hello world app in python'
ERROR [AgentTask] error: No API key provided. You agenttask.py:69
can set your API key in code using
'openai.api_key = ', or you can set
the environment variable
OPENAI_API_KEY=). If your API key
is stored in a file, you can point the
openai module at it with
'openai.api_key_path = '. You can
generate API keys in the OpenAI web
interface. See
https://platform.openai.com/account/api-keys
for details.

[Error - 2:20:29 AM] [AgentTask] error: No API key provided. You can set your API key in code using 'openai.api_key = ', or you can set the environment variable OPENAI_API_KEY=). If your API key is stored in a file, you can point the openai module at it with 'openai.api_key_path = '. You can generate API keys in the OpenAI web interface. See https://platform.openai.com/account/api-keys for details.

Yeah --- +1

Got around the issue by running
export OPENAI_API_KEY=XXXX

and then running the server outside of VSCode (with autostart off)