| 218 | * @category Layers |
| 219 | */ |
| 220 | export const layerConfig = ( |
| 221 | options: { |
| 222 | /** |
| 223 | * The API key to use to communicate with the Google Generative AI API. |
| 224 | */ |
| 225 | readonly apiKey?: Config.Config<Redacted.Redacted | undefined> | undefined |
| 226 | |
| 227 | /** |
| 228 | * The URL to use to communicate with the Google Generative AI API. |
| 229 | * |
| 230 | * Defaults to `"https://generativelanguage.googleapis.com/v1beta"`. |
| 231 | */ |
| 232 | readonly apiUrl?: Config.Config<string | undefined> | undefined |
| 233 | |
| 234 | /** |
| 235 | * A method which can be used to transform the underlying `HttpClient` which |
| 236 | * will be used to communicate with the Google Generative AI API. |
| 237 | */ |
| 238 | readonly transformClient?: ((client: HttpClient.HttpClient) => HttpClient.HttpClient) | undefined |
| 239 | } |
| 240 | ): Layer.Layer<GoogleClient, ConfigError, HttpClient.HttpClient> => { |
| 241 | const { transformClient, ...configs } = options |
| 242 | return Config.all(configs).pipe( |
| 243 | Effect.flatMap((configs) => make({ ...configs, transformClient })), |
| 244 | Layer.scoped(GoogleClient) |
| 245 | ) |
| 246 | } |
| 247 | |
| 248 | // ============================================================================= |
| 249 | // Utilities |