Share via


AIProjectClient Class

AIProjectClient.

Constructor

AIProjectClient(endpoint: str, credential: TokenCredential, **kwargs: Any)

Parameters

Name Description
endpoint
Required
str

Foundry Project endpoint in the form https://{ai-services-account-name}.services.ai.azure.com/api/projects/{project-name}. If you only have one Project in your Foundry Hub, or to target the default Project in your Hub, use the form https://{ai-services-account-name}.services.ai.azure.com/api/projects/_project. Required.

credential
Required

Credential used to authenticate requests to the service. Required.

Keyword-Only Parameters

Name Description
api_version
str

The API version to use for this operation. Default value is "2025-11-15-preview". Note that overriding this default value may result in unsupported behavior.

polling_interval
int

Default waiting time between two polls for LRO operations if no Retry-After header is present.

Variables

Name Description
agents

AgentsOperations operations

memory_stores

MemoryStoresOperations operations

connections

ConnectionsOperations operations

datasets

DatasetsOperations operations

indexes

IndexesOperations operations

deployments

DeploymentsOperations operations

red_teams

RedTeamsOperations operations

evaluation_rules

EvaluationRulesOperations operations

evaluation_taxonomies

EvaluationTaxonomiesOperations operations

evaluators

EvaluatorsOperations operations

insights

InsightsOperations operations

schedules

SchedulesOperations operations

Methods

close
get_openai_client

Get an authenticated OpenAI client from the openai package.

Keyword arguments are passed to the OpenAI client constructor.

The OpenAI client constructor is called with:

  • base_url set to the endpoint provided to the AIProjectClient constructor, with "/openai" appended.

  • api-version set to "2025-05-15-preview" by default, unless overridden by the api_version keyword argument.

  • api_key set to a get_bearer_token_provider() callable that uses the TokenCredential provided to the AIProjectClient constructor, with scope "https://ai.azure.com/.default".

Note

The packages openai and azure.identity must be installed prior to calling this method.

send_request

Runs the network request through the client's chained policies.


>>> from azure.core.rest import HttpRequest
>>> request = HttpRequest("GET", "https://www.example.org/")
<HttpRequest [GET], url: 'https://www.example.org/'>
>>> response = client.send_request(request)
<HttpResponse: 200 OK>

For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request

close

close() -> None

get_openai_client

Get an authenticated OpenAI client from the openai package.

Keyword arguments are passed to the OpenAI client constructor.

The OpenAI client constructor is called with:

  • base_url set to the endpoint provided to the AIProjectClient constructor, with "/openai" appended.

  • api-version set to "2025-05-15-preview" by default, unless overridden by the api_version keyword argument.

  • api_key set to a get_bearer_token_provider() callable that uses the TokenCredential provided to the AIProjectClient constructor, with scope "https://ai.azure.com/.default".

Note

The packages openai and azure.identity must be installed prior to calling this method.

get_openai_client(**kwargs: Any) -> OpenAI

Returns

Type Description
<xref:openai.OpenAI>

An authenticated OpenAI client

Exceptions

Type Description
azure.core.exceptions.ModuleNotFoundError

if the openai package is not installed.

send_request

Runs the network request through the client's chained policies.


>>> from azure.core.rest import HttpRequest
>>> request = HttpRequest("GET", "https://www.example.org/")
<HttpRequest [GET], url: 'https://www.example.org/'>
>>> response = client.send_request(request)
<HttpResponse: 200 OK>

For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request

send_request(request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse

Parameters

Name Description
request
Required

The network request you want to make. Required.

Keyword-Only Parameters

Name Description
stream

Whether the response payload will be streamed. Defaults to False.

Default value: False

Returns

Type Description

The response of your network call. Does not do error handling on your response.