langtrain 0.1.12 → 0.1.14
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 +77 -65
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -5,96 +5,108 @@
|
|
|
5
5
|
<img alt="Langtrain Logo" src="https://raw.githubusercontent.com/langtrain-ai/langtrain-sdk/main/public/langtrain-black.svg" width="250">
|
|
6
6
|
</picture>
|
|
7
7
|
<h3>Langtrain SDK</h3>
|
|
8
|
-
<p>
|
|
9
|
-
The unified intelligence layer for JavaScript applications. <br/>
|
|
10
|
-
Combine computer vision and LLM fine-tuning in a single, high-performance SDK.
|
|
11
|
-
</p>
|
|
8
|
+
<p>The unified intelligence layer for JavaScript applications.</p>
|
|
12
9
|
|
|
13
10
|
<p>
|
|
14
|
-
<a href="https://www.npmjs.com/package/langtrain"><img src="https://img.shields.io/npm/v/langtrain?style=flat-square&labelColor=
|
|
15
|
-
<a href="https://langtrain.ai"><img src="https://img.shields.io/badge/website-langtrain.ai-
|
|
16
|
-
<a href="https://docs.langtrain.ai"><img src="https://img.shields.io/badge/docs-documentation-
|
|
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=
|
|
11
|
+
<a href="https://www.npmjs.com/package/langtrain"><img src="https://img.shields.io/npm/v/langtrain?style=flat-square&labelColor=18181b&color=22c55e" alt="npm version" /></a>
|
|
12
|
+
<a href="https://langtrain.ai"><img src="https://img.shields.io/badge/website-langtrain.ai-18181b?style=flat-square&labelColor=18181b" alt="website" /></a>
|
|
13
|
+
<a href="https://docs.langtrain.ai"><img src="https://img.shields.io/badge/docs-documentation-18181b?style=flat-square&labelColor=18181b" alt="documentation" /></a>
|
|
14
|
+
<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=18181b&color=3b82f6" alt="license" /></a>
|
|
18
15
|
</p>
|
|
19
16
|
|
|
20
17
|
<br/>
|
|
21
18
|
|
|
22
|
-
<
|
|
19
|
+
<p align="center"><code>npm i -g langtrain</code></p>
|
|
20
|
+
<p><strong>Langtrain CLI</strong> is a unified AI engineering platform that runs locally on your computer and connects to the Langtrain Cloud.</p>
|
|
23
21
|
|
|
24
|
-
<
|
|
22
|
+
<p>
|
|
23
|
+
If you want Langtrain in your code editor, <a href="https://langtrain.ai/docs/vscode">install the VS Code Extension.</a><br/>
|
|
24
|
+
If you are looking for the <em>web-based platform</em>, <strong>Langtrain Web</strong>, go to <a href="https://langtrain.ai">langtrain.ai</a>.
|
|
25
|
+
</p>
|
|
25
26
|
</div>
|
|
26
27
|
|
|
27
|
-
|
|
28
|
+
---
|
|
28
29
|
|
|
29
|
-
|
|
30
|
+
## 🚀 Quickstart (CLI)
|
|
30
31
|
|
|
31
|
-
|
|
32
|
+
Install globally with npm:
|
|
32
33
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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. |
|
|
34
|
+
```shell
|
|
35
|
+
npm install -g langtrain
|
|
36
|
+
```
|
|
39
37
|
|
|
40
|
-
|
|
38
|
+
Then run `langtrain` to start the interactive AI engineering studio:
|
|
41
39
|
|
|
42
|
-
```
|
|
43
|
-
|
|
40
|
+
```shell
|
|
41
|
+
langtrain
|
|
42
|
+
```
|
|
44
43
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
const tune = new Langtune({ apiKey: process.env.LANGTUNE_API_KEY });
|
|
44
|
+
<details>
|
|
45
|
+
<summary><strong>Troubleshooting Installation</strong></summary>
|
|
48
46
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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
|
-
}
|
|
70
|
-
}
|
|
47
|
+
If you encounter permission errors, try running with sudo or fix your npm permissions:
|
|
48
|
+
```bash
|
|
49
|
+
sudo npm install -g langtrain
|
|
50
|
+
```
|
|
51
|
+
</details>
|
|
52
|
+
|
|
53
|
+
### Using Langtrain with your Cloud Plan
|
|
54
|
+
|
|
55
|
+
Run `langtrain login` and enter your API Key from the dashboard to authenticate. We recommend signing into your Langtrain account to use **Cloud Finetuning**, **Agent Persistence**, and **Model Hosting** as part of your Pro or Enterprise plan. [Learn more about Langtrain Plans](https://langtrain.ai/pricing).
|
|
71
56
|
|
|
72
|
-
|
|
57
|
+
Check your subscription status and limits:
|
|
58
|
+
```shell
|
|
59
|
+
langtrain status
|
|
73
60
|
```
|
|
61
|
+
*Free plans allow local fine-tuning. Upgrade to Pro for cloud-based GPU training.*
|
|
74
62
|
|
|
75
|
-
|
|
63
|
+
---
|
|
76
64
|
|
|
77
|
-
|
|
65
|
+
## 📦 SDK Usage
|
|
78
66
|
|
|
79
|
-
|
|
67
|
+
You can also use `langtrain` as a library in your Node.js applications to build intelligent agents and workflows.
|
|
80
68
|
|
|
81
69
|
```typescript
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
70
|
+
import { Langvision, Langtune, SubscriptionClient } from 'langtrain';
|
|
71
|
+
|
|
72
|
+
// 1. Initialize Clients
|
|
73
|
+
const vision = new Langvision({ apiKey: process.env.LANGTRAIN_API_KEY });
|
|
74
|
+
const tune = new Langtune({ apiKey: process.env.LANGTRAIN_API_KEY });
|
|
75
|
+
|
|
76
|
+
async function analyzeAndTune() {
|
|
77
|
+
// Analyze visual user context
|
|
78
|
+
const context = await vision.analyze({
|
|
79
|
+
image: './dashboard.jpg',
|
|
80
|
+
features: ['layout', 'text']
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
console.log('Visual Context:', context);
|
|
84
|
+
|
|
85
|
+
// Generate optimized response
|
|
86
|
+
const response = await tune.generate({
|
|
87
|
+
model: 'gpt-4-vision-optimized',
|
|
88
|
+
prompt: `Explain this dashboard layout: ${context.description}`
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
console.log(response);
|
|
92
|
+
}
|
|
92
93
|
```
|
|
93
94
|
|
|
94
|
-
##
|
|
95
|
+
## ✨ Features
|
|
96
|
+
|
|
97
|
+
- **🤖 AI Agents**: Create, manage, and chat with custom AI agents hosted on Langtrain Server.
|
|
98
|
+
- **🧠 Langtune**: Fine-tune LLMs (Llama 3, Mistral) locally or on the cloud.
|
|
99
|
+
- **👁️ Langvision**: Optimize and fine-tune multimodal vision models.
|
|
100
|
+
- **☁️ Data Persistence**: Automatically sync datasets and training jobs with your workspace.
|
|
101
|
+
- **📊 Subscription Management**: Verify plan limits and feature access programmatically.
|
|
102
|
+
|
|
103
|
+
## 📚 Documentation
|
|
95
104
|
|
|
96
|
-
|
|
105
|
+
- [**Langtrain Documentation**](https://docs.langtrain.ai)
|
|
106
|
+
- [**SDK Reference**](https://docs.langtrain.ai/sdk)
|
|
107
|
+
- [**Contributing**](./CONTRIBUTING.md)
|
|
97
108
|
|
|
98
|
-
## License
|
|
109
|
+
## 📄 License
|
|
99
110
|
|
|
100
|
-
|
|
111
|
+
This repository is licensed under the [MIT License](LICENSE).
|
|
112
|
+
copyright © [Langtrain AI](https://langtrain.ai)
|