如果您使用的是 OpenAI Python 或 JavaScript 用戶端程式庫或 REST API,則需要將程式碼直接更新到最新的預覽 API 版本。如果您使用的是其中一個適用於 C#、Go 或 JAVA 的 Azure OpenAI SDK,則需要更新到最新版本的 SDK。 每個 SDK 版本都經過硬式編碼,可與特定版本的 Azure OpenAI API 搭配使用。
dotnet add package Azure.AI.OpenAI --prerelease 2. 现在就可以开始写代码了,以下C#代码展示了如何在一个控制台应用程序中调用Azure OpenAI API,要求AI帮你写一篇800字以内的短篇“小说”。 using Azure; using Azure.AI.OpenAI; using OpenAI.Chat; string key = "在这里输入你的API密钥"; // 例如,fcac1b...
using Azure;using Azure.AI.OpenAI;using OpenAI.Chat;string key = "在这里输入你的API密钥"; // 例如,fcac1bdc46224180b52c1a4be79cb20kstring endpoint = "在这里输入你的终结点URI"; // 例如,https://zjgpt.openai.azure.com/string deploymentid = "在这里输入你的部署名称"; // 例如,chagpt4-oA...
importopenaiopenai.api_type="azure"openai.api_base="https://OpenAI资源名称.openai.azure.com/"openai.api_version="2022-12-01"openai.api_key='yourkey'response=openai.Completion.create(engine="部署模型的名称",prompt="这里输入你的问题",temperature=0.3,max_tokens=350,top_p=1,frequency_penalty=0,...
acountname字符串必需Azure OpenAI 资源的名称。 deploymentName字符串必需你在部署现有模型时选择的部署名称,或者你希望新模型部署具有的名称。 resourceGroupName字符串必需此模型部署的关联资源组的名称。 subscriptionId字符串必需关联订阅的订阅 ID。 api-version字符串必需要用于此操作的 API 版本。 它遵循 YYYY-MM...
curl $AZURE_OPENAI_ENDPOINT/openai/deployments/gpt-35-turbo/chat/completions?api-version=2023-05-15\-H"Content-Type: application/json"\-H"api-key: $AZURE_OPENAI_KEY"\-d'{"messages":[{"role": "system", "content": "You are a helpful assistant."},{"role": "user", "content": "Does...
Azure OpenAI 常見問題集 Azure Government 中的 Azure OpenAI 快速入門 概念 操作方式 API 版本生命週期 助理(預覽) Batch 完成與聊天完成 內容篩選 使用封鎖清單 風險與安全監視 Embeddings 評估 微調 預存完成 使用您的資料 使用即時 API (預覽) 移轉至 OpenAI Python v1.x ...
endpoint path Yes 字串URL 支援的 Azure OpenAI 端點 (通訊協定和主機名稱,例如:https://aoairesource.openai.azure.com。請將 "aoairesource" 取代為 Azure OpenAI 資源名稱)。 https://{your-resource-name}.openai.azure.com deployment-id path Yes 字串 已部署之模型的部署標識碼。 api-version 查詢 Yes...
curl $AZURE_OPENAI_ENDPOINT/openai/deployments/gpt-35-turbo/chat/completions?api-version=2023-05-15\-H"Content-Type:application/json"\-H"api-key:$AZURE_OPENAI_KEY"\-d'{"messages":[{"role":"system","content":"You are a helpful assistant."},{"role":"user","content":"Does Azure Open...
https://YOUR_RESOURCE_NAME.openai.azure.com/openai/deployments/YOUR_DEPLOYMENT_NAME/embeddings?api-version=2023-05-15 我们需要把大模型部署一下,上面标红的地方,就是部署名称,所以如果我们想无缝切换OpenAI与微软Azure OpenAI 我们需要固定好,部署的名称与模型的名称保持一致,这样才能正常调用 ...