



const { OpenAI } = require('openai');
const api = new OpenAI({
baseURL: 'https://api.ai.cc/v1',
apiKey: '',
});
const main = async () => {
const result = await api.chat.completions.create({
model: 'togethercomputer/mpt-7b-chat',
messages: [
{
role: 'system',
content: 'You are an AI assistant who knows everything.',
},
{
role: 'user',
content: 'Tell me, why is the sky blue?'
}
],
});
const message = result.choices[0].message.content;
console.log(`Assistant: ${message}`);
};
main();
import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.ai.cc/v1",
api_key="",
)
response = client.chat.completions.create(
model="togethercomputer/mpt-7b-chat",
messages=[
{
"role": "system",
"content": "You are an AI assistant who knows everything.",
},
{
"role": "user",
"content": "Tell me, why is the sky blue?"
},
],
)
message = response.choices[0].message.content
print(f"Assistant: {message}")
-
AI Playground

Test all API models in the sandbox environment before you integrate.
We provide more than 300 models to integrate into your app.


Product Detail
Introducing MPT-7B: A Powerful Open-Source Transformer for Advanced NLP
MPT-7B marks a significant achievement from MosaicML, aimed at democratizing access to state-of-the-art transformer technology. As a decoder-style Transformer and a member of the GPT-style large language model family, MPT-7B is meticulously engineered to excel in both general and highly specialized Natural Language Processing (NLP) tasks, with an exceptional capability for managing extremely long input sequences. Released in May 2023, its initial version has spawned specialized variants like MPT-7B-Chat, MPT-7B-Instruct, and MPT-7B-StoryWriter-65k+, each tailored for specific applications.
Key Features & Innovations
✅ Commercially Usable & Open Source
The base model and several variants are released under the flexible Apache-2.0 license, ensuring broad accessibility and empowering developers and businesses with commercial application possibilities.
📚 Unprecedented Long Input Sequence Handling
Utilizing the advanced ALiBi (Attention with Linear Biases) technique, MPT-7B can process input lengths up to an astonishing 65,000 tokens, making it exceptionally well-suited for comprehensive document analysis, long-form content generation, and intricate text understanding tasks.
⚡ High Efficiency & Accelerated Performance
Engineered with FlashAttention and FasterTransformer, MPT-7B delivers significantly accelerated training and inference speeds. This optimization not only boosts performance but also translates into substantial reductions in operational costs.
🌐 Broad Accessibility & Easy Integration
MPT-7B is seamlessly integrated with HuggingFace, ensuring straightforward implementation and compatibility with existing machine learning workflows, thus lowering the barrier to adoption for researchers and developers alike.
Versatile Intended Use Cases
- 🔬 AI Research & Application Development: An ideal foundation for machine learning research and the creation of innovative AI-powered applications.
- 💼 Commercial & Enterprise Solutions: Highly versatile for deployment in various commercial settings, from advanced tech ventures to the entertainment industry, facilitating bespoke solutions.
- 🗣️ Specialized Generative AI: Variants like MPT-7B-Chat are optimized for conversational AI, MPT-7B-Instruct for precise instruction following, and MPT-7B-StoryWriter-65k+ for compelling narrative generation.
Technical Specifications & Training
⚙️ Architecture: Built as a powerful decoder-only transformer model, it comprises 6.7 billion parameters, meticulously designed for deep contextual understanding and high-quality text generation.
🧠 Comprehensive Training Data: The model's robustness is attributed to its training on an expansive 1 trillion tokens, derived from a rigorously curated dataset that intelligently combines diverse text and code sources, ensuring a holistic linguistic and contextual grasp.
🌐 Diverse Data Sources: Training involved large-scale corpora such as Books3, Common Crawl, and various domain-specific datasets, providing a rich mixture of general and specialized content.
🗓️ Knowledge Cutoff: The model incorporates the most recent and relevant data available up to the year 2023, enabling a contemporary understanding of language and context.
🌍 Language Support: Primarily focused on English, MPT-7B was trained on a wide array of text types, encompassing both technical and creative writing, to ensure robust and nuanced language understanding.
Performance Benchmarks & Ethical Framework
📈 Performance Metrics
- Accuracy: Demonstrates high performance, consistently matching and in several aspects surpassing contemporaries like LLaMA-7B across various standardized benchmarks.
- Robustness: Exhibits proven capability to handle a wide range of inputs and tasks, showcasing excellent generalization across numerous benchmarks and practical real-world applications.
⚖️ Ethical Guidelines & Licensing
Ethical AI Development: MPT-7B adheres strictly to ethical AI development practices, emphasizing transparency, fairness, and responsible use. These guidelines are thoroughly documented to ensure safe and beneficial deployment.
License Type: Licensing for MPT-7B variants varies. While the core model often uses the permissive Apache-2.0, certain uses or variants may fall under more restrictive licenses like CC-By-NC-SA-4.0. Users are strongly advised to review the specific licensing terms for each variant to ensure appropriate usage.
Diversity and Bias: The model's training data was carefully constructed to minimize bias through a wide array of text sources, genres, and styles. MosaicML maintains ongoing evaluations to address and amend any emergent biases effectively.
Practical Usage & Code Samples
💻 Seamless Integration with HuggingFace: Integrating MPT-7B into your projects is straightforward. Below is an illustrative code sample demonstrating how to load and use an MPT-7B variant for text generation.
from transformers import AutoTokenizer, AutoModelForCausalLM
# Load tokenizer and model for MPT-7B-Chat
tokenizer = AutoTokenizer.from_pretrained("mosaicml/mpt-7b-chat", trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained("mosaicml/mpt-7b-chat", trust_remote_code=True)
# Prepare input text
input_text = "As an AI assistant, tell me a short, inspiring story about perseverance."
input_ids = tokenizer.encode(input_text, return_tensors="pt")
# Generate output
output = model.generate(input_ids, max_length=150, num_return_sequences=1, do_sample=True, temperature=0.7)
print(tokenizer.decode(output[0], skip_special_tokens=True))
(Note: The original `
Frequently Asked Questions (FAQs)
❓ Q1: What exactly is MPT-7B?
A: MPT-7B is an open-source, decoder-style Transformer large language model developed by MosaicML. It's designed for advanced NLP tasks, notably efficient and capable of processing exceptionally long input sequences.
❓ Q2: Can MPT-7B be used for commercial projects?
A: Yes, the base MPT-7B model and many of its variants are released under the Apache-2.0 license, which permits commercial use. However, it's crucial to verify the specific license for each variant you intend to use.
❓ Q3: What makes MPT-7B stand out in handling long texts?
A: MPT-7B leverages ALiBi (Attention with Linear Biases) technology, enabling it to efficiently process input sequences of up to 65,000 tokens, a significant advantage for tasks requiring extensive context.
❓ Q4: How does MPT-7B's performance compare to other LLMs like LLaMA-7B?
A: MPT-7B consistently demonstrates competitive performance, matching and often surpassing models like LLaMA-7B across various standardized benchmarks in terms of accuracy and generalization.
❓ Q5: What technical innovations contribute to MPT-7B's efficiency?
A: Its efficiency stems from its 6.7 billion parameter decoder-only Transformer architecture combined with cutting-edge optimizations like FlashAttention and FasterTransformer, which significantly accelerate both training and inference processes.
Learn how you can transformyour company with AICC APIs



Log in