with_options
Added in 0.79.0
The with_options
function creates a new client with default configuration options for logging, client registry, and type builders. These options are automatically applied to all function calls made through this client, but can be overridden on a per-call basis when needed.
Quick Start
Python
TypeScript
Ruby
Common Use Cases
Basic Configuration
Use with_options
to create a client with default settings that will be applied to all function calls made through this client. These defaults can be overridden when needed.
Python
TypeScript
Ruby
Parallel Execution
When running functions in parallel, with_options
helps maintain consistent configuration across all calls. This works seamlessly with the Collector
functionality.
Python
TypeScript
Ruby
Streaming Mode
with_options
can be used with streaming functions while maintaining all configured options.
Python
TypeScript
Ruby
API Reference
with_options Parameters
These can always be overridden on a per-call basis with the baml_options
parameter in any function call.
Configured Client Properties
The configured client maintains the same interface as the base baml_client
, so you can use all the same functions and methods.
Related Topics
- Collector - Track function calls and usage metrics
- TypeBuilder - Build custom types for your functions
- Client Registry - Manage LLM clients and their configurations
The configured client maintains the same interface as the base client, so you can use all the same functions and methods.