azure.ai.projects.operations package

class azure.ai.projects.operations.AgentsOperations(*args, **kwargs)[source]
cancel_run(thread_id: str, run_id: str, **kwargs: Any) ThreadRun[source]

Cancels a run of an in progress thread.

Parameters:
  • thread_id (str) – Identifier of the thread. Required.

  • run_id (str) – Identifier of the run. Required.

Returns:

ThreadRun. The ThreadRun is compatible with MutableMapping

Return type:

ThreadRun

Raises:

HttpResponseError

cancel_vector_store_file_batch(vector_store_id: str, batch_id: str, **kwargs: Any) VectorStoreFileBatch[source]

Cancel a vector store file batch. This attempts to cancel the processing of files in this batch as soon as possible.

Parameters:
  • vector_store_id (str) – Identifier of the vector store. Required.

  • batch_id (str) – Identifier of the file batch. Required.

Returns:

VectorStoreFileBatch. The VectorStoreFileBatch is compatible with MutableMapping

Return type:

VectorStoreFileBatch

Raises:

HttpResponseError

create_agent(*, model: str, content_type: str = 'application/json', name: str | None = None, description: str | None = None, instructions: str | None = None, tools: List[_models.ToolDefinition] | None = None, tool_resources: _models.ToolResources | None = None, temperature: float | None = None, top_p: float | None = None, response_format: '_types.AgentsApiResponseFormatOption' | None = None, metadata: Dict[str, str] | None = None, **kwargs: Any) _models.Agent[source]
create_agent(*, model: str, content_type: str = 'application/json', name: str | None = None, description: str | None = None, instructions: str | None = None, toolset: _models.ToolSet | None = None, temperature: float | None = None, top_p: float | None = None, response_format: '_types.AgentsApiResponseFormatOption' | None = None, metadata: Dict[str, str] | None = None, **kwargs: Any) _models.Agent
create_agent(body: JSON, *, content_type: str = 'application/json', **kwargs: Any) _models.Agent
create_agent(body: IO[bytes], *, content_type: str = 'application/json', **kwargs: Any) _models.Agent

Creates a new agent with various configurations, delegating to the generated operations.

Parameters:

body (Union[JSON, IO[bytes]]) – JSON or IO[bytes]. Required if model is not provided.

Keyword Arguments:
  • model (str) – The ID of the model to use. Required if body is not provided.

  • name (Optional[str]) – The name of the new agent.

  • description (Optional[str]) – A description for the new agent.

  • instructions (Optional[str]) – System instructions for the agent.

  • tools (Optional[List[_models.ToolDefinition]]) – List of tools definitions for the agent.

  • tool_resources (Optional[_models.ToolResources]) – Resources used by the agent’s tools.

  • toolset (Optional[_models.ToolSet]) – Collection of tools and resources (alternative to tools and tool_resources and adds automatic execution logic for functions).

  • temperature (Optional[float]) – Sampling temperature for generating agent responses.

  • top_p (Optional[float]) – Nucleus sampling parameter.

  • response_format (Optional["_types.AgentsApiResponseFormatOption"]) – Response format for tool calls.

  • metadata (Optional[Dict[str, str]]) – Key/value pairs for storing additional information.

  • content_type (str) – Content type of the body.

Returns:

An Agent object.

Return type:

_models.Agent

Raises:

HttpResponseError for HTTP errors.

create_and_process_run(thread_id: str, *, assistant_id: str, include: List[str | RunAdditionalFieldList] | None = None, model: str | None = None, instructions: str | None = None, additional_instructions: str | None = None, additional_messages: List[ThreadMessageOptions] | None = None, toolset: ToolSet | None = None, temperature: float | None = None, top_p: float | None = None, max_prompt_tokens: int | None = None, max_completion_tokens: int | None = None, truncation_strategy: TruncationObject | None = None, tool_choice: _types.AgentsApiToolChoiceOption | None = None, response_format: _types.AgentsApiResponseFormatOption | None = None, parallel_tool_calls: bool | None = None, metadata: Dict[str, str] | None = None, sleep_interval: int = 1, **kwargs: Any) ThreadRun[source]

Creates a new run for an agent thread and processes the run.

Parameters:

thread_id (str) – Required.

Keyword Arguments:
  • assistant_id (str) – The ID of the agent that should run the thread. Required.

  • include (list[str or RunAdditionalFieldList]) – A list of additional fields to include in the response. Currently the only supported value is step_details.tool_calls[*].file_search.results[*].content to fetch the file search result content. Default value is None.

  • model (str) – The overridden model name that the agent should use to run the thread. Default value is None.

  • instructions (str) – The overridden system instructions that the agent should use to run the thread. Default value is None.

  • additional_instructions (str) – Additional instructions to append at the end of the instructions for the run. This is useful for modifying the behavior on a per-run basis without overriding other instructions. Default value is None.

  • additional_messages (list[ThreadMessageOptions]) – Adds additional messages to the thread before creating the run. Default value is None.

  • toolset (ToolSet) – The Collection of tools and resources (alternative to tools and tool_resources). Default value is None.

  • temperature (float) – What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. Default value is None.

  • top_p (float) –

    An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.

    We generally recommend altering this or temperature but not both. Default value is None.

  • max_prompt_tokens (int) – The maximum number of prompt tokens that may be used over the course of the run. The run will make a best effort to use only the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt tokens specified, the run will end with status incomplete. See incomplete_details for more info. Default value is None.

  • max_completion_tokens (int) – The maximum number of completion tokens that may be used over the course of the run. The run will make a best effort to use only the number of completion tokens specified, across multiple turns of the run. If the run exceeds the number of completion tokens specified, the run will end with status incomplete. See incomplete_details for more info. Default value is None.

  • truncation_strategy (TruncationObject) – The strategy to use for dropping messages as the context windows moves forward. Default value is None.

  • tool_choice (str or str or AgentsApiToolChoiceOptionMode or AgentsNamedToolChoice) – Controls whether or not and which tool is called by the model. Is one of the following types: str, Union[str, “_models.AgentsApiToolChoiceOptionMode”], AgentsNamedToolChoice Default value is None.

  • response_format (str or str or AgentsApiResponseFormatMode or AgentsApiResponseFormat) – Specifies the format that the model must output. Is one of the following types: str, Union[str, “_models.AgentsApiResponseFormatMode”], AgentsApiResponseFormat Default value is None.

  • parallel_tool_calls (bool) – If true functions will run in parallel during tool use. Default value is None.

  • metadata (dict[str, str]) – A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. Default value is None.

  • sleep_interval (int) – The time in seconds to wait between polling the service for run status. Default value is 1.

Returns:

AgentRunStream. AgentRunStream is compatible with Iterable and supports streaming.

Return type:

AgentRunStream

Raises:

HttpResponseError

create_message(thread_id: str, body: ~collections.abc.MutableMapping[str, ~typing.Any] | ~typing.IO[bytes] = <object object>, *, role: str | ~azure.ai.projects.models._enums.MessageRole = <object object>, content: str = <object object>, attachments: ~typing.List[~azure.ai.projects.models._patch.MessageAttachment] | None = None, metadata: ~typing.Dict[str, str] | None = None, **kwargs: ~typing.Any) ThreadMessage[source]

Creates a new message on a specified thread.

Parameters:
  • thread_id (str) – Identifier of the thread. Required.

  • body (JSON or IO[bytes]) – Is either a JSON type or a IO[bytes] type. Required.

Keyword Arguments:
  • role (str or MessageRole) –

    The role of the entity that is creating the message. Allowed values include:

    • user: Indicates the message is sent by an actual user and should be used in most cases to represent user-generated messages.

    • assistant: Indicates the message is generated by the agent. Use this value to insert messages from the agent into the conversation. Known values are: “user” and “assistant”. Required.

  • content (str) – The textual content of the initial message. Currently, robust input including images and annotated text may only be provided via a separate call to the create message API. Required.

  • attachments (list[MessageAttachment]) – A list of files attached to the message, and the tools they should be added to. Default value is None.

  • metadata (dict[str, str]) – A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. Default value is None.

Returns:

ThreadMessage. The ThreadMessage is compatible with MutableMapping

Return type:

ThreadMessage

Raises:

HttpResponseError

create_run(thread_id: str, *, assistant_id: str, include: List[str | _models.RunAdditionalFieldList] | None = None, content_type: str = 'application/json', model: str | None = None, instructions: str | None = None, additional_instructions: str | None = None, additional_messages: List[_models.ThreadMessageOptions] | None = None, tools: List[_models.ToolDefinition] | None = None, temperature: float | None = None, top_p: float | None = None, max_prompt_tokens: int | None = None, max_completion_tokens: int | None = None, truncation_strategy: _models.TruncationObject | None = None, tool_choice: '_types.AgentsApiToolChoiceOption' | None = None, response_format: '_types.AgentsApiResponseFormatOption' | None = None, parallel_tool_calls: bool | None = None, metadata: Dict[str, str] | None = None, **kwargs: Any) _models.ThreadRun[source]
create_run(thread_id: str, body: JSON, *, include: List[str | _models.RunAdditionalFieldList] | None = None, content_type: str = 'application/json', **kwargs: Any) _models.ThreadRun
create_run(thread_id: str, body: IO[bytes], *, include: List[str | _models.RunAdditionalFieldList] | None = None, content_type: str = 'application/json', **kwargs: Any) _models.ThreadRun

Creates a new run for an agent thread.

Parameters:
  • thread_id (str) – Required.

  • body (JSON or IO[bytes]) – Is either a JSON type or a IO[bytes] type. Required.

Keyword Arguments:
  • include (list[str or RunAdditionalFieldList]) – A list of additional fields to include in the response. Currently the only supported value is step_details.tool_calls[*].file_search.results[*].content to fetch the file search result content. Default value is None.

  • assistant_id (str) – The ID of the agent that should run the thread. Required.

  • model (str) – The overridden model name that the agent should use to run the thread. Default value is None.

  • instructions (str) – The overridden system instructions that the agent should use to run the thread. Default value is None.

  • additional_instructions (str) – Additional instructions to append at the end of the instructions for the run. This is useful for modifying the behavior on a per-run basis without overriding other instructions. Default value is None.

  • additional_messages (list[ThreadMessageOptions]) – Adds additional messages to the thread before creating the run. Default value is None.

  • tools (list[ToolDefinition]) – The overridden list of enabled tools that the agent should use to run the thread. Default value is None.

  • temperature (float) – What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. Default value is None.

  • top_p (float) –

    An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.

    We generally recommend altering this or temperature but not both. Default value is None.

  • max_prompt_tokens (int) – The maximum number of prompt tokens that may be used over the course of the run. The run will make a best effort to use only the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt tokens specified, the run will end with status incomplete. See incomplete_details for more info. Default value is None.

  • max_completion_tokens (int) – The maximum number of completion tokens that may be used over the course of the run. The run will make a best effort to use only the number of completion tokens specified, across multiple turns of the run. If the run exceeds the number of completion tokens specified, the run will end with status incomplete. See incomplete_details for more info. Default value is None.

  • truncation_strategy (TruncationObject) – The strategy to use for dropping messages as the context windows moves forward. Default value is None.

  • tool_choice (str or str or AgentsApiToolChoiceOptionMode or AgentsNamedToolChoice) – Controls whether or not and which tool is called by the model. Is one of the following types: str, Union[str, “_models.AgentsApiToolChoiceOptionMode”], AgentsNamedToolChoice Default value is None.

  • response_format (str or str or AgentsApiResponseFormatMode or AgentsApiResponseFormat) – Specifies the format that the model must output. Is one of the following types: str, Union[str, “_models.AgentsApiResponseFormatMode”], AgentsApiResponseFormat Default value is None.

  • parallel_tool_calls (bool) – If true functions will run in parallel during tool use. Default value is None.

  • metadata (dict[str, str]) – A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. Default value is None.

Returns:

ThreadRun. The ThreadRun is compatible with MutableMapping

Return type:

ThreadRun

Raises:

HttpResponseError

create_stream(thread_id: str, *, include: List[str | _models.RunAdditionalFieldList] | None = None, assistant_id: str, content_type: str = 'application/json', model: str | None = None, instructions: str | None = None, additional_instructions: str | None = None, additional_messages: List[_models.ThreadMessageOptions] | None = None, tools: List[_models.ToolDefinition] | None = None, temperature: float | None = None, top_p: float | None = None, max_prompt_tokens: int | None = None, max_completion_tokens: int | None = None, truncation_strategy: _models.TruncationObject | None = None, tool_choice: '_types.AgentsApiToolChoiceOption' | None = None, response_format: '_types.AgentsApiResponseFormatOption' | None = None, parallel_tool_calls: bool | None = None, metadata: Dict[str, str] | None = None, event_handler: None = None, **kwargs: Any) _models.AgentRunStream[_models.AgentEventHandler][source]
create_stream(thread_id: str, *, assistant_id: str, include: List[str | _models.RunAdditionalFieldList] | None = None, content_type: str = 'application/json', model: str | None = None, instructions: str | None = None, additional_instructions: str | None = None, additional_messages: List[_models.ThreadMessageOptions] | None = None, tools: List[_models.ToolDefinition] | None = None, temperature: float | None = None, top_p: float | None = None, max_prompt_tokens: int | None = None, max_completion_tokens: int | None = None, truncation_strategy: _models.TruncationObject | None = None, tool_choice: '_types.AgentsApiToolChoiceOption' | None = None, response_format: '_types.AgentsApiResponseFormatOption' | None = None, parallel_tool_calls: bool | None = None, metadata: Dict[str, str] | None = None, event_handler: _models.BaseAgentEventHandlerT, **kwargs: Any) _models.AgentRunStream[_models.BaseAgentEventHandlerT]
create_stream(thread_id: str, body: JSON | IO[bytes], *, include: List[str | _models.RunAdditionalFieldList] | None = None, event_handler: None = None, content_type: str = 'application/json', **kwargs: Any) _models.AgentRunStream[_models.AgentEventHandler]
create_stream(thread_id: str, body: JSON | IO[bytes], *, event_handler: _models.BaseAgentEventHandlerT, include: List[str | _models.RunAdditionalFieldList] | None = None, content_type: str = 'application/json', **kwargs: Any) _models.AgentRunStream[_models.BaseAgentEventHandlerT]

Creates a new run for an agent thread.

Terminating when the Run enters a terminal state with a data: [DONE] message.

Parameters:
  • thread_id (str) – Required.

  • body (JSON or IO[bytes]) – Is either a JSON type or a IO[bytes] type. Required.

Keyword Arguments:
  • include (list[str or RunAdditionalFieldList]) – A list of additional fields to include in the response. Currently the only supported value is step_details.tool_calls[*].file_search.results[*].content to fetch the file search result content. Default value is None.

  • assistant_id (str) – The ID of the agent that should run the thread. Required.

  • model (str) – The overridden model name that the agent should use to run the thread. Default value is None.

  • instructions (str) – The overridden system instructions that the agent should use to run the thread. Default value is None.

  • additional_instructions (str) – Additional instructions to append at the end of the instructions for the run. This is useful for modifying the behavior on a per-run basis without overriding other instructions. Default value is None.

  • additional_messages (list[ThreadMessage]) – Adds additional messages to the thread before creating the run. Default value is None.

  • tools (list[ToolDefinition]) – The overridden list of enabled tools that the agent should use to run the thread. Default value is None.

  • temperature (float) – What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. Default value is None.

  • top_p (float) –

    An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.

    We generally recommend altering this or temperature but not both. Default value is None.

  • max_prompt_tokens (int) – The maximum number of prompt tokens that may be used over the course of the run. The run will make a best effort to use only the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt tokens specified, the run will end with status incomplete. See incomplete_details for more info. Default value is None.

  • max_completion_tokens (int) – The maximum number of completion tokens that may be used over the course of the run. The run will make a best effort to use only the number of completion tokens specified, across multiple turns of the run. If the run exceeds the number of completion tokens specified, the run will end with status incomplete. See incomplete_details for more info. Default value is None.

  • truncation_strategy (TruncationObject) – The strategy to use for dropping messages as the context windows moves forward. Default value is None.

  • tool_choice (str or str or AgentsApiToolChoiceOptionMode or AgentsNamedToolChoice) – Controls whether or not and which tool is called by the model. Is one of the following types: str, Union[str, “_models.AgentsApiToolChoiceOptionMode”], AgentsNamedToolChoice Default value is None.

  • response_format (str or str or AgentsApiResponseFormatMode or AgentsApiResponseFormat) – Specifies the format that the model must output. Is one of the following types: str, Union[str, “_models.AgentsApiResponseFormatMode”], AgentsApiResponseFormat Default value is None.

  • parallel_tool_calls (bool) – If true functions will run in parallel during tool use. Default value is None.

  • metadata (dict[str, str]) – A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. Default value is None.

  • event_handler (AgentEventHandler) – The event handler to use for processing events during the run. Default value is None.

Returns:

AgentRunStream. AgentRunStream is compatible with Iterable and supports streaming.

Return type:

AgentRunStream

Raises:

HttpResponseError

create_thread(body: ~collections.abc.MutableMapping[str, ~typing.Any] | ~typing.IO[bytes] = <object object>, *, messages: ~typing.List[~azure.ai.projects.models._models.ThreadMessageOptions] | None = None, tool_resources: ~azure.ai.projects.models._models.ToolResources | None = None, metadata: ~typing.Dict[str, str] | None = None, **kwargs: ~typing.Any) AgentThread[source]

Creates a new thread. Threads contain messages and can be run by agents.

Parameters:

body (JSON or IO[bytes]) – Is either a JSON type or a IO[bytes] type. Required.

Keyword Arguments:
  • messages (list[ThreadMessageOptions]) – The initial messages to associate with the new thread. Default value is None.

  • tool_resources (ToolResources) – A set of resources that are made available to the agent’s tools in this thread. The resources are specific to the type of tool. For example, the code_interpreter tool requires a list of file IDs, while the file_search tool requires a list of vector store IDs. Default value is None.

  • metadata (dict[str, str]) – A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. Default value is None.

Returns:

AgentThread. The AgentThread is compatible with MutableMapping

Return type:

AgentThread

Raises:

HttpResponseError

create_thread_and_run(body: ~collections.abc.MutableMapping[str, ~typing.Any] | ~typing.IO[bytes] = <object object>, *, assistant_id: str = <object object>, thread: ~azure.ai.projects.models._models.AgentThreadCreationOptions | None = None, model: str | None = None, instructions: str | None = None, tools: ~typing.List[~azure.ai.projects.models._models.ToolDefinition] | None = None, tool_resources: ~azure.ai.projects.models._models.UpdateToolResourcesOptions | None = None, stream_parameter: bool | None = None, temperature: float | None = None, top_p: float | None = None, max_prompt_tokens: int | None = None, max_completion_tokens: int | None = None, truncation_strategy: ~azure.ai.projects.models._models.TruncationObject | None = None, tool_choice: _types.AgentsApiToolChoiceOption | None = None, response_format: _types.AgentsApiResponseFormatOption | None = None, parallel_tool_calls: bool | None = None, metadata: ~typing.Dict[str, str] | None = None, **kwargs: ~typing.Any) ThreadRun[source]

Creates a new agent thread and immediately starts a run using that new thread.

Parameters:

body (JSON or IO[bytes]) – Is either a JSON type or a IO[bytes] type. Required.

Keyword Arguments:
  • assistant_id (str) – The ID of the agent for which the thread should be created. Required.

  • thread (AgentThreadCreationOptions) – The details used to create the new thread. If no thread is provided, an empty one will be created. Default value is None.

  • model (str) – The overridden model that the agent should use to run the thread. Default value is None.

  • instructions (str) – The overridden system instructions the agent should use to run the thread. Default value is None.

  • tools (list[ToolDefinition]) – The overridden list of enabled tools the agent should use to run the thread. Default value is None.

  • tool_resources (UpdateToolResourcesOptions) – Override the tools the agent can use for this run. This is useful for modifying the behavior on a per-run basis. Default value is None.

  • stream_parameter (bool) – If true, returns a stream of events that happen during the Run as server-sent events, terminating when the Run enters a terminal state with a data: [DONE] message. Default value is None.

  • temperature (float) – What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. Default value is None.

  • top_p (float) –

    An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.

    We generally recommend altering this or temperature but not both. Default value is None.

  • max_prompt_tokens (int) – The maximum number of prompt tokens that may be used over the course of the run. The run will make a best effort to use only the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt tokens specified, the run will end with status incomplete. See incomplete_details for more info. Default value is None.

  • max_completion_tokens (int) – The maximum number of completion tokens that may be used over the course of the run. The run will make a best effort to use only the number of completion tokens specified, across multiple turns of the run. If the run exceeds the number of completion tokens specified, the run will end with status incomplete. See incomplete_details for more info. Default value is None.

  • truncation_strategy (TruncationObject) – The strategy to use for dropping messages as the context windows moves forward. Default value is None.

  • tool_choice (str or str or AgentsApiToolChoiceOptionMode or AgentsNamedToolChoice) – Controls whether or not and which tool is called by the model. Is one of the following types: str, Union[str, “_models.AgentsApiToolChoiceOptionMode”], AgentsNamedToolChoice Default value is None.

  • response_format (str or str or AgentsApiResponseFormatMode or AgentsApiResponseFormat or ResponseFormatJsonSchemaType) – Specifies the format that the model must output. Is one of the following types: str, Union[str, “_models.AgentsApiResponseFormatMode”], AgentsApiResponseFormat, ResponseFormatJsonSchemaType Default value is None.

  • parallel_tool_calls (bool) – If true functions will run in parallel during tool use. Default value is None.

  • metadata (dict[str, str]) – A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. Default value is None.

Returns:

ThreadRun. The ThreadRun is compatible with MutableMapping

Return type:

ThreadRun

Raises:

HttpResponseError

create_vector_store(body: ~collections.abc.MutableMapping[str, ~typing.Any] | ~typing.IO[bytes] = <object object>, *, file_ids: ~typing.List[str] | None = None, name: str | None = None, store_configuration: ~azure.ai.projects.models._models.VectorStoreConfiguration | None = None, expires_after: ~azure.ai.projects.models._models.VectorStoreExpirationPolicy | None = None, chunking_strategy: ~azure.ai.projects.models._models.VectorStoreChunkingStrategyRequest | None = None, metadata: ~typing.Dict[str, str] | None = None, **kwargs: ~typing.Any) VectorStore[source]

Creates a vector store.

Parameters:

body (JSON or IO[bytes]) – Is either a JSON type or a IO[bytes] type. Required.

Keyword Arguments:
  • file_ids (list[str]) – A list of file IDs that the vector store should use. Useful for tools like file_search that can access files. Default value is None.

  • name (str) – The name of the vector store. Default value is None.

  • store_configuration (VectorStoreConfiguration) – The vector store configuration, used when vector store is created from Azure asset URIs. Default value is None.

  • expires_after (VectorStoreExpirationPolicy) – Details on when this vector store expires. Default value is None.

  • chunking_strategy (VectorStoreChunkingStrategyRequest) – The chunking strategy used to chunk the file(s). If not set, will use the auto strategy. Only applicable if file_ids is non-empty. Default value is None.

  • metadata (dict[str, str]) – A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. Default value is None.

Returns:

VectorStore. The VectorStore is compatible with MutableMapping

Return type:

VectorStore

Raises:

HttpResponseError

create_vector_store_and_poll(body: JSON, *, content_type: str = 'application/json', sleep_interval: float = 1, **kwargs: Any) _models.VectorStore[source]
create_vector_store_and_poll(*, content_type: str = 'application/json', file_ids: List[str] | None = None, name: str | None = None, data_sources: List[_models.VectorStoreDataSource] | None = None, expires_after: _models.VectorStoreExpirationPolicy | None = None, chunking_strategy: _models.VectorStoreChunkingStrategyRequest | None = None, metadata: Dict[str, str] | None = None, sleep_interval: float = 1, **kwargs: Any) _models.VectorStore
create_vector_store_and_poll(body: IO[bytes], *, content_type: str = 'application/json', sleep_interval: float = 1, **kwargs: Any) _models.VectorStore

Creates a vector store and poll.

Parameters:

body (JSON or IO[bytes]) – Is either a JSON type or a IO[bytes] type. Required.

Keyword Arguments:
  • content_type (str) – Body Parameter content-type. Content type parameter for binary body. Default value is “application/json”.

  • file_ids (list[str]) – A list of file IDs that the vector store should use. Useful for tools like file_search that can access files. Default value is None.

  • name (str) – The name of the vector store. Default value is None.

  • data_sources (list[VectorStoreDataSource]) – List of Azure assets. Default value is None.

  • expires_after (VectorStoreExpirationPolicy) – Details on when this vector store expires. Default value is None.

  • chunking_strategy (VectorStoreChunkingStrategyRequest) – The chunking strategy used to chunk the file(s). If not set, will use the auto strategy. Only applicable if file_ids is non-empty. Default value is None.

  • metadata (dict[str, str]) – A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. Default value is None.

  • sleep_interval (float) – Time to wait before polling for the status of the vector store. Default value is 1.

Returns:

VectorStore. The VectorStore is compatible with MutableMapping

Return type:

VectorStore

Raises:

HttpResponseError

create_vector_store_file(vector_store_id: str, body: ~collections.abc.MutableMapping[str, ~typing.Any] | ~typing.IO[bytes] = <object object>, *, file_id: str | None = None, data_source: ~azure.ai.projects.models._models.VectorStoreDataSource | None = None, chunking_strategy: ~azure.ai.projects.models._models.VectorStoreChunkingStrategyRequest | None = None, **kwargs: ~typing.Any) VectorStoreFile[source]

Create a vector store file by attaching a file to a vector store.

Parameters:
  • vector_store_id (str) – Identifier of the vector store. Required.

  • body (JSON or IO[bytes]) – Is either a JSON type or a IO[bytes] type. Required.

Keyword Arguments:
  • file_id (str) – Identifier of the file. Default value is None.

  • data_source (VectorStoreDataSource) – Azure asset ID. Default value is None.

  • chunking_strategy (VectorStoreChunkingStrategyRequest) – The chunking strategy used to chunk the file(s). If not set, will use the auto strategy. Default value is None.

Returns:

VectorStoreFile. The VectorStoreFile is compatible with MutableMapping

Return type:

VectorStoreFile

Raises:

HttpResponseError

create_vector_store_file_and_poll(vector_store_id: str, body: JSON, *, content_type: str = 'application/json', sleep_interval: float = 1, **kwargs: Any) _models.VectorStoreFile[source]
create_vector_store_file_and_poll(vector_store_id: str, *, content_type: str = 'application/json', file_id: str | None = None, data_source: _models.VectorStoreDataSource | None = None, chunking_strategy: _models.VectorStoreChunkingStrategyRequest | None = None, sleep_interval: float = 1, **kwargs: Any) _models.VectorStoreFile
create_vector_store_file_and_poll(vector_store_id: str, body: IO[bytes], *, content_type: str = 'application/json', sleep_interval: float = 1, **kwargs: Any) _models.VectorStoreFile

Create a vector store file by attaching a file to a vector store.

Parameters:
  • vector_store_id (str) – Identifier of the vector store. Required.

  • body (JSON or IO[bytes]) – Is either a JSON type or a IO[bytes] type. Required.

Keyword Arguments:
  • content_type (str) – Body Parameter content-type. Defaults to ‘application/json’.

  • file_id (str) – Identifier of the file. Default value is None.

  • data_source (VectorStoreDataSource) – Azure asset ID. Default value is None.

  • chunking_strategy (VectorStoreChunkingStrategyRequest) – The chunking strategy used to chunk the file(s). If not set, will use the auto strategy. Default value is None.

  • sleep_interval (float) – Time to wait before polling for the status of the vector store. Default value is 1.

Returns:

VectorStoreFile. The VectorStoreFile is compatible with MutableMapping

Return type:

VectorStoreFile

Raises:

HttpResponseError

create_vector_store_file_batch(vector_store_id: str, body: ~collections.abc.MutableMapping[str, ~typing.Any] | ~typing.IO[bytes] = <object object>, *, file_ids: ~typing.List[str] | None = None, data_sources: ~typing.List[~azure.ai.projects.models._models.VectorStoreDataSource] | None = None, chunking_strategy: ~azure.ai.projects.models._models.VectorStoreChunkingStrategyRequest | None = None, **kwargs: ~typing.Any) VectorStoreFileBatch[source]

Create a vector store file batch.

Parameters:
  • vector_store_id (str) – Identifier of the vector store. Required.

  • body (JSON or IO[bytes]) – Is either a JSON type or a IO[bytes] type. Required.

Keyword Arguments:
  • file_ids (list[str]) – List of file identifiers. Default value is None.

  • data_sources (list[VectorStoreDataSource]) – List of Azure assets. Default value is None.

  • chunking_strategy (VectorStoreChunkingStrategyRequest) – The chunking strategy used to chunk the file(s). If not set, will use the auto strategy. Default value is None.

Returns:

VectorStoreFileBatch. The VectorStoreFileBatch is compatible with MutableMapping

Return type:

VectorStoreFileBatch

Raises:

HttpResponseError

create_vector_store_file_batch_and_poll(vector_store_id: str, body: JSON, *, content_type: str = 'application/json', sleep_interval: float = 1, **kwargs: Any) _models.VectorStoreFileBatch[source]
create_vector_store_file_batch_and_poll(vector_store_id: str, *, file_ids: List[str] | None = None, data_sources: List[_models.VectorStoreDataSource] | None = None, content_type: str = 'application/json', chunking_strategy: _models.VectorStoreChunkingStrategyRequest | None = None, sleep_interval: float = 1, **kwargs: Any) _models.VectorStoreFileBatch
create_vector_store_file_batch_and_poll(vector_store_id: str, body: IO[bytes], *, content_type: str = 'application/json', sleep_interval: float = 1, **kwargs: Any) _models.VectorStoreFileBatch

Create a vector store file batch and poll.

Parameters:
  • vector_store_id (str) – Identifier of the vector store. Required.

  • body (JSON or IO[bytes]) – Is either a JSON type or a IO[bytes] type. Required.

Keyword Arguments:
  • file_ids (list[str]) – List of file identifiers. Required.

  • data_sources (list[VectorStoreDataSource]) – List of Azure assets. Default value is None.

  • chunking_strategy (VectorStoreChunkingStrategyRequest) – The chunking strategy used to chunk the file(s). If not set, will use the auto strategy. Default value is None.

  • content_type (str) – Body parameter content-type. Defaults to “application/json”.

  • sleep_interval (float) – Time to wait before polling for the status of the vector store. Default value is 1.

Returns:

VectorStoreFileBatch. The VectorStoreFileBatch is compatible with MutableMapping

Return type:

VectorStoreFileBatch

Raises:

HttpResponseError

delete_agent(assistant_id: str, **kwargs: Any) AgentDeletionStatus[source]

Deletes an agent.

Parameters:

assistant_id (str) – Identifier of the agent. Required.

Returns:

AgentDeletionStatus. The AgentDeletionStatus is compatible with MutableMapping

Return type:

AgentDeletionStatus

Raises:

HttpResponseError

delete_file(file_id: str, **kwargs: Any) FileDeletionStatus[source]

Delete a previously uploaded file.

Parameters:

file_id (str) – The ID of the file to delete. Required.

Returns:

FileDeletionStatus. The FileDeletionStatus is compatible with MutableMapping

Return type:

FileDeletionStatus

Raises:

HttpResponseError

delete_thread(thread_id: str, **kwargs: Any) ThreadDeletionStatus[source]

Deletes an existing thread.

Parameters:

thread_id (str) – Identifier of the thread. Required.

Returns:

ThreadDeletionStatus. The ThreadDeletionStatus is compatible with MutableMapping

Return type:

ThreadDeletionStatus

Raises:

HttpResponseError

delete_vector_store(vector_store_id: str, **kwargs: Any) VectorStoreDeletionStatus[source]

Deletes the vector store object matching the specified ID.

Parameters:

vector_store_id (str) – Identifier of the vector store. Required.

Returns:

VectorStoreDeletionStatus. The VectorStoreDeletionStatus is compatible with MutableMapping

Return type:

VectorStoreDeletionStatus

Raises:

HttpResponseError

delete_vector_store_file(vector_store_id: str, file_id: str, **kwargs: Any) VectorStoreFileDeletionStatus[source]

Delete a vector store file. This will remove the file from the vector store but the file itself will not be deleted. To delete the file, use the delete file endpoint.

Parameters:
  • vector_store_id (str) – Identifier of the vector store. Required.

  • file_id (str) – Identifier of the file. Required.

Returns:

VectorStoreFileDeletionStatus. The VectorStoreFileDeletionStatus is compatible with MutableMapping

Return type:

VectorStoreFileDeletionStatus

Raises:

HttpResponseError

get_agent(assistant_id: str, **kwargs: Any) Agent[source]

Retrieves an existing agent.

Parameters:

assistant_id (str) – Identifier of the agent. Required.

Returns:

Agent. The Agent is compatible with MutableMapping

Return type:

Agent

Raises:

HttpResponseError

get_file(file_id: str, **kwargs: Any) OpenAIFile[source]

Returns information about a specific file. Does not retrieve file content.

Parameters:

file_id (str) – The ID of the file to retrieve. Required.

Returns:

OpenAIFile. The OpenAIFile is compatible with MutableMapping

Return type:

OpenAIFile

Raises:

HttpResponseError

get_file_content(file_id: str, **kwargs: Any) Iterator[bytes][source]

Returns file content as byte stream for given file_id.

Parameters:

file_id (str) – The ID of the file to retrieve. Required.

Returns:

An iterator that yields bytes from the file content.

Return type:

Iterator[bytes]

Raises:

HttpResponseError – If the HTTP request fails.

get_message(thread_id: str, message_id: str, **kwargs: Any) ThreadMessage[source]

Gets an existing message from an existing thread.

Parameters:
  • thread_id (str) – Identifier of the thread. Required.

  • message_id (str) – Identifier of the message. Required.

Returns:

ThreadMessage. The ThreadMessage is compatible with MutableMapping

Return type:

ThreadMessage

Raises:

HttpResponseError

get_run(thread_id: str, run_id: str, **kwargs: Any) ThreadRun[source]

Gets an existing run from an existing thread.

Parameters:
  • thread_id (str) – Identifier of the thread. Required.

  • run_id (str) – Identifier of the run. Required.

Returns:

ThreadRun. The ThreadRun is compatible with MutableMapping

Return type:

ThreadRun

Raises:

HttpResponseError

get_run_step(thread_id: str, run_id: str, step_id: str, *, include: List[str | RunAdditionalFieldList] | None = None, **kwargs: Any) RunStep[source]

Gets a single run step from a thread run.

Parameters:
  • thread_id (str) – Identifier of the thread. Required.

  • run_id (str) – Identifier of the run. Required.

  • step_id (str) – Identifier of the run step. Required.

Keyword Arguments:

include (list[str or RunAdditionalFieldList]) – A list of additional fields to include in the response. Currently the only supported value is step_details.tool_calls[*].file_search.results[*].content to fetch the file search result content. Default value is None.

Returns:

RunStep. The RunStep is compatible with MutableMapping

Return type:

RunStep

Raises:

HttpResponseError

get_thread(thread_id: str, **kwargs: Any) AgentThread[source]

Gets information about an existing thread.

Parameters:

thread_id (str) – Identifier of the thread. Required.

Returns:

AgentThread. The AgentThread is compatible with MutableMapping

Return type:

AgentThread

Raises:

HttpResponseError

get_vector_store(vector_store_id: str, **kwargs: Any) VectorStore[source]

Returns the vector store object matching the specified ID.

Parameters:

vector_store_id (str) – Identifier of the vector store. Required.

Returns:

VectorStore. The VectorStore is compatible with MutableMapping

Return type:

VectorStore

Raises:

HttpResponseError

get_vector_store_file(vector_store_id: str, file_id: str, **kwargs: Any) VectorStoreFile[source]

Retrieves a vector store file.

Parameters:
  • vector_store_id (str) – Identifier of the vector store. Required.

  • file_id (str) – Identifier of the file. Required.

Returns:

VectorStoreFile. The VectorStoreFile is compatible with MutableMapping

Return type:

VectorStoreFile

Raises:

HttpResponseError

get_vector_store_file_batch(vector_store_id: str, batch_id: str, **kwargs: Any) VectorStoreFileBatch[source]

Retrieve a vector store file batch.

Parameters:
  • vector_store_id (str) – Identifier of the vector store. Required.

  • batch_id (str) – Identifier of the file batch. Required.

Returns:

VectorStoreFileBatch. The VectorStoreFileBatch is compatible with MutableMapping

Return type:

VectorStoreFileBatch

Raises:

HttpResponseError

list_agents(*, limit: int | None = None, order: str | ListSortOrder | None = None, after: str | None = None, before: str | None = None, **kwargs: Any) OpenAIPageableListOfAgent[source]

Gets a list of agents that were previously created.

Keyword Arguments:
  • limit (int) – A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. Default value is None.

  • order (str or ListSortOrder) – Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. Known values are: “asc” and “desc”. Default value is None.

  • after (str) – A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. Default value is None.

  • before (str) – A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. Default value is None.

Returns:

OpenAIPageableListOfAgent. The OpenAIPageableListOfAgent is compatible with MutableMapping

Return type:

OpenAIPageableListOfAgent

Raises:

HttpResponseError

list_files(*, purpose: str | FilePurpose | None = None, **kwargs: Any) FileListResponse[source]

Gets a list of previously uploaded files.

Keyword Arguments:

purpose (str or FilePurpose) – The purpose of the file. Known values are: “fine-tune”, “fine-tune-results”, “assistants”, “assistants_output”, “batch”, “batch_output”, and “vision”. Default value is None.

Returns:

FileListResponse. The FileListResponse is compatible with MutableMapping

Return type:

FileListResponse

Raises:

HttpResponseError

list_messages(thread_id: str, *, run_id: str | None = None, limit: int | None = None, order: str | ListSortOrder | None = None, after: str | None = None, before: str | None = None, **kwargs: Any) OpenAIPageableListOfThreadMessage[source]

Gets a list of messages that exist on a thread.

Parameters:

thread_id (str) – Identifier of the thread. Required.

Keyword Arguments:
  • run_id (str) – Filter messages by the run ID that generated them. Default value is None.

  • limit (int) – A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. Default value is None.

  • order (str or ListSortOrder) – Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. Known values are: “asc” and “desc”. Default value is None.

  • after (str) – A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. Default value is None.

  • before (str) – A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. Default value is None.

Returns:

OpenAIPageableListOfThreadMessage. The OpenAIPageableListOfThreadMessage is compatible with MutableMapping

Return type:

OpenAIPageableListOfThreadMessage

Raises:

HttpResponseError

list_run_steps(thread_id: str, run_id: str, *, include: List[str | RunAdditionalFieldList] | None = None, limit: int | None = None, order: str | ListSortOrder | None = None, after: str | None = None, before: str | None = None, **kwargs: Any) OpenAIPageableListOfRunStep[source]

Gets a list of run steps from a thread run.

Parameters:
  • thread_id (str) – Identifier of the thread. Required.

  • run_id (str) – Identifier of the run. Required.

Keyword Arguments:
  • include (list[str or RunAdditionalFieldList]) – A list of additional fields to include in the response. Currently the only supported value is step_details.tool_calls[*].file_search.results[*].content to fetch the file search result content. Default value is None.

  • limit (int) – A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. Default value is None.

  • order (str or ListSortOrder) – Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. Known values are: “asc” and “desc”. Default value is None.

  • after (str) – A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. Default value is None.

  • before (str) – A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. Default value is None.

Returns:

OpenAIPageableListOfRunStep. The OpenAIPageableListOfRunStep is compatible with MutableMapping

Return type:

OpenAIPageableListOfRunStep

Raises:

HttpResponseError

list_runs(thread_id: str, *, limit: int | None = None, order: str | ListSortOrder | None = None, after: str | None = None, before: str | None = None, **kwargs: Any) OpenAIPageableListOfThreadRun[source]

Gets a list of runs for a specified thread.

Parameters:

thread_id (str) – Identifier of the thread. Required.

Keyword Arguments:
  • limit (int) – A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. Default value is None.

  • order (str or ListSortOrder) – Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. Known values are: “asc” and “desc”. Default value is None.

  • after (str) – A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. Default value is None.

  • before (str) – A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. Default value is None.

Returns:

OpenAIPageableListOfThreadRun. The OpenAIPageableListOfThreadRun is compatible with MutableMapping

Return type:

OpenAIPageableListOfThreadRun

Raises:

HttpResponseError

list_vector_store_file_batch_files(vector_store_id: str, batch_id: str, *, filter: str | VectorStoreFileStatusFilter | None = None, limit: int | None = None, order: str | ListSortOrder | None = None, after: str | None = None, before: str | None = None, **kwargs: Any) OpenAIPageableListOfVectorStoreFile[source]

Returns a list of vector store files in a batch.

Parameters:
  • vector_store_id (str) – Identifier of the vector store. Required.

  • batch_id (str) – Identifier of the file batch. Required.

Keyword Arguments:
  • filter (str or VectorStoreFileStatusFilter) – Filter by file status. Known values are: “in_progress”, “completed”, “failed”, and “cancelled”. Default value is None.

  • limit (int) – A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. Default value is None.

  • order (str or ListSortOrder) – Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. Known values are: “asc” and “desc”. Default value is None.

  • after (str) – A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. Default value is None.

  • before (str) – A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. Default value is None.

Returns:

OpenAIPageableListOfVectorStoreFile. The OpenAIPageableListOfVectorStoreFile is compatible with MutableMapping

Return type:

OpenAIPageableListOfVectorStoreFile

Raises:

HttpResponseError

list_vector_store_files(vector_store_id: str, *, filter: str | VectorStoreFileStatusFilter | None = None, limit: int | None = None, order: str | ListSortOrder | None = None, after: str | None = None, before: str | None = None, **kwargs: Any) OpenAIPageableListOfVectorStoreFile[source]

Returns a list of vector store files.

Parameters:

vector_store_id (str) – Identifier of the vector store. Required.

Keyword Arguments:
  • filter (str or VectorStoreFileStatusFilter) – Filter by file status. Known values are: “in_progress”, “completed”, “failed”, and “cancelled”. Default value is None.

  • limit (int) – A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. Default value is None.

  • order (str or ListSortOrder) – Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. Known values are: “asc” and “desc”. Default value is None.

  • after (str) – A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. Default value is None.

  • before (str) – A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. Default value is None.

Returns:

OpenAIPageableListOfVectorStoreFile. The OpenAIPageableListOfVectorStoreFile is compatible with MutableMapping

Return type:

OpenAIPageableListOfVectorStoreFile

Raises:

HttpResponseError

list_vector_stores(*, limit: int | None = None, order: str | ListSortOrder | None = None, after: str | None = None, before: str | None = None, **kwargs: Any) OpenAIPageableListOfVectorStore[source]

Returns a list of vector stores.

Keyword Arguments:
  • limit (int) – A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. Default value is None.

  • order (str or ListSortOrder) – Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. Known values are: “asc” and “desc”. Default value is None.

  • after (str) – A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. Default value is None.

  • before (str) – A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. Default value is None.

Returns:

OpenAIPageableListOfVectorStore. The OpenAIPageableListOfVectorStore is compatible with MutableMapping

Return type:

OpenAIPageableListOfVectorStore

Raises:

HttpResponseError

modify_vector_store(vector_store_id: str, body: ~collections.abc.MutableMapping[str, ~typing.Any] | ~typing.IO[bytes] = <object object>, *, name: str | None = None, expires_after: ~azure.ai.projects.models._models.VectorStoreExpirationPolicy | None = None, metadata: ~typing.Dict[str, str] | None = None, **kwargs: ~typing.Any) VectorStore[source]

The ID of the vector store to modify.

Parameters:
  • vector_store_id (str) – Identifier of the vector store. Required.

  • body (JSON or IO[bytes]) – Is either a JSON type or a IO[bytes] type. Required.

Keyword Arguments:
  • name (str) – The name of the vector store. Default value is None.

  • expires_after (VectorStoreExpirationPolicy) – Details on when this vector store expires. Default value is None.

  • metadata (dict[str, str]) – A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. Default value is None.

Returns:

VectorStore. The VectorStore is compatible with MutableMapping

Return type:

VectorStore

Raises:

HttpResponseError

save_file(file_id: str, file_name: str, target_dir: str | Path | None = None) None[source]

Synchronously saves file content retrieved using a file identifier to the specified local directory.

Parameters:
  • file_id (str) – The unique identifier for the file to retrieve.

  • file_name (str) – The name of the file to be saved.

  • target_dir (Optional[Union[str, Path]]) – The directory where the file should be saved. Defaults to the current working directory.

Raises:
  • ValueError – If the target path is not a directory or the file name is invalid.

  • RuntimeError – If file content retrieval fails or no content is found.

  • TypeError – If retrieved chunks are not bytes-like objects.

  • IOError – If writing to the file fails.

submit_tool_outputs_to_run(thread_id: str, run_id: str, *, tool_outputs: List[_models.ToolOutput], content_type: str = 'application/json', event_handler: _models.AgentEventHandler | None = None, **kwargs: Any) _models.ThreadRun[source]
submit_tool_outputs_to_run(thread_id: str, run_id: str, body: JSON, *, content_type: str = 'application/json', **kwargs: Any) _models.ThreadRun
submit_tool_outputs_to_run(thread_id: str, run_id: str, body: IO[bytes], *, content_type: str = 'application/json', **kwargs: Any) _models.ThreadRun

Submits outputs from tools as requested by tool calls in a run. Runs that need submitted tool outputs will have a status of ‘requires_action’ with a required_action.type of ‘submit_tool_outputs’.

Parameters:
  • thread_id (str) – Required.

  • run_id (str) – Required.

  • body (JSON or IO[bytes]) – Is either a JSON type or a IO[bytes] type. Required.

Keyword Arguments:

tool_outputs (list[ToolOutput]) – Required.

Returns:

ThreadRun. The ThreadRun is compatible with MutableMapping

Return type:

ThreadRun

Raises:

HttpResponseError

submit_tool_outputs_to_stream(thread_id: str, run_id: str, body: JSON | IO[bytes], *, event_handler: _models.BaseAgentEventHandler, content_type: str = 'application/json', **kwargs: Any) None[source]
submit_tool_outputs_to_stream(thread_id: str, run_id: str, *, tool_outputs: List[_models.ToolOutput], content_type: str = 'application/json', event_handler: _models.BaseAgentEventHandler, **kwargs: Any) None

Submits outputs from tools as requested by tool calls in a stream. Runs that need submitted tool outputs will have a status of ‘requires_action’ with a required_action.type of ‘submit_tool_outputs’. terminating when the Run enters a terminal state with a data: [DONE] message.

Parameters:
  • thread_id (str) – Required.

  • run_id (str) – Required.

  • body (JSON or IO[bytes]) – Is either a JSON type or a IO[bytes] type. Required.

Keyword Arguments:
Raises:

HttpResponseError

update_agent(assistant_id: str, *, content_type: str = 'application/json', model: str | None = None, name: str | None = None, description: str | None = None, instructions: str | None = None, tools: List[_models.ToolDefinition] | None = None, tool_resources: _models.ToolResources | None = None, temperature: float | None = None, top_p: float | None = None, response_format: '_types.AgentsApiResponseFormatOption' | None = None, metadata: Dict[str, str] | None = None, **kwargs: Any) _models.Agent[source]
update_agent(assistant_id: str, *, content_type: str = 'application/json', model: str | None = None, name: str | None = None, description: str | None = None, instructions: str | None = None, toolset: _models.ToolSet | None = None, temperature: float | None = None, top_p: float | None = None, response_format: '_types.AgentsApiResponseFormatOption' | None = None, metadata: Dict[str, str] | None = None, **kwargs: Any) _models.Agent
update_agent(assistant_id: str, body: JSON, *, content_type: str = 'application/json', **kwargs: Any) _models.Agent
update_agent(assistant_id: str, body: IO[bytes], *, content_type: str = 'application/json', **kwargs: Any) _models.Agent

Modifies an existing agent.

Parameters:
  • assistant_id (str) – The ID of the agent to modify. Required.

  • body (JSON or IO[bytes]) – Is either a JSON type or a IO[bytes] type. Required.

Keyword Arguments:
  • model (str) – The ID of the model to use. Default value is None.

  • name (str) – The modified name for the agent to use. Default value is None.

  • description (str) – The modified description for the agent to use. Default value is None.

  • instructions (str) – The modified system instructions for the new agent to use. Default value is None.

  • tools (list[ToolDefinition]) – The modified collection of tools to enable for the agent. Default value is None.

  • tool_resources (ToolResources) – A set of resources that are used by the agent’s tools. The resources are specific to the type of tool. For example, the code_interpreter tool requires a list of file IDs, while the file_search tool requires a list of vector store IDs. Default value is None.

  • toolset (ToolSet) – The Collection of tools and resources (alternative to tools and tool_resources and adds automatic execution logic for functions). Default value is None.

  • temperature (float) – What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. Default value is None.

  • top_p (float) –

    An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.

    We generally recommend altering this or temperature but not both. Default value is None.

  • response_format (str or str or AgentsApiResponseFormatMode or AgentsApiResponseFormat) – The response format of the tool calls used by this agent. Is one of the following types: str, Union[str, “_models.AgentsApiResponseFormatMode”], AgentsApiResponseFormat Default value is None.

  • content_type (str) – Body Parameter content-type. Content type parameter for JSON body. Default value is “application/json”.

  • metadata (dict[str, str]) – A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. Default value is None.

Returns:

Agent. The Agent is compatible with MutableMapping

Return type:

Agent

Raises:

HttpResponseError

update_message(thread_id: str, message_id: str, body: ~collections.abc.MutableMapping[str, ~typing.Any] | ~typing.IO[bytes] = <object object>, *, metadata: ~typing.Dict[str, str] | None = None, **kwargs: ~typing.Any) ThreadMessage[source]

Modifies an existing message on an existing thread.

Parameters:
  • thread_id (str) – Identifier of the thread. Required.

  • message_id (str) – Identifier of the message. Required.

  • body (JSON or IO[bytes]) – Is either a JSON type or a IO[bytes] type. Required.

Keyword Arguments:

metadata (dict[str, str]) – A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. Default value is None.

Returns:

ThreadMessage. The ThreadMessage is compatible with MutableMapping

Return type:

ThreadMessage

Raises:

HttpResponseError

update_run(thread_id: str, run_id: str, body: ~collections.abc.MutableMapping[str, ~typing.Any] | ~typing.IO[bytes] = <object object>, *, metadata: ~typing.Dict[str, str] | None = None, **kwargs: ~typing.Any) ThreadRun[source]

Modifies an existing thread run.

Parameters:
  • thread_id (str) – Identifier of the thread. Required.

  • run_id (str) – Identifier of the run. Required.

  • body (JSON or IO[bytes]) – Is either a JSON type or a IO[bytes] type. Required.

Keyword Arguments:

metadata (dict[str, str]) – A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. Default value is None.

Returns:

ThreadRun. The ThreadRun is compatible with MutableMapping

Return type:

ThreadRun

Raises:

HttpResponseError

update_thread(thread_id: str, body: ~collections.abc.MutableMapping[str, ~typing.Any] | ~typing.IO[bytes] = <object object>, *, tool_resources: ~azure.ai.projects.models._models.ToolResources | None = None, metadata: ~typing.Dict[str, str] | None = None, **kwargs: ~typing.Any) AgentThread[source]

Modifies an existing thread.

Parameters:
  • thread_id (str) – The ID of the thread to modify. Required.

  • body (JSON or IO[bytes]) – Is either a JSON type or a IO[bytes] type. Required.

Keyword Arguments:
  • tool_resources (ToolResources) – A set of resources that are made available to the agent’s tools in this thread. The resources are specific to the type of tool. For example, the code_interpreter tool requires a list of file IDs, while the file_search tool requires a list of vector store IDs. Default value is None.

  • metadata (dict[str, str]) – A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. Default value is None.

Returns:

AgentThread. The AgentThread is compatible with MutableMapping

Return type:

AgentThread

Raises:

HttpResponseError

upload_file(*, file_path: str, purpose: str | _models.FilePurpose, **kwargs: Any) _models.OpenAIFile[source]
upload_file(*, file: FileType, purpose: str | _models.FilePurpose, filename: str | None = None, **kwargs: Any) _models.OpenAIFile
upload_file(body: JSON, **kwargs: Any) _models.OpenAIFile

Uploads a file for use by other operations, delegating to the generated operations.

Parameters:

body (Optional[JSON]) – JSON. Required if file and purpose are not provided.

Keyword Arguments:
  • file (Optional[FileType]) – File content. Required if body and purpose are not provided.

  • file_path (Optional[str]) – Path to the file. Required if body and purpose are not provided.

  • purpose (Union[str, _models.FilePurpose, None] “assistants_output”, “batch”, “batch_output”, and “vision”. Required if body and file are not provided.) – Known values are: “fine-tune”, “fine-tune-results”, “assistants”,

  • filename (Optional[str]) – The name of the file.

Returns:

OpenAIFile. The OpenAIFile is compatible with MutableMapping

Return type:

_models.OpenAIFile

Raises:
Raises:

HttpResponseError for HTTP errors.

upload_file_and_poll(body: JSON, *, sleep_interval: float = 1, **kwargs: Any) _models.OpenAIFile[source]
upload_file_and_poll(*, file: FileType, purpose: str | _models.FilePurpose, filename: str | None = None, sleep_interval: float = 1, **kwargs: Any) _models.OpenAIFile
upload_file_and_poll(*, file_path: str, purpose: str | _models.FilePurpose, sleep_interval: float = 1, **kwargs: Any) _models.OpenAIFile

Uploads a file for use by other operations, delegating to the generated operations.

Parameters:

body (Optional[JSON]) – JSON. Required if file and purpose are not provided.

Keyword Arguments:
  • file (Optional[FileType]) – File content. Required if body and purpose are not provided.

  • file_path (Optional[str]) – Path to the file. Required if body and purpose are not provided.

  • purpose (Union[str, _models.FilePurpose, None]) – Known values are: “fine-tune”, “fine-tune-results”, “assistants”, “assistants_output”, “batch”, “batch_output”, and “vision”. Required if body and file are not provided.

  • filename (Optional[str]) – The name of the file.

  • sleep_interval (float) – Time to wait before polling for the status of the uploaded file. Default value is 1.

Returns:

OpenAIFile. The OpenAIFile is compatible with MutableMapping

Return type:

_models.OpenAIFile

Raises:
Raises:

HttpResponseError for HTTP errors.

class azure.ai.projects.operations.ConnectionsOperations(*args, **kwargs)[source]
get(*, connection_name: str, include_credentials: bool = False, **kwargs: Any) ConnectionProperties[source]

Get the properties of a single connection, given its connection name, with or without populating authentication credentials. Raises ~azure.core.exceptions.ResourceNotFoundError exception if a connection with the given name was not found.

Note

This method is not supported for Azure Blob Storage connections.

Keyword Arguments:
  • connection_name – Connection Name. Required.

  • include_credentials – Whether to populate the connection properties with authentication credentials. Optional.

Returns:

The connection properties, or None if a connection with this name does not exist.

Return type:

ConnectionProperties

Raises:
get_default(*, connection_type: ConnectionType, include_credentials: bool = False, **kwargs: Any) ConnectionProperties[source]

Get the properties of the default connection of a certain connection type, with or without populating authentication credentials. Raises ~azure.core.exceptions.ResourceNotFoundError exception if there are no connections of the given type.

Note

get_default(connection_type=ConnectionType.AZURE_BLOB_STORAGE, include_credentials=True) does not currently work. It does work with include_credentials=False.

Keyword Arguments:
  • connection_type – The connection type. Required.

  • include_credentials – Whether to populate the connection properties with authentication credentials. Optional.

Returns:

The connection properties.

Return type:

ConnectionProperties

Raises:
list(*, connection_type: ConnectionType | None = None, **kwargs: Any) Sequence[ConnectionProperties][source]

List the properties of all connections, or all connections of a certain connection type.

Keyword Arguments:

connection_type – The connection type. Optional. If provided, this method lists connections of this type. If not provided, all connections are listed.

Returns:

A list of connection properties

Return type:

Sequence[ConnectionProperties]

Raises:

HttpResponseError

class azure.ai.projects.operations.EvaluationsOperations(*args, **kwargs)[source]

Warning

DO NOT instantiate this class directly.

Instead, you should access the following operations through AIProjectClient’s evaluations attribute.

create(evaluation: _models.Evaluation, *, content_type: str = 'application/json', **kwargs: Any) _models.Evaluation[source]
create(evaluation: JSON, *, content_type: str = 'application/json', **kwargs: Any) _models.Evaluation
create(evaluation: IO[bytes], *, content_type: str = 'application/json', **kwargs: Any) _models.Evaluation

Run the evaluation.

Parameters:

evaluation (Evaluation or JSON or IO[bytes]) – Evaluation to run. Is one of the following types: Evaluation, JSON, IO[bytes] Required.

Returns:

Evaluation. The Evaluation is compatible with MutableMapping

Return type:

Evaluation

Raises:

HttpResponseError

create_or_replace_schedule(name: str, resource: _models.EvaluationSchedule, *, content_type: str = 'application/json', **kwargs: Any) _models.EvaluationSchedule[source]
create_or_replace_schedule(name: str, resource: JSON, *, content_type: str = 'application/json', **kwargs: Any) _models.EvaluationSchedule
create_or_replace_schedule(name: str, resource: IO[bytes], *, content_type: str = 'application/json', **kwargs: Any) _models.EvaluationSchedule

Create or replace operation template.

Parameters:
  • name (str) – Name of the schedule, which also serves as the unique identifier for the evaluation. Required.

  • resource (EvaluationSchedule or JSON or IO[bytes]) – The resource instance. Is one of the following types: EvaluationSchedule, JSON, IO[bytes] Required.

Returns:

EvaluationSchedule. The EvaluationSchedule is compatible with MutableMapping

Return type:

EvaluationSchedule

Raises:

HttpResponseError

disable_schedule(name: str, **kwargs: Any) None[source]

Disable the evaluation schedule.

Parameters:

name (str) – Name of the evaluation schedule. Required.

Returns:

None

Return type:

None

Raises:

HttpResponseError

get(id: str, **kwargs: Any) Evaluation[source]

Resource read operation template.

Parameters:

id (str) – Identifier of the evaluation. Required.

Returns:

Evaluation. The Evaluation is compatible with MutableMapping

Return type:

Evaluation

Raises:

HttpResponseError

get_schedule(name: str, **kwargs: Any) EvaluationSchedule[source]

Resource read operation template.

Parameters:

name (str) – Name of the schedule, which also serves as the unique identifier for the evaluation. Required.

Returns:

EvaluationSchedule. The EvaluationSchedule is compatible with MutableMapping

Return type:

EvaluationSchedule

Raises:

HttpResponseError

list(*, top: int | None = None, skip: int | None = None, **kwargs: Any) Iterable[Evaluation][source]

Resource list operation template.

Keyword Arguments:
  • top (int) – The number of result items to return. Default value is None.

  • skip (int) – The number of result items to skip. Default value is None.

Returns:

An iterator like instance of Evaluation

Return type:

ItemPaged[Evaluation]

Raises:

HttpResponseError

list_schedule(*, top: int | None = None, skip: int | None = None, **kwargs: Any) Iterable[EvaluationSchedule][source]

Resource list operation template.

Keyword Arguments:
  • top (int) – The number of result items to return. Default value is None.

  • skip (int) – The number of result items to skip. Default value is None.

Returns:

An iterator like instance of EvaluationSchedule

Return type:

ItemPaged[EvaluationSchedule]

Raises:

HttpResponseError

update(id: str, resource: _models.Evaluation, *, content_type: str = 'application/merge-patch+json', **kwargs: Any) _models.Evaluation[source]
update(id: str, resource: JSON, *, content_type: str = 'application/merge-patch+json', **kwargs: Any) _models.Evaluation
update(id: str, resource: IO[bytes], *, content_type: str = 'application/merge-patch+json', **kwargs: Any) _models.Evaluation

Resource update operation template.

Parameters:
  • id (str) – Identifier of the evaluation. Required.

  • resource (Evaluation or JSON or IO[bytes]) – The resource instance. Is one of the following types: Evaluation, JSON, IO[bytes] Required.

Returns:

Evaluation. The Evaluation is compatible with MutableMapping

Return type:

Evaluation

Raises:

HttpResponseError

class azure.ai.projects.operations.InferenceOperations(outer_instance)[source]
get_azure_openai_client(*, api_version: str | None = None, connection_name: str | None = None, **kwargs) AzureOpenAI[source]

Get an authenticated AzureOpenAI client (from the openai package) for the default Azure OpenAI connection (if connection_name is not specificed), or from the Azure OpenAI resource given by its connection name.

Note

The package openai must be installed prior to calling this method.

Keyword Arguments:
  • api_version (str) – The Azure OpenAI api-version to use when creating the client. Optional. See “Data plane - Inference” row in the table at https://learn.microsoft.com/azure/ai-services/openai/reference#api-specs. If this keyword is not specified, you must set the environment variable OPENAI_API_VERSION instead.

  • connection_name – The name of a connection to an Azure OpenAI resource in your AI Foundry project. resource. Optional. If not provided, the default Azure OpenAI connection will be used.

Returns:

An authenticated AzureOpenAI client

Return type:

AzureOpenAI

Raises:
get_chat_completions_client(*, connection_name: str | None = None, **kwargs) ChatCompletionsClient[source]

Get an authenticated ChatCompletionsClient (from the package azure-ai-inference) for the default Azure AI Services connected resource (if connection_name is not specificed), or from the Azure AI Services resource given by its connection name. Keyword arguments are passed to the constructor of ChatCompletionsClient.

At least one AI model that supports chat completions must be deployed in this resource.

Note

The package azure-ai-inference must be installed prior to calling this method.

Keyword Arguments:

connection_name – The name of a connection to an Azure AI Services resource in your AI Foundry project. resource. Optional. If not provided, the default Azure AI Services connection will be used.

Returns:

An authenticated chat completions client.

Return type:

ChatCompletionsClient

Raises:
get_embeddings_client(*, connection_name: str | None = None, **kwargs) EmbeddingsClient[source]

Get an authenticated EmbeddingsClient (from the package azure-ai-inference) for the default Azure AI Services connected resource (if connection_name is not specificed), or from the Azure AI Services resource given by its connection name. Keyword arguments are passed to the constructor of EmbeddingsClient.

At least one AI model that supports text embeddings must be deployed in this resource.

Note

The package azure-ai-inference must be installed prior to calling this method.

Keyword Arguments:

connection_name – The name of a connection to an Azure AI Services resource in your AI Foundry project. resource. Optional. If not provided, the default Azure AI Services connection will be used.

Returns:

An authenticated text embeddings client

Return type:

EmbeddingsClient

Raises:
get_image_embeddings_client(*, connection_name: str | None = None, **kwargs) ImageEmbeddingsClient[source]

Get an authenticated ImageEmbeddingsClient (from the package azure-ai-inference) for the default Azure AI Services connected resource (if connection_name is not specificed), or from the Azure AI Services resource given by its connection name. Keyword arguments are passed to the constructor of ImageEmbeddingsClient.

At least one AI model that supports image embeddings must be deployed in this resource.

Note

The package azure-ai-inference must be installed prior to calling this method.

Keyword Arguments:

connection_name – The name of a connection to an Azure AI Services resource in your AI Foundry project. resource. Optional. If not provided, the default Azure AI Services connection will be used.

Returns:

An authenticated image embeddings client

Return type:

ImageEmbeddingsClient

Raises:
class azure.ai.projects.operations.TelemetryOperations(*args, **kwargs)[source]
enable(*, destination: TextIO | str | None = None, **kwargs) None[source]

Enables telemetry collection with OpenTelemetry for Azure AI clients and popular GenAI libraries.

Following instrumentations are enabled (when corresponding packages are installed):

  • Azure AI Inference (azure-ai-inference)

  • Azure AI Projects (azure-ai-projects)

  • OpenAI (opentelemetry-instrumentation-openai-v2)

  • Langchain (opentelemetry-instrumentation-langchain)

The recording of prompt and completion messages is disabled by default. To enable it, set the AZURE_TRACING_GEN_AI_CONTENT_RECORDING_ENABLED environment variable to true.

When destination is provided, the method configures OpenTelemetry SDK to export traces to stdout or OTLP (OpenTelemetry protocol) gRPC endpoint. It’s recommended for local development only. For production use, make sure to configure OpenTelemetry SDK directly.

Keyword Arguments:

destination (Union[TextIO, str, None]) – Recommended for local testing only. Set it to sys.stdout for tracing to console output, or a string holding the OpenTelemetry protocol (OTLP) endpoint such as “http://localhost:4317. If not provided, the method enables instrumentations, but does not configure OpenTelemetry SDK to export traces.

get_connection_string() str[source]

Get the Application Insights connection string associated with the Project’s Application Insights resource.

Returns:

The Application Insights connection string if a the resource was enabled for the Project.

Return type:

str

Raises:

ResourceNotFoundError – An Application Insights resource was not enabled for this project.