# Issue with Azure OpenAI Integration: Response Returning None and Debugging Steps

**URL:** <https://community.openai.com/t/issue-with-azure-openai-integration-response-returning-none-and-debugging-steps/1019675>\
**Category:** API\
**Tags:** azure\
**Created:** [November 15, 2024, 5:50pm UTC](https://community.openai.com/t/issue-with-azure-openai-integration-response-returning-none-and-debugging-steps/1019675 "2024-11-15T17:50:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ssingh](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/ssingh/32/448925_2.png) [@ssingh](https://community.openai.com/u/ssingh)\
**Post date:** [November 15, 2024, 5:50pm UTC](https://community.openai.com/t/issue-with-azure-openai-integration-response-returning-none-and-debugging-steps/1019675/1 "2024-11-15T17:50:00Z")

</div>

Hi everyone,

I’m working on an application that integrates with Azure OpenAI using the `azure-openai` Python SDK. My setup includes functionality for creating assistants, uploading files to a vector store, and requesting responses using threads and tools like `file_search`. However, I’m encountering an issue where the assistant response consistently returns `None`.  
Some code snippet -  
For Upload to vector -

> def upload\_files\_to\_vector\_store(self, file\_streams):  
> try:  
> print(“Uploading files to vector store…”)  
> seen\_files = set()  
> unique\_files =
> 
> ```
> for file_stream in file_streams:
> file_name = file_stream.name
> if file_name not in seen_files:
> seen_files.add(file_name)
> unique_files.append(file_stream)
> print(f"Adding file: {file_name}")
> else:
> print(f"Skipping duplicate file: {file_name}")
> 
> vector_store = self.client.beta.vector_stores.create(name="My Vector Store new one")
> print(f"Vector store created with ID: {vector_store.id}")
> 
> batch = self.client.beta.vector_stores.file_batches.upload_and_poll(
> vector_store_id=vector_store.id, files=unique_files
> )
> print("File batch upload completed.")
> 
> self.client.beta.assistants.update(
> assistant_id=self.assistant_id,
> tool_resources={"file_search": {"vector_store_ids": [vector_store.id]}}
> )
> print("Assistant updated with new vector store.")
> self.vector_store_id = vector_store.id
> return self.vector_store_id
> 
> ```

> thread = self.client.beta.threads.create(  
> messages=[{“role”: “user”, “content”: prompt}],  
> tool\_resources={“file\_search”: {“vector\_store\_ids”: [self.vector\_store\_id]}}  
> )
> 
> with self.client.beta.threads.runs.stream(  
> thread\_id=thread.id,  
> assistant\_id=self.assistant\_id,  
> instructions=“Provide a detailed response.”,  
> event\_handler=event\_handler,  
> ) as stream:  
> stream.until\_done()
