AIProjectClient Class
AIProjectClient.
Constructor
AIProjectClient(endpoint: str, credential: TokenCredential, **kwargs: Any)
Parameters
| Name | Description |
|---|---|
|
endpoint
Required
|
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
|
The API version to use for this operation. Known values are "v1" and None. Default value is "v1". Note that overriding this default value may result in unsupported behavior. |
Variables
| Name | Description |
|---|---|
|
beta
|
BetaOperations operations |
|
agents
|
AgentsOperations operations |
|
evaluation_rules
|
EvaluationRulesOperations operations |
|
connections
|
ConnectionsOperations operations |
|
datasets
|
DatasetsOperations operations |
|
deployments
|
DeploymentsOperations operations |
|
indexes
|
IndexesOperations 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:
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.
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_urlset to the endpoint provided to the AIProjectClient constructor, with "/openai/v1" appended. Can be overridden by passingbase_urlas a keyword argument.api_keyset to a get_bearer_token_provider() callable that uses the TokenCredential provided to the AIProjectClient constructor, with scope "https://ai.azure.com/.default". Can be overridden by passingapi_keyas a keyword argument.
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 |
|---|---|
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. |