title | description | ms.topic | ms.custom | ms.collection | ms.date | zone_pivot_groups | ||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Azure OpenAI assistant create output binding for Azure Functions | Learn how to use the Azure OpenAI assistant create output binding to create Azure OpenAI assistants from your function code executions. | reference |
|
| 01/07/2025 | programming-languages-set-functions |
[!INCLUDE preview-support]
The Azure OpenAI assistant create output binding allows you to create a new assistant chat bot from your function code execution.
For information on setup and configuration details of the Azure OpenAI extension, see Azure OpenAI extensions for Azure Functions. To learn more about Azure OpenAI assistants, see Azure OpenAI Assistants API.
[!INCLUDE functions-support-notes-samples-openai]
::: zone pivot="programming-language-csharp"
This example demonstrates the creation process, where the HTTP PUT function that creates a new assistant chat bot with the specified ID. The response to the prompt is returned in the HTTP response.
:::code language="csharp" source="~/functions-openai-extension/samples/assistant/csharp-ooproc/AssistantApis.cs" range="20-45":::
::: zone-end
::: zone pivot="programming-language-java" This example demonstrates the creation process, where the HTTP PUT function that creates a new assistant chat bot with the specified ID. The response to the prompt is returned in the HTTP response.
:::code language="java" source="~/functions-openai-extension/samples/assistant/java/src/main/java/com/azfs/AssistantApis.java" range="33-58":::
::: zone-end
::: zone pivot="programming-language-javascript,programming-language-typescript"
This example demonstrates the creation process, where the HTTP PUT function that creates a new assistant chat bot with the specified ID. The response to the prompt is returned in the HTTP response.
::: zone-end
::: zone pivot="programming-language-javascript"
:::code language="javascript" source="~/functions-openai-extension/samples/assistant/javascript/src/functions/assistantApis.js" range="6-33" :::
::: zone-end ::: zone pivot="programming-language-typescript"
:::code language="typescript" source="~/functions-openai-extension/samples/assistant/typescript/src/functions/assistantApis.ts" range="4-33" :::
::: zone-end
::: zone pivot="programming-language-powershell"
This example demonstrates the creation process, where the HTTP PUT function that creates a new assistant chat bot with the specified ID. The response to the prompt is returned in the HTTP response.
Here's the function.json file for Create Assistant:
:::code language="json" source="~/functions-openai-extension/samples/assistant/powershell/CreateAssistant/function.json" :::
For more information about function.json file properties, see the Configuration section.
{{This comes from the example code comment}} :::code language="powershell" source="~/functions-openai-extension/samples/assistant/powershell/CreateAssistant/run.ps1" :::
::: zone-end
::: zone pivot="programming-language-python"
This example demonstrates the creation process, where the HTTP PUT function that creates a new assistant chat bot with the specified ID. The response to the prompt is returned in the HTTP response.
:::code language="python" source="~/functions-openai-extension/samples/assistant/python/assistant_apis.py" range="7-22" :::
::: zone-end
::: zone pivot="programming-language-csharp"
Apply the CreateAssistant
attribute to define an assistant create output binding, which supports these parameters:
Parameter | Description |
---|---|
Id | The identifier of the assistant to create. |
Instructions | Optional. The instructions that are provided to assistant to follow. |
::: zone-end ::: zone pivot="programming-language-java"
The CreateAssistant
annotation enables you to define an assistant create output binding, which supports these parameters:
Element | Description |
---|---|
name | Gets or sets the name of the output binding. |
id | The identifier of the assistant to create. |
instructions | Optional. The instructions that are provided to assistant to follow. |
::: zone-end
::: zone pivot="programming-language-python"
During the preview, define the output binding as a generic_output_binding
binding of type createAssistant
, which supports these parameters:
Parameter | Description |
---|---|
arg_name | The name of the variable that represents the binding parameter. |
id | The identifier of the assistant to create. |
instructions | Optional. The instructions that are provided to assistant to follow. |
::: zone-end ::: zone pivot="programming-language-powershell"
The binding supports these configuration properties that you set in the function.json file.
Property | Description |
---|---|
type | Must be CreateAssistant . |
direction | Must be out . |
name | The name of the output binding. |
id | The identifier of the assistant to create. |
instructions | Optional. The instructions that are provided to assistant to follow. |
::: zone-end
::: zone pivot="programming-language-javascript,programming-language-typescript"
The binding supports these properties, which are defined in your code:
Property | Description |
---|---|
id | The identifier of the assistant to create. |
instructions | Optional. The instructions that are provided to assistant to follow. |
::: zone-end |
See the Example section for complete examples.