Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
together-ai
Advanced tools
npm i together-ai
Create an account at together.ai and add the API key in. Then simply run the code snippet below with your preferred AI model and inputs to get back a reply.
import Together from 'together-ai';
const together = new Together({
auth: process.env.TOGETHER_API_KEY,
});
const model = 'mistralai/Mixtral-8x7B-Instruct-v0.1';
const result = await together.inference(model, {
prompt: 'Suggest some fun winter family activities',
max_tokens: 700,
});
If you want to stream, simply specify stream-tokens: true
.
const result = await together.inference('togethercomputer/llama-2-70b-chat', {
prompt: 'Tell me about the history of the United States',
max_tokens: 1000,
stream_tokens: true,
});
You can see an example of this library being used in a Next.js chat app here: https://simple-ai-chat.vercel.app.
The code for the example is also available, including code on how to stream the results of the LLM directly to the frontend: https://github.com/Nutlope/chat.
You can now use Llama Guard, an LLM-based input-output safeguard model, with models on the Together.ai platform. To do this, simply add "safety_model": "Meta-Llama/Llama-Guard-7b"
.
const result = await together.inference('togethercomputer/llama-2-13b-chat', {
prompt: 'Tell me about San Francisco',
max_tokens: 1000,
safety_model: 'Meta-Llama/Llama-Guard-7b',
});
This is a non-exhaustive list of popular models that are supported.
mistralai/Mixtral-8x7B-Instruct-v0.1
)mistralai/Mistral-7B-Instruct-v0.1
)togethercomputer/llama-2-70b-chat
)togethercomputer/llama-2-13b-chat
)togethercomputer/RedPajama-INCITE-7B-Chat
)Open-Orca/Mistral-7B-OpenOrca
)togethercomputer/alpaca-7b
)This library uses the Together Inference Engine, the world's fastest inference stack for open source LLMs. It calls the Together.ai Inference API, specifically their serverless endpoints product, to enable you to use OSS LLMs quickly and effeciently.
FAQs
The official TypeScript library for the Together API
The npm package together-ai receives a total of 8,656 weekly downloads. As such, together-ai popularity was classified as popular.
We found that together-ai demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.