Azure
Microsoft が管理する世界のデータ センター ネットワークを介してアプリケーションとサービスを構築、配置、および管理するインフラストラクチャおよびクラウド コンピューティング プラットフォーム。
665 件の質問
このブラウザーはサポートされなくなりました。
Microsoft Edge にアップグレードすると、最新の機能、セキュリティ更新プログラム、およびテクニカル サポートを利用できます。
Azure OpenAIのCode Interpreterの使用を検討しています。Matplotlibを使用してグラフを表示する際、日本語の文字が文字化けしてしまいます。
Code Interpreter環境のMatplotlibで日本語表示を実現する方法があれば教えてください。既存の日本語対応フォントがあるのか、または他に解決策があるのか知りたいです。
こんにちは 浅井 郁哉,
zipファイルを追加する際には、正しく使用するためのプロンプトを提供する必要があります。
以下はファイルをアップロードするために使用されたコードで、ここでは日本の従業員データとフォントのzipファイルをアップロードしました。
DATA_FOLDER = "data/"
def upload_file(client: AzureOpenAI, path: str) -> FileObject:
with Path(path).open("rb") as f:
return client.files.create(file=f, purpose="assistants")
arr = os.listdir(DATA_FOLDER)
assistant_files = []
for file in arr:
filePath = DATA_FOLDER + file
assistant_files.append(upload_file(client, filePath))
file_ids = [file.id for file in assistant_files]
次に、以下のようなプロンプトを使用します。
assistant = client.beta.assistants.create(
name="Management Assistant",
instructions="You are an assistant that can help with japanese employee data",
tools=tools_list,
model=api_deployment_name,
tool_resources={"code_interpreter": {"file_ids": file_ids}},
)
thread = client.beta.threads.create()
client.beta.threads.messages.create(thread_id=thread.id, role="user", content="Give me a chart with employee names and salary more than 30000. I have japanese words so if you don't find font for these words, i have given Noto_Sans_JP.zip file, extract it and use NotoSansJP-VariableFont_wght.ttf as font for now and in future conversation")
run = client.beta.threads.runs.create(
thread_id=thread.id,
assistant_id=assistant.id,
instructions="The current date and time is: " + datetime.now().strftime("%x %X") + ". ",
)
completed_run = client.beta.threads.runs.poll(run_id=run.id, thread_id=thread.id)
print(completed_run.status)
messages = client.beta.threads.messages.list(thread_id=thread.id)
format_messages(messages)
あなたは必要に応じてプロンプトを使用します。
出力:
私は英語からの回答を翻訳していますので、文法に問題があればお許しください。