AI.Core.MockLanguageModel (AI SDK v0.0.1-rc.0)
View SourceA mock language model implementation for testing.
This module allows you to create mock model instances with predefined behaviors for testing various AI.generate_text and AI.stream_text scenarios.
Summary
Functions
Mock implementation of the generate text function.
Mock implementation of the stream text function.
Creates a new mock language model with the given options.
Functions
Mock implementation of the generate text function.
By default, returns "Hello, world!" if no custom implementation is provided.
Mock implementation of the stream text function.
By default, streams "Hello, world!" if no custom implementation is provided.
Creates a new mock language model with the given options.
Options
:do_generate
- A function that will be called whendo_generate/1
is invoked:do_stream
- A function that will be called whendo_stream/1
is invoked:supports_image_urls
- Whether the model supports image URLs (default: false):supports_structured_outputs
- Whether the model supports structured outputs (default: false):supports_url
- A function that checks if a URL is supported