【Azure】AI Document Intelligenceで404 | 夕湖津のブログ

夕湖津のブログ

問題解決に役立つ情報の提供を目指します

■事象

from azure.core.credentials import AzureKeyCredential
from azure.ai.documentintelligence import DocumentIntelligenceClient

endpoint = os.environ["ENDPOINT"]
key = os.environ["API_KEY"]

client = DocumentIntelligenceClient(endpoint=endpoint, credential=AzureKeyCredential(key))
with open(path_to_sample_documents, "rb") as f:
    poller = client.begin_analyze_document("prebuilt-read", f, content_type="application/octet-stream")

 

上記コードを実行すると下記エラーが出る

(404) Resource not found


■解決方法

恐らく、リージョンが東日本になっているので、下記ドキュメントのようにリージョンを米国東部などにして再作成する

 

【ドキュメント】

パブリック プレビュー バージョン 2023-10-31-preview は、現在、次の Azure リージョンでのみ使用できます。

米国東部
米国西部 2
西ヨーロッパ