specific-ai 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +100 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# Specific.ai JavaScript SDK
|
|
2
|
+
|
|
3
|
+
## Installation
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm install specific-ai
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Quick Start
|
|
10
|
+
|
|
11
|
+
### OpenAI
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { OpenAIHttpClient } from "specific-ai"
|
|
15
|
+
|
|
16
|
+
// Initialize the client
|
|
17
|
+
const client = new OpenAIHttpClient({
|
|
18
|
+
URL: "https://api.openai.com/v1/chat/completions",
|
|
19
|
+
specificAIURL: "<your-specific-ai-service-URL>",
|
|
20
|
+
apiKey: "<your-openai-api-key>",
|
|
21
|
+
modelName: "gpt-3.5-turbo",
|
|
22
|
+
useSpecificAIInference: false,
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
// Send a completion request
|
|
26
|
+
const response = await client.createCompletion("Hello!", {
|
|
27
|
+
taskName: "greeting",
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
console.log(response.choices[0].message.content);
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Anthropic
|
|
34
|
+
|
|
35
|
+
```typescript
|
|
36
|
+
import { AnthropicHttpClient } from "specific-ai"
|
|
37
|
+
|
|
38
|
+
// Initialize the client
|
|
39
|
+
const client = new AnthropicHttpClient({
|
|
40
|
+
URL: "https://api.anthropic.com/v1/messages",
|
|
41
|
+
specificAIURL: "<your-specific-ai-service-URL>",
|
|
42
|
+
apiKey: "<your-anthropic-api-key>",
|
|
43
|
+
modelName: "claude-sonnet-4-20250514",
|
|
44
|
+
useSpecificAIInference: false,
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
// Send a message request
|
|
48
|
+
const response = await client.createMessage("Hello!", {
|
|
49
|
+
taskName: "greeting",
|
|
50
|
+
additionalOptions: {
|
|
51
|
+
max_tokens: 1000,
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
console.log(response.content[0].text);
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Features
|
|
59
|
+
|
|
60
|
+
- 🎯 Custom-tailored models optimized for your specific use cases
|
|
61
|
+
- 🚀 Works with OpenAI and Anthropic APIs
|
|
62
|
+
- 📊 Automatic request and response logging
|
|
63
|
+
- 🎯 Response optimization capabilities
|
|
64
|
+
- 📈 Advanced analytics integration
|
|
65
|
+
|
|
66
|
+
## Model Inference Options
|
|
67
|
+
|
|
68
|
+
The SDK offers two approaches to model inference, controlled by `useSpecificAIInference`:
|
|
69
|
+
|
|
70
|
+
- **Standard Inference** (`useSpecificAIInference: false`):
|
|
71
|
+
- Uses the provider's models directly (OpenAI/Anthropic)
|
|
72
|
+
- Standard pricing and performance
|
|
73
|
+
- Data is collected for future optimization
|
|
74
|
+
|
|
75
|
+
- **Specific.ai Inference** (`useSpecificAIInference: true`):
|
|
76
|
+
- Uses task-specific models optimized for your use cases
|
|
77
|
+
- Potential improvements in performance and cost
|
|
78
|
+
- Automatic fallback to standard models if needed
|
|
79
|
+
- Requires prior data collection for model training
|
|
80
|
+
|
|
81
|
+
## Best Practices
|
|
82
|
+
|
|
83
|
+
1. **Start with Data Collection**:
|
|
84
|
+
- Keep `useSpecificAIInference: false` initially
|
|
85
|
+
- This builds up training data for your use cases
|
|
86
|
+
- Use collected data to train a specific model with Specific.ai
|
|
87
|
+
|
|
88
|
+
2. **Transition to Optimized Models**:
|
|
89
|
+
- Deploy your model with Specific.ai
|
|
90
|
+
- Enable `useSpecificAIInference: true`
|
|
91
|
+
- Monitor performance improvements
|
|
92
|
+
|
|
93
|
+
3. **Testing New Features**:
|
|
94
|
+
- Use A/B testing between standard and optimized models
|
|
95
|
+
- Compare performance metrics
|
|
96
|
+
- Gradually roll out optimization to production
|
|
97
|
+
|
|
98
|
+
## Support
|
|
99
|
+
|
|
100
|
+
Need help? Contact our support team at support@specific.ai
|