في هذه البداية السريعة ستبدأ باستخدام النماذج والوكلاء في Foundry.
أنت سوف:
- توليد استجابة من نموذج
- إنشاء وكيل مع طلب معرف
- أجر محادثة متعددة الأدوار مع الوكيل
المتطلبات المسبقه
حدد متغيرات البيئة واحصل على الكود
قم بتخزين نقطة نهاية مشروعك كمتغير بيئتي. قم أيضا بتعيين هذه القيم لاستخدامها في البرامج النصية الخاصة بك.
PROJECT_ENDPOINT=<endpoint copied from welcome screen>
AGENT_NAME="MyAgent"
اتبع أدناه أو احصل على الرمز:
سجل الدخول باستخدام أمر CLI az login للمصادقة قبل تشغيل سكريبتات Python.
قم بتخزين نقطة نهاية مشروعك كمتغير بيئتي. قم أيضا بتعيين هذه القيم لاستخدامها في البرامج النصية الخاصة بك.
ProjectEndpoint = <endpoint copied from welcome screen>
AgentName = "MyAgent"
اتبع أدناه أو احصل على الرمز:
سجل الدخول باستخدام أمر CLI az login للمصادقة قبل تشغيل سكريبتات C#.
قم بتخزين نقطة نهاية مشروعك كمتغير بيئتي. قم أيضا بتعيين هذه القيم لاستخدامها في البرامج النصية الخاصة بك.
PROJECT_ENDPOINT=<endpoint copied from welcome screen>
AGENT_NAME="MyAgent"
اتبع أدناه أو احصل على الرمز:
سجل الدخول باستخدام أمر CLI az login للمصادقة قبل تشغيل سكريبتات TypeScript.
قم بتخزين نقطة نهاية مشروعك كمتغير بيئتي. قم أيضا بتعيين هذه القيم لاستخدامها في البرامج النصية الخاصة بك.
PROJECT_ENDPOINT=<endpoint copied from welcome screen>
AGENT_NAME="MyAgent"
قم بتخزين نقطة نهاية مشروعك كمتغير بيئتي. قم أيضا بتعيين هذه القيم لاستخدامها في البرامج النصية الخاصة بك.
ProjectEndpoint = <endpoint copied from welcome screen>
AgentName = "MyAgent"
اتبع أدناه أو احصل على الرمز:
سجل الدخول باستخدام أمر CLI az login للمصادقة قبل تشغيل سكريبتات Java الخاصة بك.
قم بتخزين نقطة نهاية مشروعك كمتغير بيئتي.
اتبع أدناه أو احصل على الرمز:
قم بتسجيل الدخول باستخدام أمر CLI az login للمصادقة قبل تشغيل الأمر التالي.
الحصول على رمز وصول مؤقت. ستنتهي صلاحيتها في غضون 60-90 دقيقة، ستحتاج إلى التحديث بعد ذلك.
az account get-access-token --scope https://ai.azure.com/.default
احفظ النتائج كمتغير AZURE_AI_AUTH_TOKENالبيئة .
لا حاجة لأي كود عند استخدام بوابة Foundry.
التثبيت والمصادقة
تأكد من تثبيت النسخة الصحيحة من الحزم كما هو موضح هنا.
تثبيت النسخة الحالية من azure-ai-projects. يستخدم هذا الإصدار واجهة برمجة تطبيقات مشاريع Foundry (الجديدة).
pip install azure-ai-projects>=2.0.0
سجل الدخول باستخدام أمر CLI az login للمصادقة قبل تشغيل سكريبتات Python.
تثبيت الحزم:
إضافة حزم NuGet باستخدام واجهة سطر .NET في الطرفية المتكاملة: تستخدم هذه الحزم واجهة برمجة التطبيقات Foundry (الجديدة) API.
dotnet add package Azure.AI.Projects --prerelease
dotnet add package Azure.Identity
سجل الدخول باستخدام أمر CLI az login للمصادقة قبل تشغيل سكريبتات C#.
تثبيت النسخة الحالية من @azure/ai-projects. يستخدم هذا الإصدار واجهة برمجة تطبيقات مشاريع Foundry (الجديدة):
npm install @azure/ai-projects
سجل الدخول باستخدام أمر CLI az login للمصادقة قبل تشغيل سكريبتات TypeScript.
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-ai-agents</artifactId>
<version>2.0.0-beta.3</version>
</dependency>
- سجل الدخول باستخدام أمر CLI
az login للمصادقة قبل تشغيل سكريبتات Java الخاصة بك.
قم بتسجيل الدخول باستخدام أمر CLI az login للمصادقة قبل تشغيل الأمر التالي.
الحصول على رمز وصول مؤقت. ستنتهي صلاحيتها في غضون 60-90 دقيقة، ستحتاج إلى التحديث بعد ذلك.
az account get-access-token --scope https://ai.azure.com/.default
احفظ النتائج كمتغير AZURE_AI_AUTH_TOKENالبيئة .
لا حاجة لأي تثبيت لاستخدام بوابة Foundry.
نصيحة
يستخدم الكود Azure مشاريع الذكاء الاصطناعي 2.x وهو غير متوافق مع مشاريع الذكاء الاصطناعي Azure 1.x.
انظر وثائق Foundry (الكلاسيكية) لإصدار مشاريع الذكاء الاصطناعي Azure 1.x.
الدردشة مع عارضة أزياء
التفاعل مع النموذج هو اللبنة الأساسية لتطبيقات الذكاء الاصطناعي. أرسل مدخلا وتلقي استجابة من النموذج:
from azure.identity import DefaultAzureCredential
from azure.ai.projects import AIProjectClient
# Format: "https://resource_name.ai.azure.com/api/projects/project_name"
PROJECT_ENDPOINT = "your_project_endpoint"
# Create project and openai clients to call Foundry API
project = AIProjectClient(
endpoint=PROJECT_ENDPOINT,
credential=DefaultAzureCredential(),
)
openai = project.get_openai_client()
# Run a responses API call
response = openai.responses.create(
model="gpt-5-mini", # supports all Foundry direct models
input="What is the size of France in square miles?",
)
print(f"Response output: {response.output_text}")
using Azure.Identity;
using Azure.AI.Projects;
using Azure.AI.Extensions.OpenAI;
using OpenAI.Responses;
#pragma warning disable OPENAI001
// Format: "https://resource_name.ai.azure.com/api/projects/project_name"
var ProjectEndpoint = "your_project_endpoint";
// Create project client to call Foundry API
AIProjectClient projectClient = new(
endpoint: new Uri(ProjectEndpoint),
tokenProvider: new DefaultAzureCredential());
// Run a responses API call
ProjectResponsesClient responseClient = projectClient.OpenAI.GetProjectResponsesClientForModel("gpt-5-mini"); // supports all Foundry direct models
ResponseResult response = await responseClient.CreateResponseAsync(
"What is the size of France in square miles?");
Console.WriteLine(response.GetOutputText());
import { DefaultAzureCredential } from "@azure/identity";
import { AIProjectClient } from "@azure/ai-projects";
// Format: "https://resource_name.ai.azure.com/api/projects/project_name"
const PROJECT_ENDPOINT = "your_project_endpoint";
async function main(): Promise<void> {
// Create project and openai clients to call Foundry API
const project = new AIProjectClient(PROJECT_ENDPOINT, new DefaultAzureCredential());
const openai = project.getOpenAIClient();
// Run a responses API call
const response = await openai.responses.create({
model: "gpt-5-mini", // supports all Foundry direct models
input: "What is the size of France in square miles?",
});
console.log(`Response output: ${response.output_text}`);
}
main().catch(console.error);
package com.azure.ai.agents;
import com.azure.ai.agents.models.AgentDetails;
import com.azure.ai.agents.models.AgentReference;
import com.azure.ai.agents.models.AzureCreateResponseOptions;
import com.azure.ai.agents.models.AgentVersionDetails;
import com.azure.ai.agents.models.PromptAgentDefinition;
import com.azure.identity.AuthenticationUtil;
import com.azure.identity.DefaultAzureCredentialBuilder;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.credential.BearerTokenCredential;
import com.openai.models.conversations.Conversation;
import com.openai.models.conversations.items.ItemCreateParams;
import com.openai.models.responses.EasyInputMessage;
import com.openai.models.responses.Response;
import com.openai.models.responses.ResponseCreateParams;
import com.openai.services.blocking.ConversationService;
public class ChatWithAgent {
public static void main(String[] args) {
// Format: "https://resource_name.ai.azure.com/api/projects/project_name"
String ProjectEndpoint = "your_project_endpoint";
String AgentName = "your_agent_name";
AgentsClientBuilder builder = new AgentsClientBuilder()
.credential(new DefaultAzureCredentialBuilder().build())
.endpoint(ProjectEndpoint);
AgentsClient agentsClient = builder.buildAgentsClient();
ResponsesClient responsesClient = builder.buildResponsesClient();
ConversationService conversationService
= builder.buildOpenAIClient().conversations();
AgentDetails agent = agentsClient.getAgent(AgentName);
Conversation conversation = conversationService.create();
conversationService.items().create(
ItemCreateParams.builder()
.conversationId(conversation.id())
.addItem(EasyInputMessage.builder()
.role(EasyInputMessage.Role.SYSTEM)
.content("You are a helpful assistant that speaks like a pirate.")
.build()
).addItem(EasyInputMessage.builder()
.role(EasyInputMessage.Role.USER)
.content("Hello, agent!")
.build()
).build()
);
AgentReference agentReference = new AgentReference(agent.getName()).setVersion(agent.getVersion());
Response response = responsesClient.createAzureResponse(
new AzureCreateResponseOptions().setAgentReference(agentReference),
ResponseCreateParams.builder().conversation(conversation.id()));
OpenAIClient client = OpenAIOkHttpClient.builder()
.baseUrl(ProjectEndpoint.endsWith("/") ? ProjectEndpoint + "openai/v1" : ProjectEndpoint + "/openai/v1")
.credential(BearerTokenCredential.create(AuthenticationUtil.getBearerTokenSupplier(
new DefaultAzureCredentialBuilder().build(), "https://ai.azure.com/.default")))
.build();
ResponseCreateParams responseRequest = new ResponseCreateParams.Builder()
.input("Hello, how can you help me?")
.model("gpt-5-mini") //supports all Foundry direct models
.build();
Response result = client.responses().create(responseRequest);
}
}
استبدل YOUR-FOUNDRY-RESOURCE-NAME بقيمك:
curl -X POST https://YOUR-FOUNDRY-RESOURCE-NAME.services.ai.azure.com/api/projects/YOUR-PROJECT-NAME/openai/v1/responses \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $AZURE_AI_AUTH_TOKEN" \
-d '{
"model": "gpt-4.1-mini",
"input": "What is the size of France in square miles?"
}'
بعد نشر النموذج، يتم نقلك تلقائيا من الصفحة الرئيسية إلى قسم الإنشاء . تم اختيار الطراز الجديد الخاص بك وجاهز لك لتجربته.
ابدأ الدردشة مع عارضة الأزياء الخاصة بك ، على سبيل المثال ، "اكتب لي قصيدة عن الزهور".
بعد تشغيل الكود، ترى استجابة مولدة بواسطة نموذج في وحدة التحكم (على سبيل المثال، قصيدة قصيرة أو إجابة على طلبك). هذا يؤكد أن نقطة نهاية مشروعك، والمصادقة، ونشر النموذج تعمل بشكل صحيح.
نصيحة
يستخدم الكود Azure مشاريع الذكاء الاصطناعي 2.x وهو غير متوافق مع مشاريع الذكاء الاصطناعي Azure 1.x.
انظر وثائق Foundry (الكلاسيكية) لإصدار مشاريع الذكاء الاصطناعي Azure 1.x.
إنشَاء مندوب
قم بإنشاء وكيل باستخدام النموذج المنشور.
يحدد الوكيل السلوك الأساسي. بمجرد إنشائها ، يضمن استجابات متسقة في تفاعلات المستخدم دون تكرار التعليمات في كل مرة. يمكنك تحديث الوكلاء أو حذفهم في أي وقت.
from azure.identity import DefaultAzureCredential
from azure.ai.projects import AIProjectClient
from azure.ai.projects.models import PromptAgentDefinition
# Format: "https://resource_name.ai.azure.com/api/projects/project_name"
PROJECT_ENDPOINT = "your_project_endpoint"
AGENT_NAME = "your_agent_name"
# Create project client to call Foundry API
project = AIProjectClient(
endpoint=PROJECT_ENDPOINT,
credential=DefaultAzureCredential(),
)
# Create an agent with a model and instructions
agent = project.agents.create_version(
agent_name=AGENT_NAME,
definition=PromptAgentDefinition(
model="gpt-5-mini", # supports all Foundry direct models"
instructions="You are a helpful assistant that answers general questions",
),
)
print(f"Agent created (id: {agent.id}, name: {agent.name}, version: {agent.version})")
using Azure.Identity;
using Azure.AI.Projects;
using Azure.AI.Extensions.OpenAI;
// Format: "https://resource_name.ai.azure.com/api/projects/project_name"
var ProjectEndpoint = "your_project_endpoint";
var AgentName = "your_agent_name";
// Create project client to call Foundry API
AIProjectClient projectClient = new(
endpoint: new Uri(ProjectEndpoint),
tokenProvider: new DefaultAzureCredential());
// Create an agent with a model and instructions
AgentDefinition agentDefinition = new PromptAgentDefinition("gpt-5-mini") // supports all Foundry direct models
{
Instructions = "You are a helpful assistant that answers general questions",
};
AgentVersion agent = projectClient.Agents.CreateAgentVersion(
AgentName,
options: new(agentDefinition));
Console.WriteLine($"Agent created (id: {agent.Id}, name: {agent.Name}, version: {agent.Version})");
import { DefaultAzureCredential } from "@azure/identity";
import { AIProjectClient } from "@azure/ai-projects";
// Format: "https://resource_name.ai.azure.com/api/projects/project_name"
const PROJECT_ENDPOINT = "your_project_endpoint";
const AGENT_NAME = "your_agent_name";
async function main(): Promise<void> {
// Create project client to call Foundry API
const project = new AIProjectClient(PROJECT_ENDPOINT, new DefaultAzureCredential());
// Create an agent with a model and instructions
const agent = await project.agents.createVersion(AGENT_NAME, {
kind: "prompt",
model: "gpt-5-mini", //supports all Foundry direct models
instructions: "You are a helpful assistant that answers general questions",
});
console.log(`Agent created (id: ${agent.id}, name: ${agent.name}, version: ${agent.version})`);
}
main().catch(console.error);
package com.azure.ai.agents;
import com.azure.ai.agents.models.AgentVersionDetails;
import com.azure.ai.agents.models.PromptAgentDefinition;
import com.azure.identity.DefaultAzureCredentialBuilder;
public class CreateAgent {
public static void main(String[] args) {
// Format: "https://resource_name.ai.azure.com/api/projects/project_name"
String ProjectEndpoint = "your_project_endpoint";
String AgentName = "your_agent_name";
// Create agents client to call Foundry API
AgentsClient agentsClient = new AgentsClientBuilder()
.credential(new DefaultAzureCredentialBuilder().build())
.endpoint(ProjectEndpoint)
.buildAgentsClient();
// Create an agent with a model and instructions
PromptAgentDefinition request = new PromptAgentDefinition("gpt-5-mini") // supports all Foundry direct models
.setInstructions("You are a helpful assistant that answers general questions");
AgentVersionDetails agent = agentsClient.createAgentVersion(AgentName, request);
System.out.println("Agent ID: " + agent.getId());
System.out.println("Agent Name: " + agent.getName());
System.out.println("Agent Version: " + agent.getVersion());
}
}
استبدل YOUR-FOUNDRY-RESOURCE-NAME بقيمك:
curl -X POST https://YOUR-FOUNDRY-RESOURCE-NAME.services.ai.azure.com/api/projects/YOUR-PROJECT-NAME/agents?api-version=v1 \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $AZURE_AI_AUTH_TOKEN" \
-d '{
"name": "MyAgent",
"definition": {
"kind": "prompt",
"model": "gpt-4.1-mini",
"instructions": "You are a helpful assistant that answers general questions"
}
}'
الآن قم بإنشاء وكيل وتفاعل معه.
- لا يزال في قسم الإنشاء ، حدد الوكلاء في الجزء الأيمن.
- اختر إنشاء وكيل وأعطه اسما مثل "MyAgent".
تؤكد النتائج أن الوكيل تم إنشاؤه. بالنسبة لتبويب SDK، ترى اسم الوكيل ومعرفه مطبوعين على وحدة التحكم.
نصيحة
يستخدم الكود Azure مشاريع الذكاء الاصطناعي 2.x وهو غير متوافق مع مشاريع الذكاء الاصطناعي Azure 1.x.
انظر وثائق Foundry (الكلاسيكية) لإصدار مشاريع الذكاء الاصطناعي Azure 1.x.
الدردشة مع وكيل
استخدم العامل الذي تم إنشاؤه مسبقا باسم "MyAgent" للتفاعل عن طريق طرح سؤال ومتابعة ذات صلة. تحتفظ المحادثة بالتاريخ عبر هذه التفاعلات.
from azure.identity import DefaultAzureCredential
from azure.ai.projects import AIProjectClient
# Format: "https://resource_name.ai.azure.com/api/projects/project_name"
PROJECT_ENDPOINT = "your_project_endpoint"
AGENT_NAME = "your_agent_name"
# Create project and openai clients to call Foundry API
project = AIProjectClient(
endpoint=PROJECT_ENDPOINT,
credential=DefaultAzureCredential(),
)
openai = project.get_openai_client()
# Create a conversation for multi-turn chat
conversation = openai.conversations.create()
# Chat with the agent to answer questions
response = openai.responses.create(
conversation=conversation.id,
extra_body={"agent_reference": {"name": AGENT_NAME, "type": "agent_reference"}},
input="What is the size of France in square miles?",
)
print(response.output_text)
# Ask a follow-up question in the same conversation
response = openai.responses.create(
conversation=conversation.id,
extra_body={"agent_reference": {"name": AGENT_NAME, "type": "agent_reference"}},
input="And what is the capital city?",
)
print(response.output_text)
using Azure.Identity;
using Azure.AI.Projects;
using Azure.AI.Extensions.OpenAI;
using OpenAI.Responses;
#pragma warning disable OPENAI001
// Format: "https://resource_name.ai.azure.com/api/projects/project_name"
var ProjectEndpoint = "your_project_endpoint";
var AgentName = "your_agent_name";
// Create project client to call Foundry API
AIProjectClient projectClient = new(
endpoint: new Uri(ProjectEndpoint),
tokenProvider: new DefaultAzureCredential());
// Create a conversation for multi-turn chat
ProjectConversation conversation = projectClient.OpenAI.Conversations.CreateProjectConversation();
// Chat with the agent to answer questions
ProjectResponsesClient responsesClient = projectClient.OpenAI.GetProjectResponsesClientForAgent(
defaultAgent: AgentName,
defaultConversationId: conversation.Id);
ResponseResult response = responsesClient.CreateResponse("What is the size of France in square miles?");
Console.WriteLine(response.GetOutputText());
// Ask a follow-up question in the same conversation
response = responsesClient.CreateResponse("And what is the capital city?");
Console.WriteLine(response.GetOutputText());
import { DefaultAzureCredential } from "@azure/identity";
import { AIProjectClient } from "@azure/ai-projects";
// Format: "https://resource_name.ai.azure.com/api/projects/project_name"
const PROJECT_ENDPOINT = "your_project_endpoint";
const AGENT_NAME = "your_agent_name";
async function main(): Promise<void> {
// Create project and openai clients to call Foundry API
const project = new AIProjectClient(PROJECT_ENDPOINT, new DefaultAzureCredential());
const openai = project.getOpenAIClient();
// Create a conversation for multi-turn chat
const conversation = await openai.conversations.create();
// Chat with the agent to answer questions
const response = await openai.responses.create(
{
conversation: conversation.id,
input: "What is the size of France in square miles?",
},
{
body: { agent: { name: AGENT_NAME, type: "agent_reference" } },
},
);
console.log(response.output_text);
// Ask a follow-up question in the same conversation
const response2 = await openai.responses.create(
{
conversation: conversation.id,
input: "And what is the capital city?",
},
{
body: { agent: { name: FOUNDRY_AGENT_NAME, type: "agent_reference" } },
},
);
console.log(response2.output_text);
}
main().catch(console.error);
package com.azure.ai.agents;
import com.azure.ai.agents.models.AgentDetails;
import com.azure.ai.agents.models.AgentReference;
import com.azure.ai.agents.models.AzureCreateResponseOptions;
import com.azure.ai.agents.models.AgentVersionDetails;
import com.azure.ai.agents.models.PromptAgentDefinition;
import com.azure.identity.AuthenticationUtil;
import com.azure.identity.DefaultAzureCredentialBuilder;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.credential.BearerTokenCredential;
import com.openai.models.conversations.Conversation;
import com.openai.models.conversations.items.ItemCreateParams;
import com.openai.models.responses.EasyInputMessage;
import com.openai.models.responses.Response;
import com.openai.models.responses.ResponseCreateParams;
import com.openai.services.blocking.ConversationService;
public class ChatWithAgent {
public static void main(String[] args) {
// Format: "https://resource_name.ai.azure.com/api/projects/project_name"
String ProjectEndpoint = "your_project_endpoint";
String AgentName = "your_agent_name";
AgentsClientBuilder builder = new AgentsClientBuilder()
.credential(new DefaultAzureCredentialBuilder().build())
.endpoint(ProjectEndpoint);
AgentsClient agentsClient = builder.buildAgentsClient();
ResponsesClient responsesClient = builder.buildResponsesClient();
ConversationService conversationService
= builder.buildOpenAIClient().conversations();
AgentDetails agent = agentsClient.getAgent(AgentName);
Conversation conversation = conversationService.create();
conversationService.items().create(
ItemCreateParams.builder()
.conversationId(conversation.id())
.addItem(EasyInputMessage.builder()
.role(EasyInputMessage.Role.SYSTEM)
.content("You are a helpful assistant that speaks like a pirate.")
.build()
).addItem(EasyInputMessage.builder()
.role(EasyInputMessage.Role.USER)
.content("Hello, agent!")
.build()
).build()
);
AgentReference agentReference = new AgentReference(agent.getName()).setVersion(agent.getVersion());
Response response = responsesClient.createAzureResponse(
new AzureCreateResponseOptions().setAgentReference(agentReference),
ResponseCreateParams.builder().conversation(conversation.id()));
OpenAIClient client = OpenAIOkHttpClient.builder()
.baseUrl(ProjectEndpoint.endsWith("/") ? ProjectEndpoint + "openai/v1" : ProjectEndpoint + "/openai/v1")
.credential(BearerTokenCredential.create(AuthenticationUtil.getBearerTokenSupplier(
new DefaultAzureCredentialBuilder().build(), "https://ai.azure.com/.default")))
.build();
ResponseCreateParams responseRequest = new ResponseCreateParams.Builder()
.input("Hello, how can you help me?")
.model("gpt-5-mini") //supports all Foundry direct models
.build();
Response result = client.responses().create(responseRequest);
}
}
استبدل YOUR-FOUNDRY-RESOURCE-NAME بقيمك:
# Generate a response using the agent
curl -X POST https://YOUR-FOUNDRY-RESOURCE-NAME.services.ai.azure.com/api/projects/YOUR-PROJECT-NAME/openai/v1/responses \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $AZURE_AI_AUTH_TOKEN" \
-d '{
"agent_reference": {"type": "agent_reference", "name": "<AGENT_NAME>"},
"input": [{"role": "user", "content": "What is the size of France in square miles?"}]
}'
# Optional Step: Create a conversation to use with the agent
curl -X POST https://YOUR-FOUNDRY-RESOURCE-NAME.services.ai.azure.com/api/projects/YOUR-PROJECT-NAME/openai/v1/conversations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $AZURE_AI_AUTH_TOKEN" \
-d '{
"items": [
{
"type": "message",
"role": "user",
"content": [
{
"type": "input_text",
"text": "What is the size of France in square miles?"
}
]
}
]
}'
# Lets say Conversation ID created is conv_123456789. Use this in the next step
#Optional Step: Ask a follow-up question in the same conversation
curl -X POST https://YOUR-FOUNDRY-RESOURCE-NAME.services.ai.azure.com/api/projects/YOUR-PROJECT-NAME/openai/v1/responses \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $AZURE_AI_AUTH_TOKEN" \
-d '{
"agent_reference": {"type": "agent_reference", "name": "<AGENT_NAME>", "version": "1"},
"conversation": "<CONVERSATION_ID>",
"input": [{"role": "user", "content": "And what is the capital?"}]
}'
تفاعل مع وكيلك.
- أضف إرشادات، مثل "أنت مساعد كتابة مفيد".
- ابدأ الدردشة مع وكيلك ، على سبيل المثال ، "اكتب قصيدة عن الشمس".
- تابع ب "ماذا عن الهايكو؟"
ترى ردود الوكيل على كلتا الطلبات. يظهر الرد اللاحق أن العميل يحافظ على سجل المحادثات عبر الأدوار.
نصيحة
يستخدم الكود Azure مشاريع الذكاء الاصطناعي 2.x وهو غير متوافق مع مشاريع الذكاء الاصطناعي Azure 1.x.
انظر وثائق Foundry (الكلاسيكية) لإصدار مشاريع الذكاء الاصطناعي Azure 1.x.
تنظيف الموارد
إذا لم تعد بحاجة إلى أي من الموارد التي قمت بإنشائها، فاحذف مجموعة الموارد المقترنة بمشروعك.
- في بوابة Azure، اختر مجموعة الموارد، ثم اختر Delete. تأكد من رغبتك في حذف مجموعة الموارد.
الخطوة التالية