Connection Registry
The connection registry lets application code register preconfigured clients or
connection settings by name. A .prompty file can then use
connection.kind: reference without embedding secrets in the file.
Register and look up a connection
Section titled “Register and look up a connection”from openai import AzureOpenAIimport prompty
client = AzureOpenAI( azure_endpoint=os.environ["AZURE_ENDPOINT"], api_key=os.environ["AZURE_API_KEY"],)
prompty.register_connection("my-foundry", client=client)client = prompty.get_connection("my-foundry")prompty.clear_connections()import { registerConnection, getConnection, clearConnections } from "@prompty/core";import AzureOpenAI from "openai";
const client = new AzureOpenAI({ endpoint: process.env.AZURE_ENDPOINT, apiKey: process.env.AZURE_API_KEY,});
registerConnection("my-foundry", client);const conn = getConnection("my-foundry");clearConnections();using Prompty.Core;
ConnectionRegistry.Register("my-foundry", client);var conn = ConnectionRegistry.Get("my-foundry");ConnectionRegistry.Clear();use prompty;use serde_json::json;
prompty::register_connection("my-foundry", json!({ "kind": "key", "endpoint": std::env::var("AZURE_ENDPOINT")?, "apiKey": std::env::var("AZURE_API_KEY")?,}));
let conn = prompty::get_connection("my-foundry");prompty::clear_connections();Reference from .prompty
Section titled “Reference from .prompty”model: id: gpt-4o provider: foundry connection: kind: reference name: my-foundryUse references for environment-specific values, authenticated SDK clients, and
test fixtures. Use explicit key, remote, anonymous, foundry, or oauth
connections when the configuration should live directly in the prompt.
For connection data shapes, see Connection.