fix Docker builds: go-http missing files, go-openai go.sum, csharp-openai SDK API, D language JSONValue syntax
This commit is contained in:
parent
381bd5f739
commit
6318db3d1f
65 changed files with 2934 additions and 2306 deletions
|
|
@ -1,4 +1,4 @@
|
|||
# UncloseAI Node.js Client
|
||||
# uncloseai. Node.js Client
|
||||
|
||||
A Node.js client library for interacting with vLLM, Ollama, and OpenAI-compatible APIs.
|
||||
|
||||
|
|
@ -26,10 +26,10 @@ node examples.js
|
|||
## Quick Start
|
||||
|
||||
```javascript
|
||||
const { UncloseAI } = require('./uncloseai_lib');
|
||||
const { uncloseai } = require('./uncloseai_lib');
|
||||
|
||||
// Initialize client (auto-discovers from environment variables)
|
||||
const client = new UncloseAI();
|
||||
const client = new uncloseai();
|
||||
|
||||
// Non-streaming chat
|
||||
const response = await client.chat({
|
||||
|
|
@ -64,7 +64,7 @@ export TTS_ENDPOINT_1="https://speech.ai.unturf.com/v1"
|
|||
### Programmatic Configuration
|
||||
|
||||
```javascript
|
||||
const client = new UncloseAI({
|
||||
const client = new uncloseai({
|
||||
endpoints: ['https://api.example.com/v1'],
|
||||
ttsEndpoints: ['https://tts.example.com/v1'],
|
||||
apiKey: 'your-api-key', // Optional
|
||||
|
|
@ -75,7 +75,7 @@ const client = new UncloseAI({
|
|||
|
||||
## API Reference
|
||||
|
||||
### UncloseAI
|
||||
### uncloseai. Client
|
||||
|
||||
Main client class for interacting with AI APIs.
|
||||
|
||||
|
|
@ -178,12 +178,12 @@ Generate speech from text.
|
|||
|
||||
**Throws:**
|
||||
- `ConnectionError`: If request fails
|
||||
- `UncloseAIError`: If no TTS endpoints available
|
||||
- `uncloseaiError`: If no TTS endpoints available
|
||||
|
||||
**Example:**
|
||||
```javascript
|
||||
const audioData = await client.tts({
|
||||
text: 'Hello from UncloseAI!',
|
||||
text: 'Hello from uncloseai.!',
|
||||
voice: 'alloy',
|
||||
model: 'tts-1'
|
||||
});
|
||||
|
|
@ -196,9 +196,9 @@ fs.writeFileSync('output.mp3', audioData);
|
|||
### Basic Chat
|
||||
|
||||
```javascript
|
||||
const { UncloseAI } = require('./uncloseai_lib');
|
||||
const { uncloseai } = require('./uncloseai_lib');
|
||||
|
||||
const client = new UncloseAI();
|
||||
const client = new uncloseai();
|
||||
|
||||
const response = await client.chat({
|
||||
model: 'auto',
|
||||
|
|
@ -252,7 +252,7 @@ const response2 = await client.chat({ model: 'auto', messages });
|
|||
const fs = require('fs');
|
||||
|
||||
const audioData = await client.tts({
|
||||
text: 'Hello from UncloseAI!',
|
||||
text: 'Hello from uncloseai.!',
|
||||
voice: 'alloy',
|
||||
model: 'tts-1'
|
||||
});
|
||||
|
|
@ -279,9 +279,9 @@ const response = await client.chat({
|
|||
### Error Handling
|
||||
|
||||
```javascript
|
||||
const { UncloseAI, UncloseAIError, ModelNotFoundError } = require('./uncloseai_lib');
|
||||
const { uncloseai, uncloseaiError, ModelNotFoundError } = require('./uncloseai_lib');
|
||||
|
||||
const client = new UncloseAI();
|
||||
const client = new uncloseai();
|
||||
|
||||
try {
|
||||
const response = await client.chat({
|
||||
|
|
@ -291,7 +291,7 @@ try {
|
|||
} catch (error) {
|
||||
if (error instanceof ModelNotFoundError) {
|
||||
console.log(`Model error: ${error.message}`);
|
||||
} else if (error instanceof UncloseAIError) {
|
||||
} else if (error instanceof uncloseaiError) {
|
||||
console.log(`API error: ${error.message}`);
|
||||
} else {
|
||||
throw error;
|
||||
|
|
@ -330,7 +330,7 @@ Tested with:
|
|||
|
||||
## Error Types
|
||||
|
||||
- `UncloseAIError` - Base error class for all library errors
|
||||
- `uncloseaiError` - Base error class for all library errors
|
||||
- `ConnectionError` - Network connection errors
|
||||
- `ModelNotFoundError` - Requested model not available
|
||||
- `StreamingError` - Errors during streaming requests
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue