Dspy.LM behaviour (dspy v0.1.0)
View SourceBehaviour for language model clients.
Defines the interface for interacting with different language model providers like OpenAI, Anthropic, local models, etc.
Summary
Callbacks
Generate a completion from the language model.
Check if the language model supports a specific feature.
Functions
Create an assistant message.
Generate a completion using the configured language model.
Generate a completion using a specific language model.
Generate text from a simple prompt string.
Create a chat message.
Check if a language model supports a feature.
Create a system message.
Create a user message.
Types
@type request() :: %{ messages: [message()], max_tokens: pos_integer() | nil, temperature: float() | nil, stop: [String.t()] | nil, tools: [map()] | nil }
@type response() :: %{ choices: [%{message: message(), finish_reason: String.t() | nil}], usage: %{ prompt_tokens: pos_integer(), completion_tokens: pos_integer(), total_tokens: pos_integer() } | nil }
@type t() :: struct()
Callbacks
Generate a completion from the language model.
Check if the language model supports a specific feature.
Functions
Create an assistant message.
Generate a completion using the configured language model.
Generate a completion using a specific language model.
Generate text from a simple prompt string.
Create a chat message.
Check if a language model supports a feature.
Create a system message.
Create a user message.