together-ai
Advanced tools
Comparing version 0.3.0 to 0.4.0
@@ -33,4 +33,4 @@ type ApiResponse = { | ||
[x: string]: any; | ||
}): Promise<ApiResponse>; | ||
}): Promise<ApiResponse | ReadableStream<Uint8Array>>; | ||
} | ||
export default Together; |
@@ -42,4 +42,9 @@ "use strict"; | ||
}); | ||
const data = yield res.json(); | ||
return data; | ||
if (inputs.stream_tokens === true) { | ||
return res.body; | ||
} | ||
else { | ||
const data = yield res.json(); | ||
return data; | ||
} | ||
}); | ||
@@ -46,0 +51,0 @@ } |
{ | ||
"name": "together-ai", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"description": "A Node SDK for Together.ai.", | ||
@@ -5,0 +5,0 @@ "author": "Hassan El Mghari (@nutlope)", |
@@ -25,7 +25,9 @@ <div align="center"> | ||
const together = new Together({ | ||
auth: `api token`, | ||
auth: process.env.TOGETHER_API_KEY, | ||
}); | ||
const result = await together.inference('mistralai/Mistral-7B-Instruct-v0.1', { | ||
prompt: 'tell me about the history of the United States', | ||
const model = 'mistralai/Mistral-7B-Instruct-v0.1'; | ||
const result = await together.inference(model, { | ||
prompt: 'Suggest some fun family activities for the new year', | ||
max_tokens: 300, | ||
@@ -32,0 +34,0 @@ }); |
@@ -37,2 +37,3 @@ type ApiResponse = { | ||
} | ||
const res = await fetch('https://api.together.xyz/inference', { | ||
@@ -50,5 +51,8 @@ method: 'POST', | ||
const data: ApiResponse = await res.json(); | ||
return data; | ||
if (inputs.stream_tokens === true) { | ||
return res.body; | ||
} else { | ||
const data: ApiResponse = await res.json(); | ||
return data; | ||
} | ||
} | ||
@@ -55,0 +59,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6584
152
50