ChatNovita
Delivers an affordable, reliable, and simple inference platform for running top LLM models.
You can find all the models we support here: Novita AI Featured Models or request the Models API to get all available models.
Try the Novita AI Llama 3 API Demo today!
Overview
Model features
Tool calling | Structured output | JSON mode | Image input | Audio input | Video input | Token-level streaming | Native async | Token usage | Logprobs |
---|---|---|---|---|---|---|---|---|---|
❌ | ✅ | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | ✅ | ❌ |
Setup
To access Novita AI models you’ll need to create a Novita account and get an API key.
Credentials
Head to this page to sign up to Novita AI and generate an API key. Once you’ve done this set the NOVITA_API_KEY environment variable:
export NOVITA_API_KEY="your-api-key"
Installation
The LangChain Novita integration lives in the @langchain-community
package:
- npm
- yarn
- pnpm
npm i @langchain/community @langchain/core
yarn add @langchain/community @langchain/core
pnpm add @langchain/community @langchain/core
Instantiation
Now we can instantiate our model object and generate chat completions. Try the Novita AI Llama 3 API Demo today!
import { ChatNovitaAI } from "@langchain/community/chat_models/novita";
const llm = new ChatNovitaAI({
model: "meta-llama/llama-3.1-8b-instruct",
temperature: 0,
// other params...
})
Invocation
const aiMsg = await llm.invoke([
{
role: "system",
content: "You are a helpful assistant that translates English to French. Translate the user sentence.",
},
{
role: "human",
content: "I love programming."
},
]);
console.log(aiMsg.content)
Chaining
We can chain our model with a prompt template like so:
import { ChatPromptTemplate } from "@langchain/core/prompts"
const prompt = ChatPromptTemplate.fromMessages(
[
[
"system",
"You are a helpful assistant that translates {input_language} to {output_language}.",
],
["human", "{input}"],
]
)
const chain = prompt.pipe(llm);
await chain.invoke(
{
input_language: "English",
output_language: "German",
input: "I love programming.",
}
)
API reference
For detailed documentation of Novita AI LLM APIs, head to Novita AI LLM API reference
Related
- Chat model conceptual guide
- Chat model how-to guides