langtrain 0.1.3 → 0.1.5
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 +54 -20
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
<div align="center">
|
|
2
|
-
<
|
|
2
|
+
<picture>
|
|
3
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/langtrain-ai/langtrain-sdk/main/public/langtrain-white.svg">
|
|
4
|
+
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/langtrain-ai/langtrain-sdk/main/public/langtrain-black.svg">
|
|
5
|
+
<img alt="Langtrain Logo" src="https://raw.githubusercontent.com/langtrain-ai/langtrain-sdk/main/public/langtrain-black.svg" width="250">
|
|
6
|
+
</picture>
|
|
3
7
|
<h1>Langtrain SDK</h1>
|
|
4
8
|
<p>
|
|
5
9
|
The unified intelligence layer for JavaScript applications. <br/>
|
|
@@ -10,6 +14,7 @@
|
|
|
10
14
|
<a href="https://www.npmjs.com/package/langtrain"><img src="https://img.shields.io/npm/v/langtrain?style=flat-square&labelColor=231f20&color=000000" alt="npm version" /></a>
|
|
11
15
|
<a href="https://langtrain.ai"><img src="https://img.shields.io/badge/website-langtrain.ai-000000?style=flat-square&labelColor=231f20" alt="website" /></a>
|
|
12
16
|
<a href="https://docs.langtrain.ai"><img src="https://img.shields.io/badge/docs-documentation-000000?style=flat-square&labelColor=231f20" alt="documentation" /></a>
|
|
17
|
+
<a href="https://github.com/langtrain-ai/langtrain-sdk/blob/main/LICENSE"><img src="https://img.shields.io/npm/l/langtrain?style=flat-square&labelColor=231f20&color=000000" alt="license" /></a>
|
|
13
18
|
</p>
|
|
14
19
|
|
|
15
20
|
<br/>
|
|
@@ -23,14 +28,16 @@
|
|
|
23
28
|
|
|
24
29
|
Langtrain brings the power of **Langvision** (Computer Vision) and **Langtune** (LLM Optimization) into your JavaScript/TypeScript workflow. It is designed to be the only SDK you need to build intelligent, multimodal AI applications.
|
|
25
30
|
|
|
26
|
-
## Features
|
|
31
|
+
## Key Features
|
|
27
32
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
33
|
+
| Feature | Description |
|
|
34
|
+
| :--- | :--- |
|
|
35
|
+
| **👁️ Computer Vision** | Advanced image analysis, object detection, and visual reasoning powered by `Langvision`. |
|
|
36
|
+
| **🧠 LLM Optimization** | Fine-tune and optimize language models effortlessly with `Langtune`. |
|
|
37
|
+
| **📦 Unified & Bundled** | A single dependency for your entire AI stack. Zero configuration required. |
|
|
38
|
+
| **⚡ Type-Safe** | Built with TypeScript for a robust, developer-friendly experience. |
|
|
32
39
|
|
|
33
|
-
##
|
|
40
|
+
## Quick Start
|
|
34
41
|
|
|
35
42
|
```typescript
|
|
36
43
|
import { Langvision, Langtune } from 'langtrain';
|
|
@@ -41,20 +48,47 @@ const tune = new Langtune({ apiKey: process.env.LANGTUNE_API_KEY });
|
|
|
41
48
|
|
|
42
49
|
// 2. Build Intelligence
|
|
43
50
|
async function analyzeAndTune() {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
51
|
+
try {
|
|
52
|
+
// Analyze visual user context
|
|
53
|
+
const context = await vision.analyze({
|
|
54
|
+
image: 'https://example.com/dashboard.jpg',
|
|
55
|
+
features: ['layout', 'text']
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
console.log('Visual Context:', context);
|
|
59
|
+
|
|
60
|
+
// Generate optimized response based on visual context
|
|
61
|
+
const response = await tune.generate({
|
|
62
|
+
model: 'gpt-4-vision-optimized',
|
|
63
|
+
prompt: `Explain this dashboard layout: ${context.description}`
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
console.log('AI Response:', response);
|
|
67
|
+
} catch (error) {
|
|
68
|
+
console.error('Error processing AI request:', error);
|
|
69
|
+
}
|
|
57
70
|
}
|
|
71
|
+
|
|
72
|
+
analyzeAndTune();
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Advanced Usage
|
|
76
|
+
|
|
77
|
+
For more complex workflows, you can leverage specific modules:
|
|
78
|
+
|
|
79
|
+
### Fine-Tuning a Model
|
|
80
|
+
|
|
81
|
+
```typescript
|
|
82
|
+
// Start a fine-tuning job
|
|
83
|
+
const job = await tune.createFineTune({
|
|
84
|
+
trainingFile: 'file-id-123',
|
|
85
|
+
model: 'gpt-3.5-turbo',
|
|
86
|
+
hyperparameters: {
|
|
87
|
+
nEpochs: 4
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
console.log(`Fine-tuning started: ${job.id}`);
|
|
58
92
|
```
|
|
59
93
|
|
|
60
94
|
## Documentation
|