Significant-Gravitas / AutoGPT-Code-Ability

🖥️ AutoGPT's Coding Ability - empowering everyone to build software using AI
MIT License
109 stars 34 forks source link

Add case for "reportPrivateImportUsage" "X is not exported from module Y" to enhanced error messages #208

Closed Torantulino closed 4 months ago

linear[bot] commented 4 months ago

AGPT-670

Torantulino commented 4 months ago

Another case: Member "choices" is unknown. reportAttributeAccessIssue -> ' refined_prompt = gpt_response.choices[0].text.strip()'

Torantulino commented 4 months ago

Got this in testing:

2024-04-12 23:33:36 - INFO - codex.develop.code_validation - Attempting to enhance error: "Completion" is not exported from module "openai". reportPrivateImportUsage
2024-04-12 23:33:36 - ERROR - codex.common.ai_block - Failed initial generation attempt: Error developing `refine_prompt`
  - Error validating code   
  - "Generator[Unknown | list[Unknown] | dict[Unknown, Unknown], None, None]" is not awaitable      
  "Generator[Unknown | list[Unknown] | dict[Unknown, Unknown], None, None]" is incompatible with protocol "Awaitable[_T_co@Awaitable]"      
    "__await__" is not present. reportGeneralTypeIssues -> '        response = await openai.Completion.create(engine='text-davinci-004', prompt=prompt_to_send, max_tokens=100, temperature=0.5)'   
  - "list[Unknown]" is not awaitable      
  "list[Unknown]" is incompatible with protocol "Awaitable[_T_co@Awaitable]"      
    "__await__" is not present. reportGeneralTypeIssues -> '        response = await openai.Completion.create(engine='text-davinci-004', prompt=prompt_to_send, max_tokens=100, temperature=0.5)'   
  - "dict[Unknown, Unknown]" is not awaitable      
  "dict[Unknown, Unknown]" is incompatible with protocol "Awaitable[_T_co@Awaitable]"      
    "__await__" is not present. reportGeneralTypeIssues -> '        response = await openai.Completion.create(engine='text-davinci-004', prompt=prompt_to_send, max_tokens=100, temperature=0.5)'   
  - "Completion" is not exported from module "openai". reportPrivateImportUsage      
{'metadata': "Metadata-Version: 2.1\nName: openai\nVersion: 0.10.2\nSummary: Python client library for the OpenAI API\nHome-page: https://github.com/openai/openai-python\nAuthor: OpenAI\nAuthor-email: support@openai.com\nRequires-Python: >=3.6\nLicense-File: LICENSE\nRequires-Dist: requests >=2.20\nRequires-Dist: tqdm\nRequires-Dist: pandas >=1.2.3\nRequires-Dist: pandas-stubs >=1.1.0.11\nRequires-Dist: openpyxl >=3.0.7\nProvides-Extra: dev\nRequires-Dist: black ==20.8b1 ; extra == 'dev'\nRequires-Dist: pytest ==6.* ; extra == 'dev'\n\n", 'context': None} -> '        response = await openai.Completion.create(engine='text-davinci-004', prompt=prompt_to_send, max_tokens=100, temperature=0.5)', LLM Call ID: 71a3256f-97e7-464d-8d91-6c5aa1e58bf6

Something's wrong, will have to look with fresh eyes... Seems to be working actually!

Torantulino commented 4 months ago

This needs to be merged after #205

Torantulino commented 4 months ago

Merge conflicts resolved, but it was a bit of hairy one so I'm testing again locally.