@@ -41,9 +41,18 @@ from ldai_langchain import LangChainProvider
4141ld_client = LDClient(Config(" your-sdk-key" ))
4242ai_client = init(ld_client)
4343
44- # Get AI configuration
44+ # Get AI configuration. Pass a default for improved resiliency when the flag is unavailable or
45+ # LaunchDarkly is unreachable; omit for a disabled default. Example:
46+ # from ldai.models import AICompletionConfigDefault, LDMessage, ModelConfig, ProviderConfig
47+ # default = AICompletionConfigDefault(
48+ # enabled=True,
49+ # model=ModelConfig("gpt-4"),
50+ # provider=ProviderConfig("openai"),
51+ # messages=[LDMessage(role="system", content="You are a helpful assistant.")]
52+ # )
53+ # config = ai_client.config("ai-config-key", context, default)
4554context = Context.builder(" user-123" ).build()
46- config = ai_client.config(" ai-config-key" , context, {} )
55+ config = ai_client.config(" ai-config-key" , context)
4756
4857async def main ():
4958 # Create a LangChain provider from the AI configuration
@@ -120,7 +129,7 @@ Use the provider with LaunchDarkly's tracking capabilities:
120129
121130``` python
122131# Get the AI config with tracker
123- config = ai_client.config(" ai-config-key" , context, {} )
132+ config = ai_client.config(" ai-config-key" , context)
124133
125134# Create provider
126135provider = await LangChainProvider.create(config)
0 commit comments