BindingApi Class

Interface to extend for using existing binding decorator functions.

Constructor

BindingApi(*args, **kwargs)

Methods

assistant_create_output

The assistantCreate output binding creates a new assistant with a specified system prompt.

parameter value :param kwargs: Keyword arguments for specifying additional binding fields to include in the binding json

assistant_post_input

The assistantPost output binding sends a message to the assistant and saves the response in its internal state.

assistant to respond to. :param model: The OpenAI chat model to use. :param data_type: Defines how Functions runtime should treat the parameter value :param kwargs: Keyword arguments for specifying additional binding fields to include in the binding json

assistant_query_input

The assistantQuery input binding fetches the assistant history and passes it to the function.

history to fetch. The timestamp should be in ISO 8601 format - for example, 2023-08-01T00:00:00Z. :param id: The ID of the Assistant to query. :param data_type: Defines how Functions runtime should treat the parameter value :param kwargs: Keyword arguments for specifying additional binding fields to include in the binding json

blob_input

The blob_input decorator adds <xref:azure.functions.BlobInput> to the <xref:azure.functions.FunctionBuilder> object for building Function object used in worker function indexing model. This is equivalent to defining BlobInput in the function.json which enables function to write message(s) to the storage blobs. All optional fields will be given default value by function host when they are parsed by function host.

Ref: https://aka.ms/azure-function-binding-storage-blob

that specifies how to connect to Azure Blobs. :param data_type: Defines how Functions runtime should treat the

parameter value.

fields to include in the binding json.

blob_output

The blob_output decorator adds <xref:azure.functions.BlobOutput> to the <xref:azure.functions.FunctionBuilder> object for building Function object used in worker function indexing model. This is equivalent to defining BlobOutput in the function.json which enables function to write message(s) to the storage blobs. All optional fields will be given default value by function host when they are parsed by function host.

Ref: https://aka.ms/azure-function-binding-storage-blob

fields to include in the binding json. :return: Decorator function.

cosmos_db_input

The cosmos_db_input decorator adds <xref:azure.functions.CosmosDBInput> to the <xref:azure.functions.FunctionBuilder> object for building Function object used in worker function indexing model. This decorator will work only with extension bundle 4.x and above. For additional details, please refer https://aka.ms/cosmosdb-v4-update. This is equivalent to defining CosmosDBInput in the function.json which

enables function to read from CosmosDB.

All optional fields will be given default value by function host when they are parsed by function host.

Ref: https://aka.ms/azure-function-binding-cosmosdb-v4

DocumentList input object in function code :param connection: The name of an app setting or setting container that

specifies how to connect to the Azure Cosmos DB account being monitored containing your Azure Cosmos DB connection string

document :param partition_key: Specifies the partition key value for the lookup :param id: The ID of the document to retrieve :param sql_query: An Azure Cosmos DB SQL query used for retrieving multiple documents :param preferred_locations: (Optional) Defines preferred locations (regions) for geo-replicated database accounts in the Azure Cosmos DB service. Values should be comma-separated. For example, East US,South Central US,North Europe :param data_type: Defines how Functions runtime should treat the parameter value :param kwargs: Keyword arguments for specifying additional binding fields to include in the binding json

cosmos_db_input_v3

The cosmos_db_input_v3 decorator adds <xref:azure.functions.CosmosDBInput> to the <xref:azure.functions.FunctionBuilder> object for building Function object used in worker function indexing model. This decorator will work only with extension bundle 2.x or 3.x. For additional details, please refer https://aka.ms/cosmosdb-v4-update. This is equivalent to defining CosmosDBInput in the function.json which enables function to read from CosmosDB. All optional fields will be given default value by function host when they are parsed by function host.

Ref: https://aka.ms/azure-function-binding-cosmosdb-v2

DocumentList input object in function code. :param database_name: The database containing the document. :param collection_name: The name of the collection that contains the document. :param connection_string_setting: The name of the app setting containing your Azure Cosmos DB connection string. :param id: The ID of the document to retrieve. :param sql_query: An Azure Cosmos DB SQL query used for retrieving multiple documents. :param partition_key: Specifies the partition key value for the lookup. :param data_type: Defines how Functions runtime should treat the parameter value. :param kwargs: Keyword arguments for specifying additional binding fields to include in the binding json.

cosmos_db_output

The cosmos_db_output decorator adds <xref:azure.functions.CosmosDBOutput> to the <xref:azure.functions.FunctionBuilder> object for building Function object used in worker function indexing model. This decorator will work only with extension bundle 4.x and above. For additional details, please refer https://aka.ms/cosmosdb-v4-update. This is equivalent to defining CosmosDBOutput in the function.json which enables function to write to the CosmosDB. All optional fields will be given default value by function host when they are parsed by function host.

Ref: https://aka.ms/azure-function-binding-cosmosdb-v4

output object in function code. :param connection: The name of an app setting or setting collection that specifies how to connect to the Azure Cosmos DB account being monitored :param database_name: The name of the Azure Cosmos DB database with the collection being monitored :param container_name: The name of the container being monitored :param create_if_not_exists: A boolean value to indicate whether the collection is created when it doesn't exist :param partition_key: When CreateIfNotExists is true, it defines the partition key path for the created collection :param container_throughput: When createIfNotExists is true, it defines the throughput of the created container PreferredLocations, it can leverage multi-region writes in the Azure Cosmos DB service :param preferred_locations: Defines preferred locations (regions) for geo-replicated database accounts in the Azure Cosmos DB service :param data_type: Defines how Functions runtime should treat the parameter value :param kwargs: Keyword arguments for specifying additional binding fields to include in the binding json

cosmos_db_output_v3

The cosmos_db_output_v3 decorator adds <xref:azure.functions.CosmosDBOutput> to the <xref:azure.functions.FunctionBuilder> object for building Function object used in worker function indexing model. This decorator will work only with extension bundle 2.x or 3.x. For additional details, please refer https://aka.ms/cosmosdb-v4-update.

This is equivalent to defining CosmosDBOutput

in the function.json which enables function to write to the CosmosDB. All optional fields will be given default value by function host when they are parsed by function host.

Ref: https://aka.ms/azure-function-binding-cosmosdb-v2

output object in function code. :param database_name: The name of the Azure Cosmos DB database with the collection being monitored. :param collection_name: The name of the collection being monitored. :param connection_string_setting: The name of an app setting or setting collection that specifies how to connect to the Azure Cosmos DB account being monitored. :param create_if_not_exists: A boolean value to indicate whether the collection is created when it doesn't exist. :param partition_key: When CreateIfNotExists is true, it defines the partition key path for the created collection. :param collection_throughput: When CreateIfNotExists is true, it defines the throughput of the created collection. :param use_multiple_write_locations: When set to true along with PreferredLocations, it can leverage multi-region writes in the Azure Cosmos DB service. :param preferred_locations: Defines preferred locations (regions) for geo-replicated database accounts in the Azure Cosmos DB service. :param data_type: Defines how Functions runtime should treat the parameter value. :param kwargs: Keyword arguments for specifying additional binding fields to include in the binding json.

dapr_binding_output

The dapr_binding_output decorator adds <xref:azure.functions.DaprBindingOutput> to the <xref:azure.functions.FunctionBuilder> object for building Function object used in worker function indexing model. This is equivalent to defining DaprBindingOutput in the function.json which enables function to send a value to a Dapr output binding. All optional fields will be given default value by function host when they are parsed by function host.

Ref: https://aka.ms/azure-function-dapr-binding-output-binding

output object in function code. :param binding_name: The configured name of the binding. :param operation: The configured operation. :param dapr_address: Dapr address, it is optional field, by default it will be set to http://localhost:{daprHttpPort}. :param data_type: Defines how Functions runtime should treat the parameter value :param kwargs: Keyword arguments for specifying additional binding fields to include in the binding json

dapr_invoke_output

The dapr_invoke_output decorator adds <xref:azure.functions.DaprInvokeOutput> to the <xref:azure.functions.FunctionBuilder> object for building Function object used in worker function indexing model. This is equivalent to defining DaprInvokeOutput in the function.json which enables function to invoke another Dapr App. All optional fields will be given default value by function host when they are parsed by function host.

Ref: https://aka.ms/azure-function-dapr-invoke-output-binding

output object in function code. :param app_id: The dapr app name to invoke. :param method_name: The method name of the app to invoke. :param http_verb: The http verb of the app to invoke. :param dapr_address: Dapr address, it is optional field, by default it will be set to http://localhost:{daprHttpPort}. :param data_type: Defines how Functions runtime should treat the parameter value :param kwargs: Keyword arguments for specifying additional binding fields to include in the binding json

dapr_publish_output

The dapr_publish_output decorator adds <xref:azure.functions.DaprPublishOutput> to the <xref:azure.functions.FunctionBuilder> object for building Function object used in worker function indexing model. This is equivalent to defining DaprPublishOutput in the function.json which enables function to publish topic. All optional fields will be given default value by function host when they are parsed by function host.

Ref: https://aka.ms/azure-function-dapr-publish-output-binding

output object in function code. :param pub_sub_name: The pub/sub name to publish to. :param topic: The name of the topic to publish to. :param dapr_address: Dapr address, it is optional field, by default ßit will be set to http://localhost:{daprHttpPort}. :param data_type: Defines how Functions runtime should treat the parameter value :param kwargs: Keyword arguments for specifying additional binding fields to include in the binding json

dapr_secret_input

The dapr_secret_input decorator adds <xref:azure.functions.DaprSecretInput> to the <xref:azure.functions.FunctionBuilder> object for building Function object used in worker function indexing model. This is equivalent to defining DaprSecretInput in the function.json which enables function to read secret from underlying secret store component. All optional fields will be given default value by function host when they are parsed by function host.

Ref: https://aka.ms/azure-function-dapr-secret-input-binding

input object in function code. :param secret_store_name: The name of the secret store to get the secret from. :param key: The key identifying the name of the secret to get. :param metadata: An array of metadata properties in the form "key1=value1&key2=value2". :param dapr_address: Dapr address, it is optional field, by default it will be set to http://localhost:{daprHttpPort}. :param data_type: Defines how Functions runtime should treat the parameter value. :param kwargs: Keyword arguments for specifying additional binding fields to include in the binding json.

dapr_state_input

The dapr_state_input decorator adds <xref:azure.functions.DaprStateInput> to the <xref:azure.functions.FunctionBuilder> object for building Function object used in worker function indexing model. This is equivalent to defining DaprStateInput in the function.json which enables function to read state from underlying state store component. All optional fields will be given default value by function host when they are parsed by function host.

Ref: https://aka.ms/azure-function-dapr-state-input-binding

input object in function code. :param state_store: State store containing the state. :param key: The name of the key. :param dapr_address: Dapr address, it is optional field, by default it will be set to http://localhost:{daprHttpPort}. :param data_type: Defines how Functions runtime should treat the parameter value. :param kwargs: Keyword arguments for specifying additional binding fields to include in the binding json.

dapr_state_output

The dapr_state_output decorator adds <xref:azure.functions.DaprStateOutput> to the <xref:azure.functions.FunctionBuilder> object for building Function object used in worker function indexing model. This is equivalent to defining DaprStateOutput in the function.json which enables function to write to the dapr state store. All optional fields will be given default value by function host when they are parsed by function host.

Ref: https://aka.ms/azure-function-dapr-state-output-binding

output object in function code. :param state_store: State store containing the state for keys. :param key: The name of the key. :param dapr_address: Dapr address, it is optional field, by default it will be set to http://localhost:{daprHttpPort}. :param data_type: Defines how Functions runtime should treat the parameter value :param kwargs: Keyword arguments for specifying additional binding fields to include in the binding json

durable_client_input

Register a Durable-client Function.

embeddings_input

The embeddings input decorator creates embeddings which will be used to measure the relatedness of text strings.

Ref: https://platform.openai.com/docs/guides/embeddings

embeddings for. :param input_type: The type of the input. :param model: The ID of the model to use. :param max_chunk_length: The maximum number of characters to chunk the input into. Default value: 8 * 1024 :param max_overlap: The maximum number of characters to overlap between chunks. Default value: 128 :param data_type: Defines how Functions runtime should treat the parameter value :param kwargs: Keyword arguments for specifying additional binding fields to include in the binding json

embeddings_store_output

Supported list of embeddings store is extensible, and more can be added by authoring a specially crafted NuGet package. Visit the currently supported vector specific folder for specific usage information:

  • Azure AI Search

  • Azure Data Explorer

  • Azure Cosmos DB using MongoDB

variable which contains a connection string value :param collection: The collection or table to search. :param model: The ID of the model to use. :param max_chunk_length: The maximum number of characters to chunk the input into. :param max_overlap: The maximum number of characters to overlap between chunks. :param data_type: Optional. Defines how Functions runtime should treat the parameter value. Default value: None :param kwargs: Keyword arguments for specifying additional binding fields to include in the binding json

event_grid_output

The event_grid_output decorator adds <xref:azure.functions.EventGridOutput> to the <xref:azure.functions.FunctionBuilder> object for building Function object used in worker function indexing model. This is equivalent to defining output binding in the function.json which enables function to write events to a custom topic. All optional fields will be given default value by function host when they are parsed by function host.

Ref: https://aka.ms/eventgridtrigger

represents the event. :param data_type: Defines how Functions runtime should treat the parameter value. :param topic_endpoint_uri: The name of an app setting that contains the URI for the custom topic. :param topic_key_setting: The name of an app setting that contains an access key for the custom topic. :param connection: The value of the common prefix for the setting that contains the topic endpoint URI. :return: Decorator function.

event_hub_output

The event_hub_output decorator adds <xref:azure.functions.EventHubOutput> to the <xref:azure.functions.FunctionBuilder> object for building Function object used in worker function indexing model. This is equivalent to defining EventHubOutput in the function.json which enables function to write message(s) to the event hub. All optional fields will be given default value by function host when they are parsed by function host.

Ref: https://aka.ms/azure-function-binding-event-hubs

output object in function code. :param connection: The name of an app setting or setting collection that specifies how to connect to Event Hub. :param event_hub_name: The name of the event hub. :param data_type: Defines how Functions runtime should treat the parameter value. :param kwargs: Keyword arguments for specifying additional binding fields to include in the binding json.

function_name

Optional: Sets name of the Function object. If not set, it will default to the name of the method name.

additional setting fields :return: Decorator function.

generic_input_binding

The generic_input_binding decorator adds <xref:azure.functions.GenericInputBinding> to the <xref:azure.functions.FunctionBuilder> object for building Function object used in worker function indexing model. This is equivalent to defining a generic input binding in the function.json which enables function to read data from a custom defined input source. All optional fields will be given default value by function host when they are parsed by function host.

Ref: https://aka.ms/azure-function-binding-custom

fields to include in the binding json.

generic_output_binding

The generic_output_binding decorator adds <xref:azure.functions.GenericOutputBinding> to the <xref:azure.functions.FunctionBuilder> object for building Function object used in worker function indexing model. This is equivalent to defining a generic output binding in the function.json which enables function to write data from a custom defined output source. All optional fields will be given default value by function host when they are parsed by function host.

Ref: https://aka.ms/azure-function-binding-custom

fields to include in the binding json.

http_type

Set http type of the Function object.

kafka_output

The kafka_output decorator adds <xref:azure.functions.KafkaOutput> to the <xref:azure.functions.FunctionBuilder> object for building Function object used in worker function indexing model. This is equivalent to defining output binding in the function.json which enables function to write events to a kafka topic. All optional fields will be given default value by function host when they are parsed by function host.

Ref: https://aka.ms/kafkaoutput

represents the event. :param topic: The topic monitored by the trigger. :param broker_list: The list of Kafka brokers monitored by the trigger. :param avro_schema: This should be used only if a generic record should be generated. :param username: SASL username for use with the PLAIN and SASL-SCRAM-..

mechanisms. Default is empty string. This is equivalent to

'sasl.username' in librdkafka. :param password: SASL password for use with the PLAIN and SASL-SCRAM-..

mechanisms. Default is empty string. This is equivalent to

'sasl.password' in librdkafka. :param ssl_key_location: Path to client's private key (PEM) used for

authentication. Default is empty string. This is equivalent to

'ssl.key.location' in librdkafka. :param ssl_ca_location: Path to CA certificate file for verifying the broker's certificate. This is equivalent to 'ssl.ca.location' in librdkafka. :param ssl_certificate_location: Path to client's certificate. This is equivalent to 'ssl.certificate.location' in librdkafka. :param ssl_key_password: Password for client's certificate. This is equivalent to 'ssl.key.password' in librdkafka. :param schema_registry_url: URL for the Avro Schema Registry. :param schema_registry_username: Username for the Avro Schema Registry. :param schema_registry_password: Password for the Avro Schema Registry. :param o_auth_bearer_method: Either 'default' or 'oidc'. sasl.oauthbearer in librdkafka. :param o_auth_bearer_client_id: Specify only when o_auth_bearer_method is 'oidc'. sasl.oauthbearer.client.id in librdkafka. :param o_auth_bearer_client_secret: Specify only when o_auth_bearer_method is 'oidc'. sasl.oauthbearer.client.secret in librdkafka. :param o_auth_bearer_scope: Specify only when o_auth_bearer_method is 'oidc'. Client use this to specify the scope of the access request to the broker. sasl.oauthbearer.scope in librdkafka. :param o_auth_bearer_token_endpoint_url: Specify only when o_auth_bearer_method is 'oidc'. sasl.oauthbearer.token.endpoint.url in librdkafka. :param o_auth_bearer_extensions: Allow additional information to be provided to the broker. Comma-separated list of key=value pairs. E.g., "supportFeatureX=true,organizationId=sales-emea". sasl.oauthbearer.extensions in librdkafka :param max_message_bytes: Maximum transmit message size. Default is 1MB :param batch_size: Maximum number of messages batched in one MessageSet Default is 10000. :param enable_idempotence: When set to true, the producer will ensure

that messages are successfully produced exactly once and in the original produce order. Default is false.

enforced locally and limits the time a produced message waits for successful delivery. A time of 0 is infinite. This is the maximum time

used to deliver a message (including retries). Delivery error occurs

when either the retry count or the message timeout are exceeded. Default is 300000. :param request_timeout_ms: The ack timeout of the producer request in milliseconds. Default is 5000. :param max_retries: How many times to retry sending a failing Message. Default is 2147483647. Retrying may cause reordering unless 'EnableIdempotence' is set to 'True'. :param authentication_mode: SASL mechanism to use for authentication. Allowed values: Gssapi, Plain, ScramSha256, ScramSha512. Default is Plain. This is equivalent to 'sasl.mechanism' in librdkafka. :param protocol: Gets or sets the security protocol used to communicate

with brokers. Default is plain text. This is equivalent to

'security.protocol' in librdkafka. :param linger_ms: Linger.MS property provides the time between batches of messages being sent to cluster. Larger value allows more batching results in high throughput. :param data_type: Defines how Functions runtime should treat the parameter value. :param kwargs: Keyword arguments for specifying additional binding fields to include in the binding json

queue_output

The queue_output decorator adds <xref:azure.functions.QueueOutput> to the <xref:azure.functions.FunctionBuilder> object for building Function object used in worker function indexing model. This is equivalent to defining QueueOutput in the function.json which enables function to write message(s) to the storage queue. All optional fields will be given default value by function host when they are parsed by function host.

Ref: https://aka.ms/azure-function-binding-queue

queue output object in function code. :param queue_name: The name of the queue to poll. :param connection: The name of an app setting or setting collection that specifies how to connect to Azure Queues. :param data_type: Defines how Functions runtime should treat the

parameter value.

fields to include in the binding json.

semantic_search_input

The semantic search feature allows you to import documents into a vector database using an output binding and query the documents in that database using an input binding. For example, you can have a function that imports documents into a vector database and another function that issues queries to OpenAI using content stored in the vector database as

context (also known as the Retrieval Augmented Generation, or RAG technique).

Ref: https://platform.openai.com/docs/guides/embeddings

contains a connection string value. :param collection: The name of the collection or table to search or store. :param query: The semantic query text to use for searching. :param embeddings_model: The ID of the model to use for embeddings. The default value is "text-embedding-ada-002". :param chat_model: The name of the Large Language Model to invoke for chat responses. The default value is "gpt-3.5-turbo". :param system_prompt: Optional. The system prompt to use for prompting the large language model. :param max_knowledge_count: Optional. The number of knowledge items to inject into the SystemPrompt. Default value: 1 :param data_type: Optional. Defines how Functions runtime should treat the parameter value. Default value: None :param kwargs: Keyword arguments for specifying additional binding fields to include in the binding json

service_bus_queue_output

The service_bus_queue_output decorator adds <xref:azure.functions.ServiceBusQueueOutput> to the <xref:azure.functions.FunctionBuilder> object for building Function object used in worker function indexing model. This is equivalent to defining ServiceBusQueueOutput in the function.json which enables function to write message(s) to the service bus queue. All optional fields will be given default value by function host when they are parsed by function host.

Ref: https://aka.ms/azure-function-binding-service-bus

bus queue output object in function code. :param connection: The name of an app setting or setting collection that specifies how to connect to Service Bus. :param queue_name: Name of the queue to monitor. :param data_type: Defines how Functions runtime should treat the parameter value. :param access_rights: Access rights for the connection string. :return: Decorator function.

service_bus_topic_output

The service_bus_topic_output decorator adds <xref:azure.functions.ServiceBusTopicOutput> to the <xref:azure.functions.FunctionBuilder> object for building Function object used in worker function indexing model. This is equivalent to defining ServiceBusTopicOutput in the function.json which enables function to write message(s) to the service bus topic. All optional fields will be given default value by function host when they are parsed by function host.

Ref: https://aka.ms/azure-function-binding-service-bus

bus topic output object in function code. :param connection: The name of an app setting or setting collection that specifies how to connect to Service Bus. :param topic_name: Name of the topic to monitor. :param subscription_name: Name of the subscription to monitor. :param data_type: Defines how Functions runtime should treat the parameter value, defaults to DataType.UNDEFINED. :param access_rights: Access rights for the connection string. :return: Decorator function.

sql_input

The sql_input decorator adds <xref:azure.functions.SqlInput> to the <xref:azure.functions.FunctionBuilder> object for building Function object used in worker function indexing model. This decorator will work only with extension bundle 4.x and above. This is equivalent to defining SqlInput in the function.json which enables the function to read from a Sql database. All optional fields will be given default value by function host when they are parsed by function host.

Ref: https://aka.ms/sqlbindings

SqlRowList input object in function code :param command_text: The Transact-SQL query command or name of the stored procedure executed by the binding :param connection_string_setting: The name of an app setting that contains the connection string for the database against which the query or stored procedure is being executed :param command_type: A CommandType value, which is Text for a query and StoredProcedure for a stored procedure :param parameters: Zero or more parameter values passed to the command during execution as a single string. Must follow the format @param1=param1,@param2=param2 :param data_type: Defines how Functions runtime should treat the parameter value :param kwargs: Keyword arguments for specifying additional binding fields to include in the binding json

sql_output

The sql_output decorator adds <xref:azure.functions.SqlOutput> to the <xref:azure.functions.FunctionBuilder> object for building Function object used in worker function indexing model. This decorator will work only with extension bundle 4.x and above. This is equivalent to defining SqlOutput in the function.json which enables the function to write to a Sql database. All optional fields will be given default value by function host when they are parsed by function host.

Ref: https://aka.ms/sqlbindings

Sql output object in function code :param command_text: The Transact-SQL query command or name of the stored procedure executed by the binding :param connection_string_setting: The name of an app setting that contains the connection string for the database against which the query or stored procedure is being executed :param data_type: Defines how Functions runtime should treat the parameter value :param kwargs: Keyword arguments for specifying additional binding fields to include in the binding json

table_input

The table_input decorator adds <xref:azure.functions.TableInput> to the <xref:azure.functions.FunctionBuilder> object for building Function object used in worker function indexing model. This is equivalent to defining TableInput in the function.json which enables function to read a table in an Azure Storage or Cosmos DB account All optional fields will be given default value by function host when they are parsed by function host.

Ref: https://aka.ms/tablesbindings

the table or entity in function code. :param connection: The name of an app setting or setting collection that specifies how to connect to the table service. :param table_name: The Name of the table :param row_key: The row key of the table entity to read. :param partition_key: The partition key of the table entity to read. :param take: The maximum number of entities to return :param filter: An OData filter expression for the entities to return

from the table.

table_output