Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/drkameleon/claude.ai.art
Claude.ai API client for Arturo
https://github.com/drkameleon/claude.ai.art
ai api api-client artificial-intelligence arturo arturo-package claude-ai claude-api
Last synced: about 2 months ago
JSON representation
Claude.ai API client for Arturo
- Host: GitHub
- URL: https://github.com/drkameleon/claude.ai.art
- Owner: drkameleon
- License: mit
- Created: 2024-11-06T13:10:10.000Z (about 2 months ago)
- Default Branch: main
- Last Pushed: 2024-11-06T17:13:50.000Z (about 2 months ago)
- Last Synced: 2024-11-06T17:39:25.793Z (about 2 months ago)
- Topics: ai, api, api-client, artificial-intelligence, arturo, arturo-package, claude-ai, claude-api
- Homepage: https://claude.pkgr.art
- Size: 1000 Bytes
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
Claude.ai
A clean & intuitive,
Anthropic Claude API wrapper for Arturo
---
* [What does this package do?](#what-does-this-package-do)
* [How do I use it?](#how-do-i-use-it)
* [API Reference](#api-reference)
* [Type Reference](#type-reference)
* [License](#license)
---### What does this package do?
This package provides a clean wrapper around [Anthropic's Claude API](https://www.anthropic.com/api), allowing you to easily integrate Claude's capabilities into your Arturo applications. It handles all the API communication, message formatting, and response parsing, providing both low-level access to the full API and convenient high-level methods for common use cases.
### How do I use it?
First, make sure you have an API key from Anthropic. Then simply `import` the package and initialize a client:
```red
import "claude"!; Initialize with your API key
claude: to :claudeAPI @["sk-your-api-key"]!; Ask a simple question
answer: claude\ask "What is the capital of France?"
print answer; Have a more complex conversation
response: claude\chat [
createMessage "user" "What's quantum computing?"
createMessage "assistant" "Quantum computing uses quantum mechanics..."
createMessage "user" "Can you explain qubits?"
]; Use custom parameters
response: claude\chat
.temperature: 0.9
.maxTokens: 2000
.system: "You are a creative writing expert"
[
createMessage "user" "Write a creative story"
]
```### API Reference
#### `claudeAPI`
##### Description
The main client class for interacting with Claude's API.
##### Methods
###### `chat`
Send messages to Claude and get responses.
chat messages :block**Attributes**
| Option | Type | Description |
|----|----|----|
| model | :string | Specify Claude model to use (default: claude-3-sonnet) |
| system | :string | Specify system message |
| temperature | :floating | Set temperature (0.0-1.0) |
| maxTokens | :integer | Set max tokens for response |
| topP | :floating | Set top_p value (0.0-1.0) |
| topK | :integer | Set top_k value |**Returns**
- *:dictionary* - The complete API response###### `ask`
Simplified method for single-turn questions.
ask question :string**Returns**
- *:string* - Claude's response text###### Configuration Methods
- `setModel [model :string]` - Set default model
- `setMaxTokens [tokens :integer]` - Set default max tokens
- `setTemperature [temp :floating]` - Set default temperature
- `setTopP [topP :floating]` - Set default top_p### Type Reference
#### `message`
##### Description
Represents a single message in a conversation.
##### Usage
```red
msg: createMessage "user" "Hello, Claude!"
```or
```red
msg: to :message ["user" "This is my message"]
```##### Fields
- `role` - Either "user" or "assistant"
- `content` - The message content
### License
MIT License
Copyright (c) 2024 Yanis Zafirópulos
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.