Anthropic Messages API client (Claude). Plain and multi-turn chat with a system prompt, tool use, streaming over server-sent events, structured (JSON) output through a forced tool, and extended-thinking blocks. Responses and errors follow the other AI client libraries: a failed call returns Nil and EndPoint->GetLastError() says why. The key comes from SetApiKey, the ANTHROPIC_API_KEY environment variable, or anthropic_api_key.dat in the working directory. Requests go over HTTPS. Compile with -lib anthropic.
Tool
A tool the model may call: a name, a description and a JSON schema for its input
Operations
New # constructor
Constructor
New(name:String, description:String, schema:JsonElement)Parameters
| Name | Type | Description |
|---|---|---|
| name | String | tool name |
| description | String | what the tool does, for the model |
| schema | JsonElement | JSON schema of the input, an object: {"type":"object","properties":{...},"required":[...]} |
New # constructor
Constructor from a function definition, the form the other AI client libraries use
New(func:FunctionType)Parameters
| Name | Type | Description |
|---|---|---|
| func | FunctionType | function definition |
ToJson #
Converts the tool to JSON for the request
method : public : ToJson() ~ JsonElementReturn
| Type | Description |
|---|---|
| JsonElement | JSON element |