Azure / semantic-kernel-bot-in-a-box

Extensible Semantic Kernel Bot Solution Accelerator
MIT License
55 stars 12 forks source link

File upload error #4

Closed JskMohit closed 1 year ago

JskMohit commented 1 year ago

Hi @MarcoABCardoso,

Thanks for your valuable code

I was trying to run the code on local and have pass endpoints and keys for the document intelligent service resource but the HandleFileUpload function, the below line: AnalyzeDocumentOperation operation = await documentAnalysisClient.AnalyzeDocumentFromUriAsync(WaitUntil.Completed, "prebuilt-layout", fileUri);

is throwing error as: Status: 400 (Bad Request) InvalidRequest Content: {"error":{"code":"InvalidRequest","message":"Invalid request.","inner error":{"code":"InvalidContent","message":"The file is corrupted or format is unsupported"}

Could you advise here as what could be the reason for those?

Also, could you confirm on below points:

  1. What are the supported different file (pdf, doc, txt, etc.) formats?
  2. Is this file upload functionality supported through Blob storage and its content can be accessed via search service using an index?
MarcoABCardoso commented 1 year ago

Hello @JskMohit,

Unfortunately, the current implementation of UploadPlugin does not support local deployments. The connection to Document Intelligence requires the file to be exposed externally, and the Emulator exposes uploaded files on localhost. You should see the expected results from the Web Chat feature of Azure Bot.

Regarding document formats, both PDF and image files are supported by the Layout model, as described here: https://learn.microsoft.com/en-us/azure/ai-services/document-intelligence/concept-layout?view=doc-intel-3.1.0#input-requirements

As you mentioned, it would be possible to customize the behavior of the plugin to upload to Blob Storage, where it could then be used by both Document Intelligence and Search. I will look further into this requirement to support more use cases in the future.

MarcoABCardoso commented 1 year ago

This request was completed - it should now be possible to upload files from an app running locally. Please let me know if the issue persists after the commit above.