# Chat completion: response\['choices'\] throwing error in python (VSCode)

**URL:** <https://community.openai.com/t/chat-completion-response-choices-throwing-error-in-python-vscode/204835>\
**Category:** API\
**Tags:** chatgpt\
**Created:** [May 12, 2023, 11:14am UTC](https://community.openai.com/t/chat-completion-response-choices-throwing-error-in-python-vscode/204835 "2023-05-12T11:14:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![goxley](https://avatars.discourse-cdn.com/v4/letter/g/f08c70/32.png) [@goxley](https://community.openai.com/u/goxley)\
**Post date:** [May 12, 2023, 11:14am UTC](https://community.openai.com/t/chat-completion-response-choices-throwing-error-in-python-vscode/204835/1 "2023-05-12T11:14:57Z")

</div>

![image](https://us1.discourse-cdn.com/openai1/original/3X/d/0/d0cb4e9addd9c3b823b1718a23845bb04fa35b56.png)

After reading around and following some steps, I also even used chatgpt with prompts to help me build my own chatgpt agent python file to be used for a small project I am working on. and I continue to get a error grammer or syntax in visual studio, the error is with response[‘choices’].

but in the document: [Chat completion - OpenAI API](https://platform.openai.com/docs/guides/chat/introduction), right after response format, I am seeing the line (response[‘choices’][0][‘message’][‘content’]

so I am not sure where I am making a mistake and how I can resolve it. I am still new with coding in general and I wanted to use chatgpt to help me practice and build my knowledge and understanding of coding while developing my prompt skills
