Azure / gen-cv

Vision AI Solution Accelerator
MIT License
383 stars 200 forks source link

Problem with AzureComputerVisionVideoIndex #22

Open milioe opened 3 weeks ago

milioe commented 3 weeks ago

When I run the find-and-analyze-videos.ipynb notebook when using the video_chat cell, I've got the following error:

---------------------------------------------------------------------------
HTTPError                                 Traceback (most recent call last)
Cell In[3], [line 201](vscode-notebook-cell:?execution_count=3&line=201)
    [200](vscode-notebook-cell:?execution_count=3&line=200) response = requests.post(gpt_4v_endpoint, headers=headers, json=payload)
--> [201](vscode-notebook-cell:?execution_count=3&line=201) response.raise_for_status()
    [202](vscode-notebook-cell:?execution_count=3&line=202) content = response.json()["choices"][0]['message']['content']

File c:\Users\EmilioSandovalPalomi\anaconda3\envs\playground\Lib\site-packages\requests\models.py:1024, in Response.raise_for_status(self)
   [1023](file:///C:/Users/EmilioSandovalPalomi/anaconda3/envs/playground/Lib/site-packages/requests/models.py:1023) if http_error_msg:
-> [1024](file:///C:/Users/EmilioSandovalPalomi/anaconda3/envs/playground/Lib/site-packages/requests/models.py:1024)     raise HTTPError(http_error_msg, response=self)

HTTPError: 400 Client Error: Bad Request for url: https://cnbv-azopenai2.openai.azure.com/openai/deployments/gpt-4o/extensions/chat/completions?api-version=2023-12-01-preview

During handling of the above exception, another exception occurred:

SystemExit                                Traceback (most recent call last)
    [... skipping hidden 1 frame]

Cell In[13], [line 12](vscode-notebook-cell:?execution_count=13&line=12)
     [11](vscode-notebook-cell:?execution_count=13&line=11) display(Markdown(f"**{question}**"))
---> [12](vscode-notebook-cell:?execution_count=13&line=12) response = video_chat(video_url=video_url, document_id=top_match_id, user_prompt=question)
     [13](vscode-notebook-cell:?execution_count=13&line=13) display(Markdown(response))

Cell In[3], [line 205](vscode-notebook-cell:?execution_count=3&line=205)
    [204](vscode-notebook-cell:?execution_count=3&line=204) except requests.RequestException as e:
--> [205](vscode-notebook-cell:?execution_count=3&line=205)     raise SystemExit(f"Failed to make the request. Error: {e}")

SystemExit: Failed to make the request. Error: 400 Client Error: Bad Request for url: https://cnbv-azopenai2.openai.azure.com/openai/deployments/gpt-4o/extensions/chat/completions?api-version=2023-12-01-preview

During handling of the above exception, another exception occurred:

AttributeError                            Traceback (most recent call last)
    [... skipping hidden 1 frame]

File c:\Users\EmilioSandovalPalomi\anaconda3\envs\playground\Lib\site-packages\IPython\core\interactiveshell.py:2145, in InteractiveShell.showtraceback(self, exc_tuple, filename, tb_offset, exception_only, running_compiled_code)
   [2142](file:///C:/Users/EmilioSandovalPalomi/anaconda3/envs/playground/Lib/site-packages/IPython/core/interactiveshell.py:2142) if exception_only:
   [2143](file:///C:/Users/EmilioSandovalPalomi/anaconda3/envs/playground/Lib/site-packages/IPython/core/interactiveshell.py:2143)     stb = ['An exception has occurred, use %tb to see '
   [2144](file:///C:/Users/EmilioSandovalPalomi/anaconda3/envs/playground/Lib/site-packages/IPython/core/interactiveshell.py:2144)            'the full traceback.\n']
-> [2145](file:///C:/Users/EmilioSandovalPalomi/anaconda3/envs/playground/Lib/site-packages/IPython/core/interactiveshell.py:2145)     stb.extend(self.InteractiveTB.get_exception_only(etype,
   [2146](file:///C:/Users/EmilioSandovalPalomi/anaconda3/envs/playground/Lib/site-packages/IPython/core/interactiveshell.py:2146)                                                      value))
   [2147](file:///C:/Users/EmilioSandovalPalomi/anaconda3/envs/playground/Lib/site-packages/IPython/core/interactiveshell.py:2147) else:
   [2149](file:///C:/Users/EmilioSandovalPalomi/anaconda3/envs/playground/Lib/site-packages/IPython/core/interactiveshell.py:2149)     def contains_exceptiongroup(val):

File c:\Users\EmilioSandovalPalomi\anaconda3\envs\playground\Lib\site-packages\IPython\core\ultratb.py:710, in ListTB.get_exception_only(self, etype, value)
    [702](file:///C:/Users/EmilioSandovalPalomi/anaconda3/envs/playground/Lib/site-packages/IPython/core/ultratb.py:702) def get_exception_only(self, etype, value):
    [703](file:///C:/Users/EmilioSandovalPalomi/anaconda3/envs/playground/Lib/site-packages/IPython/core/ultratb.py:703)     """Only print the exception type and message, without a traceback.
    [704](file:///C:/Users/EmilioSandovalPalomi/anaconda3/envs/playground/Lib/site-packages/IPython/core/ultratb.py:704) 
    [705](file:///C:/Users/EmilioSandovalPalomi/anaconda3/envs/playground/Lib/site-packages/IPython/core/ultratb.py:705)     Parameters
   (...)
    [708](file:///C:/Users/EmilioSandovalPalomi/anaconda3/envs/playground/Lib/site-packages/IPython/core/ultratb.py:708)     value : exception value
    [709](file:///C:/Users/EmilioSandovalPalomi/anaconda3/envs/playground/Lib/site-packages/IPython/core/ultratb.py:709)     """
--> [710](file:///C:/Users/EmilioSandovalPalomi/anaconda3/envs/playground/Lib/site-packages/IPython/core/ultratb.py:710)     return ListTB.structured_traceback(self, etype, value)

File c:\Users\EmilioSandovalPalomi\anaconda3\envs\playground\Lib\site-packages\IPython\core\ultratb.py:568, in ListTB.structured_traceback(self, etype, evalue, etb, tb_offset, context)
    [565](file:///C:/Users/EmilioSandovalPalomi/anaconda3/envs/playground/Lib/site-packages/IPython/core/ultratb.py:565)     chained_exc_ids.add(id(exception[1]))
    [566](file:///C:/Users/EmilioSandovalPalomi/anaconda3/envs/playground/Lib/site-packages/IPython/core/ultratb.py:566)     chained_exceptions_tb_offset = 0
    [567](file:///C:/Users/EmilioSandovalPalomi/anaconda3/envs/playground/Lib/site-packages/IPython/core/ultratb.py:567)     out_list = (
--> [568](file:///C:/Users/EmilioSandovalPalomi/anaconda3/envs/playground/Lib/site-packages/IPython/core/ultratb.py:568)         self.structured_traceback(
    [569](file:///C:/Users/EmilioSandovalPalomi/anaconda3/envs/playground/Lib/site-packages/IPython/core/ultratb.py:569)             etype,
    [570](file:///C:/Users/EmilioSandovalPalomi/anaconda3/envs/playground/Lib/site-packages/IPython/core/ultratb.py:570)             evalue,
    [571](file:///C:/Users/EmilioSandovalPalomi/anaconda3/envs/playground/Lib/site-packages/IPython/core/ultratb.py:571)             (etb, chained_exc_ids),  # type: ignore
    [572](file:///C:/Users/EmilioSandovalPalomi/anaconda3/envs/playground/Lib/site-packages/IPython/core/ultratb.py:572)             chained_exceptions_tb_offset,
    [573](file:///C:/Users/EmilioSandovalPalomi/anaconda3/envs/playground/Lib/site-packages/IPython/core/ultratb.py:573)             context,
    [574](file:///C:/Users/EmilioSandovalPalomi/anaconda3/envs/playground/Lib/site-packages/IPython/core/ultratb.py:574)         )
    [575](file:///C:/Users/EmilioSandovalPalomi/anaconda3/envs/playground/Lib/site-packages/IPython/core/ultratb.py:575)         + chained_exception_message
    [576](file:///C:/Users/EmilioSandovalPalomi/anaconda3/envs/playground/Lib/site-packages/IPython/core/ultratb.py:576)         + out_list)
    [578](file:///C:/Users/EmilioSandovalPalomi/anaconda3/envs/playground/Lib/site-packages/IPython/core/ultratb.py:578) return out_list

File c:\Users\EmilioSandovalPalomi\anaconda3\envs\playground\Lib\site-packages\IPython\core\ultratb.py:1454, in AutoFormattedTB.structured_traceback(self, etype, evalue, etb, tb_offset, number_of_lines_of_context)
   [1452](file:///C:/Users/EmilioSandovalPalomi/anaconda3/envs/playground/Lib/site-packages/IPython/core/ultratb.py:1452) else:
   [1453](file:///C:/Users/EmilioSandovalPalomi/anaconda3/envs/playground/Lib/site-packages/IPython/core/ultratb.py:1453)     self.tb = etb
-> [1454](file:///C:/Users/EmilioSandovalPalomi/anaconda3/envs/playground/Lib/site-packages/IPython/core/ultratb.py:1454) return FormattedTB.structured_traceback(
   [1455](file:///C:/Users/EmilioSandovalPalomi/anaconda3/envs/playground/Lib/site-packages/IPython/core/ultratb.py:1455)     self, etype, evalue, etb, tb_offset, number_of_lines_of_context
   [1456](file:///C:/Users/EmilioSandovalPalomi/anaconda3/envs/playground/Lib/site-packages/IPython/core/ultratb.py:1456) )

File c:\Users\EmilioSandovalPalomi\anaconda3\envs\playground\Lib\site-packages\IPython\core\ultratb.py:1345, in FormattedTB.structured_traceback(self, etype, value, tb, tb_offset, number_of_lines_of_context)
   [1342](file:///C:/Users/EmilioSandovalPalomi/anaconda3/envs/playground/Lib/site-packages/IPython/core/ultratb.py:1342) mode = self.mode
   [1343](file:///C:/Users/EmilioSandovalPalomi/anaconda3/envs/playground/Lib/site-packages/IPython/core/ultratb.py:1343) if mode in self.verbose_modes:
   [1344](file:///C:/Users/EmilioSandovalPalomi/anaconda3/envs/playground/Lib/site-packages/IPython/core/ultratb.py:1344)     # Verbose modes need a full traceback
-> [1345](file:///C:/Users/EmilioSandovalPalomi/anaconda3/envs/playground/Lib/site-packages/IPython/core/ultratb.py:1345)     return VerboseTB.structured_traceback(
   [1346](file:///C:/Users/EmilioSandovalPalomi/anaconda3/envs/playground/Lib/site-packages/IPython/core/ultratb.py:1346)         self, etype, value, tb, tb_offset, number_of_lines_of_context
   [1347](file:///C:/Users/EmilioSandovalPalomi/anaconda3/envs/playground/Lib/site-packages/IPython/core/ultratb.py:1347)     )
   [1348](file:///C:/Users/EmilioSandovalPalomi/anaconda3/envs/playground/Lib/site-packages/IPython/core/ultratb.py:1348) elif mode == 'Minimal':
   [1349](file:///C:/Users/EmilioSandovalPalomi/anaconda3/envs/playground/Lib/site-packages/IPython/core/ultratb.py:1349)     return ListTB.get_exception_only(self, etype, value)

File c:\Users\EmilioSandovalPalomi\anaconda3\envs\playground\Lib\site-packages\IPython\core\ultratb.py:1192, in VerboseTB.structured_traceback(self, etype, evalue, etb, tb_offset, number_of_lines_of_context)
   [1183](file:///C:/Users/EmilioSandovalPalomi/anaconda3/envs/playground/Lib/site-packages/IPython/core/ultratb.py:1183) def structured_traceback(
   [1184](file:///C:/Users/EmilioSandovalPalomi/anaconda3/envs/playground/Lib/site-packages/IPython/core/ultratb.py:1184)     self,
   [1185](file:///C:/Users/EmilioSandovalPalomi/anaconda3/envs/playground/Lib/site-packages/IPython/core/ultratb.py:1185)     etype: type,
   (...)
   [1189](file:///C:/Users/EmilioSandovalPalomi/anaconda3/envs/playground/Lib/site-packages/IPython/core/ultratb.py:1189)     number_of_lines_of_context: int = 5,
   [1190](file:///C:/Users/EmilioSandovalPalomi/anaconda3/envs/playground/Lib/site-packages/IPython/core/ultratb.py:1190) ):
   [1191](file:///C:/Users/EmilioSandovalPalomi/anaconda3/envs/playground/Lib/site-packages/IPython/core/ultratb.py:1191)     """Return a nice text document describing the traceback."""
-> [1192](file:///C:/Users/EmilioSandovalPalomi/anaconda3/envs/playground/Lib/site-packages/IPython/core/ultratb.py:1192)     formatted_exception = self.format_exception_as_a_whole(etype, evalue, etb, number_of_lines_of_context,
   [1193](file:///C:/Users/EmilioSandovalPalomi/anaconda3/envs/playground/Lib/site-packages/IPython/core/ultratb.py:1193)                                                            tb_offset)
   [1195](file:///C:/Users/EmilioSandovalPalomi/anaconda3/envs/playground/Lib/site-packages/IPython/core/ultratb.py:1195)     colors = self.Colors  # just a shorthand + quicker name lookup
   [1196](file:///C:/Users/EmilioSandovalPalomi/anaconda3/envs/playground/Lib/site-packages/IPython/core/ultratb.py:1196)     colorsnormal = colors.Normal  # used a lot

File c:\Users\EmilioSandovalPalomi\anaconda3\envs\playground\Lib\site-packages\IPython\core\ultratb.py:1082, in VerboseTB.format_exception_as_a_whole(self, etype, evalue, etb, number_of_lines_of_context, tb_offset)
   [1079](file:///C:/Users/EmilioSandovalPalomi/anaconda3/envs/playground/Lib/site-packages/IPython/core/ultratb.py:1079) assert isinstance(tb_offset, int)
   [1080](file:///C:/Users/EmilioSandovalPalomi/anaconda3/envs/playground/Lib/site-packages/IPython/core/ultratb.py:1080) head = self.prepare_header(str(etype), self.long_header)
   [1081](file:///C:/Users/EmilioSandovalPalomi/anaconda3/envs/playground/Lib/site-packages/IPython/core/ultratb.py:1081) records = (
-> [1082](file:///C:/Users/EmilioSandovalPalomi/anaconda3/envs/playground/Lib/site-packages/IPython/core/ultratb.py:1082)     self.get_records(etb, number_of_lines_of_context, tb_offset) if etb else []
   [1083](file:///C:/Users/EmilioSandovalPalomi/anaconda3/envs/playground/Lib/site-packages/IPython/core/ultratb.py:1083) )
   [1085](file:///C:/Users/EmilioSandovalPalomi/anaconda3/envs/playground/Lib/site-packages/IPython/core/ultratb.py:1085) frames = []
   [1086](file:///C:/Users/EmilioSandovalPalomi/anaconda3/envs/playground/Lib/site-packages/IPython/core/ultratb.py:1086) skipped = 0

File c:\Users\EmilioSandovalPalomi\anaconda3\envs\playground\Lib\site-packages\IPython\core\ultratb.py:1150, in VerboseTB.get_records(self, etb, number_of_lines_of_context, tb_offset)
   [1148](file:///C:/Users/EmilioSandovalPalomi/anaconda3/envs/playground/Lib/site-packages/IPython/core/ultratb.py:1148) while cf is not None:
   [1149](file:///C:/Users/EmilioSandovalPalomi/anaconda3/envs/playground/Lib/site-packages/IPython/core/ultratb.py:1149)     try:
-> [1150](file:///C:/Users/EmilioSandovalPalomi/anaconda3/envs/playground/Lib/site-packages/IPython/core/ultratb.py:1150)         mod = inspect.getmodule(cf.tb_frame)
   [1151](file:///C:/Users/EmilioSandovalPalomi/anaconda3/envs/playground/Lib/site-packages/IPython/core/ultratb.py:1151)         if mod is not None:
   [1152](file:///C:/Users/EmilioSandovalPalomi/anaconda3/envs/playground/Lib/site-packages/IPython/core/ultratb.py:1152)             mod_name = mod.__name__

AttributeError: 'tuple' object has no attribute 'tb_frame'

when debuging and try a requests.RequestException in the function I've got this one:

Response Text: {"error": {"requestid": "0d94cbb0-7a76-46da-bb5e-2fb6740b4ba3", "code": 400, "message": "Validation error at #/dataSources/0: Input tag 'AzureComputerVisionVideoIndex' found using 'type' does not match any of the expected tags: 'AzureCognitiveSearch', 'azure_search', 'Elasticsearch', 'elasticsearch', 'AzureCosmosDB', 'azure_cosmos_db', 'azureCosmosDB', 'Pinecone', 'pinecone', 'AzureMLIndex', 'azureMLIndex', 'azure_ml_index', 'Microsoft365', 'SharePoint', 'BingCustomSearch', 'bing_custom_search'"}}

I checked for env variables to be correct, and it seems like the versions does not accept a AzureComputerVisionVideoIndex. The API version I'm using is 2023-12-01-preview