@openclueo/sdk
Version:
Official JavaScript SDK for Clueo AI Personality API with Big Five model integration
170 lines (143 loc) • 3.88 kB
Markdown
# 🚀 Clueo JavaScript SDK
**Inject AI personalities using the Big Five model in just 3 lines of code.**
## Quick Start
```javascript
// 1. Import SDK
const clueo = new Clueo('ck_your_api_key_here')
// 2. Inject personality into prompt
const result = await clueo.inject('How do I scale my startup?', {
openness: 8, // Creative, innovative (1-10)
conscientiousness: 7, // Organized, disciplined (1-10)
extraversion: 6, // Outgoing, social (1-10)
agreeableness: 5, // Cooperative, trusting (1-10)
neuroticism: 3 // Calm, stable (1-10)
})
// 3. Use result
console.log(result.injected_prompt)
```
## Installation
### NPM
```bash
npm install @openclueo/sdk
```
```javascript
// ES6 modules
import Clueo from '@openclueo/sdk'
// CommonJS
const Clueo = require('@openclueo/sdk')
```
### Browser (CDN)
```html
<script src="https://unpkg.com/@openclueo/sdk@latest/clueo.js"></script>
<script>
const clueo = new Clueo('ck_your_api_key_here')
</script>
```
## API Examples
### Personality Injection (Big Five Model)
```javascript
const result = await clueo.inject('How should I approach this problem?', {
openness: 9, // Highly creative and innovative
conscientiousness: 6, // Moderately organized
extraversion: 4, // Introverted, thoughtful
agreeableness: 7, // Cooperative and helpful
neuroticism: 2 // Very calm and stable
})
console.log(result.injected_prompt)
```
### Conversation Simulation
```javascript
const response = await clueo.simulate('What should I focus on next?', {
openness: 8,
conscientiousness: 9,
extraversion: 7,
agreeableness: 6,
neuroticism: 3
})
console.log(response.response)
```
### Bring Your Own OpenAI Key
```javascript
const result = await clueo.inject('Tell me about startups', {
openness: 8,
conscientiousness: 7,
extraversion: 6,
agreeableness: 5,
neuroticism: 3,
openaiKey: 'sk_your_openai_key_here' // Optional: use your own key
})
```
### Legacy Transform (Still Supported)
```javascript
const result = await clueo.transform('Hey!', 'Professional')
console.log(result.transformed)
```
## Raw API (No SDK)
### cURL
```bash
curl -X POST https://backend.clueoai.com/api/enhanced/inject \
-H "x-api-key: ck_your_key" \
-H "Content-Type: application/json" \
-d '{
"prompt": "How do I scale my startup?",
"personalityConfig": {
"openness": 8,
"conscientiousness": 7,
"extraversion": 6,
"agreeableness": 5,
"neuroticism": 3
}
}'
```
### JavaScript (Fetch)
```javascript
const response = await fetch('https://backend.clueoai.com/api/enhanced/inject', {
method: 'POST',
headers: {
'x-api-key': 'ck_your_key',
'Content-Type': 'application/json'
},
body: JSON.stringify({
prompt: 'How do I scale my startup?',
personalityConfig: {
openness: 8,
conscientiousness: 7,
extraversion: 6,
agreeableness: 5,
neuroticism: 3
}
})
})
const result = await response.json()
console.log(result.data.injected_prompt)
```
### Python
```python
import requests
response = requests.post('https://backend.clueoai.com/api/enhanced/inject',
headers={'x-api-key': 'ck_your_key'},
json={
'prompt': 'How do I scale my startup?',
'personalityConfig': {
'openness': 8,
'conscientiousness': 7,
'extraversion': 6,
'agreeableness': 5,
'neuroticism': 3
}
}
)
print(response.json()['data']['injected_prompt'])
```
## Get Your API Key
1. Sign up at [api.clueoai.com](https://api.clueoai.com)
2. Copy your `ck_` API key from the dashboard
3. Start transforming!
**Free tier**: 1,000 requests/month
**No credit card required**
## Support
- 📧 Email: emmanuel@clueoai.com
- 💬 Discord: [Join Community](https://discord.gg/6zjSPEAD)
- 📖 Docs: [clueoai.com/docs](https://clueoai.com/docs)
---
*Made with ❤️ by the Clueo team*