claude_result() = {ok, binary()} | {error, term()}
config() = #{endpoint => string(), api_key => binary(), model => binary(), temperature => float(), max_tokens => integer(), system_prompt => binary(), additional_options => map()}
message() = #{role => binary(), content => binary()}
messages() = [message()]
| chat/1 | |
| chat/2 | Chat completion using messages format with custom configuration. |
| default_config/0 | |
| format_prompt/2 | |
| generate/1 | |
| generate/2 | |
| generate_with_context/2 | |
| generate_with_context/3 | |
| get_env_config/0 | Get configuration from environment variables with fallback to defaults. |
| merge_config/2 | |
| print_result/1 |
chat(Messages::messages()) -> claude_result()
chat(Messages::messages(), Config::config()) -> claude_result()
Chat completion using messages format with custom configuration. Note: Claude API uses 'system' as a separate parameter, not in messages array.
default_config() -> config()
format_prompt(Template::string(), Args::list()) -> binary()
generate(Prompt::string() | binary()) -> claude_result()
generate(Prompt::string() | binary(), Config::config()) -> claude_result()
generate_with_context(Context::string() | binary(), Prompt::string() | binary()) -> claude_result()
generate_with_context(Context::string() | binary(), Prompt::string() | binary(), Config::config()) -> claude_result()
get_env_config() -> config()
Get configuration from environment variables with fallback to defaults. Environment variables: - ANTHROPIC_API_KEY or CLAUDE_API_KEY: Claude API key (required) - CLAUDE_ENDPOINT: Claude API endpoint (default: https://api.anthropic.com/v1/messages) - CLAUDE_MODEL: Model name to use (default: claude-sonnet-4-20250514) - CLAUDE_TEMPERATURE: Temperature for generation (default: 0.7) - CLAUDE_MAX_TOKENS: Maximum tokens to generate (default: 1000) - CLAUDE_SYSTEM_PROMPT: System prompt to use
print_result(X1::claude_result()) -> ok | error
Generated by EDoc