cerebras

为 Cerebras Inference 提供专家级指导:针对由世界最大芯片(晶圆级引擎)驱动的超快速大语言模型推理服务,帮助开发者集成 Cerebras 的 API,面向需要最快令牌生成速度的应用场景,例如实时聊天、代码补全和交互式 AI 体验。

仓库最近推送
GitHub Stars
219
Forks
38
Issues / PRs
1

安装方式

先用 Prompt 核对来源与依赖。也可下载安装包。

用 AI 助手安装

复制提示词,让助手先核对固定版本和依赖。

查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "cerebras":https://skillpi.com/zh/skills/deepskill-615290049ce5d1f1a7a1151045f9fe7ae975bb793d0954d9dcf66957b437153a。安装前核对上游来源和版本:https://github.com/TerminalSkills/skills。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。

来源与配置

github.com

配置方式待核实

请查看原始来源中的适用工具、依赖和权限要求。

安装实测待补充

为 Cerebras Inference 提供专家级指导:针对由世界最大芯片(晶圆级引擎)驱动的超快速大语言模型推理服务,帮助开发者集成 Cerebras 的 API,面向需要最快令牌生成速度的应用场景,例如实时聊天、代码补全和交互式 AI 体验。

0 下载

介绍来源: third_party · TerminalSkills · 1.0.0 参考来源

SkillPi 解读

能完成的任务
翻译待完成,请参阅来源文档。
实测状态
未测试

文件浏览

在原站浏览文件 ↗

原始 SKILL.md

打开原文 ↗
Frontmatter
name: cerebras
description: Expert guidance for Cerebras Inference, the ultra-fast LLM inference service powered by the world's largest chip (Wafer-Scale Engine). Helps developers integrate Cerebras' API for applications requiring the fastest possible token generation — real-time chat, code completion, and interactive AI experiences.
license: Apache-2.0
compatibility: No special requirements
metadata:
  author: terminal-skills
  version: 1.0.0
  category: data-ai
  tags:
  - llm
  - inference
  - api
  - fast-inference
  - wafer-scale

Cerebras — Wafer-Scale LLM Inference

Overview

Cerebras Inference, the ultra-fast LLM inference service powered by the world's largest chip (Wafer-Scale Engine). Helps developers integrate Cerebras' API for applications requiring the fastest possible token generation — real-time chat, code completion, and interactive AI experiences.

Instructions

Chat Completions

// src/llm/cerebras.ts — Cerebras API (OpenAI-compatible)
import OpenAI from "openai";

const cerebras = new OpenAI({
  apiKey: process.env.CEREBRAS_API_KEY!,
  baseURL: "https://api.cerebras.ai/v1",
});

// Basic completion — up to 2000+ tokens/second
async function chat(prompt: string) {
  const response = await cerebras.chat.completions.create({
    model: "llama3.3-70b",                // Llama 3.3 70B on Cerebras hardware
    messages: [
      { role: "system", content: "You are a helpful coding assistant." },
      { role: "user", content: prompt },
    ],
    temperature: 0.7,
    max_tokens: 1024,
    top_p: 1,
  });

  // Response includes usage with Cerebras-specific speed metrics
  console.log(`Tokens/sec: ${response.usage?.completion_tokens! / (response.usage as any).completion_time}`);

  return response.choices[0].message.content;
}

// Streaming — first token in <200ms
async function streamChat(prompt: string, onChunk: (text: string) => void) {
  const stream = await cerebras.chat.completions.create({
    model: "llama3.3-70b",
    messages: [{ role: "user", content: prompt }],
    stream: true,
  });

  let full = "";
  for await (const chunk of stream) {
    const text = chunk.choices[0]?.delta?.content ?? "";
    full += text;
    onChunk(text);
  }
  return full;
}

// JSON mode
async function structuredOutput(prompt: string) {
  const response = await cerebras.chat.completions.create({
    model: "llama3.3-70b",
    messages: [{ role: "user", content: prompt }],
    response_format: { type: "json_object" },
    temperature: 0,
  });
  return JSON.parse(response.choices[0].message.content!);
}

Tool Use / Function Calling

async function chatWithTools(prompt: string) {
  const response = await cerebras.chat.completions.create({
    model: "llama3.3-70b",
    messages: [{ role: "user", content: prompt }],
    tools: [
      {
        type: "function",
        function: {
          name: "get_stock_price",
          description: "Get the current stock price for a ticker symbol",
          parameters: {
            type: "object",
            properties: {
              ticker: { type: "string", description: "Stock ticker (e.g., AAPL)" },
            },
            required: ["ticker"],
          },
        },
      },
    ],
    tool_choice: "auto",
  });

  const msg = response.choices[0].message;
  if (msg.tool_calls) {
    // Execute the tool and send results back
    const toolResults = await Promise.all(
      msg.tool_calls.map(async (call) => {
        const args = JSON.parse(call.function.arguments);
        const result = await executeFunction(call.function.name, args);
        return {
          role: "tool" as const,
          tool_call_id: call.id,
          content: JSON.stringify(result),
        };
      })
    );

    // Get final response with tool results
    const final = await cerebras.chat.completions.create({
      model: "llama3.3-70b",
      messages: [
        { role: "user", content: prompt },
        msg,
        ...toolResults,
      ],
    });
    return final.choices[0].message.content;
  }

  return msg.content;
}

Python Integration

# src/cerebras_client.py — Cerebras with Python
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["CEREBRAS_API_KEY"],
    base_url="https://api.cerebras.ai/v1",
)

# Chat completion
response = client.chat.completions.create(
    model="llama3.3-70b",
    messages=[{"role": "user", "content": "Write a Python quicksort implementation"}],
    temperature=0.3,
    max_tokens=500,
)
print(response.choices[0].message.content)

# Streaming
stream = client.chat.completions.create(
    model="llama3.3-70b",
    messages=[{"role": "user", "content": "Explain transformers in 5 sentences"}],
    stream=True,
)
for chunk in stream:
    print(chunk.choices[0].delta.content or "", end="", flush=True)

Available Models

## Cerebras Models
- **llama3.3-70b** — Llama 3.3 70B, best quality, ~2000 tok/s output
- **llama3.1-8b** — Llama 3.1 8B, fastest option, ~2500+ tok/s output
- **llama3.1-70b** — Llama 3.1 70B, large context (128K tokens)

## Speed Comparison (approximate)
- Cerebras: 2000+ tok/s (70B model)
- Groq: 300-400 tok/s (70B model)
- Cloud GPU (A100): 50-80 tok/s (70B model)
- Local (M3 Max): 20-40 tok/s (70B quantized)

Installation

# Use any OpenAI-compatible SDK
npm install openai
pip install openai

# Set base_url to https://api.cerebras.ai/v1

Examples

Example 1: Setting up an evaluation pipeline for a RAG application

User request:

I have a RAG chatbot that answers questions from our docs. Set up Cerebras to evaluate answer quality.

The agent creates an evaluation suite with appropriate metrics (faithfulness, relevance, answer correctness), configures test datasets from real user questions, runs baseline evaluations, and sets up CI integration so evaluations run on every prompt or retrieval change.

Example 2: Comparing model performance across prompts

User request:

We're testing GPT-4o vs Claude on our customer support prompts. Set up a comparison with Cerebras.

The agent creates a structured experiment with the existing prompt set, configures both model providers, defines scoring criteria specific to customer support (accuracy, tone, completeness), runs the comparison, and generates a summary report with statistical significance indicators.

Guidelines

  1. Use for latency-critical applications — Cerebras is the fastest inference available; ideal for real-time chat and autocomplete
  2. OpenAI SDK drop-in — Change base URL from OpenAI to Cerebras; your code works unchanged
  3. 8B for simple tasks — Use llama3.1-8b for classification, extraction, and simple Q&A; save 70B for complex reasoning
  4. Stream everything — First-token latency is <200ms; streaming gives users instant feedback
  5. JSON mode for structured output — Use response_format: { type: "json_object" } for reliable parsing
  6. Batch simple requests — For bulk processing, send multiple independent prompts in parallel
  7. Monitor rate limits — Free tier has request limits; check headers for remaining quota
  8. Fallback strategy — Have a fallback to Groq or OpenAI; Cerebras can have capacity constraints during high demand

当前收录版本

1.0.0

核对来源版本 ↗

质量评测

满分100 · 来自 SkillPi LAB 实验室的评测报告。

场景价值85/100

亮点

  • 提供 Cerebras Inference API 的完整集成方案
  • 覆盖实时聊天、代码补全等高频刚需场景
  • 包含 TypeScript 和 Python 双语言示例
触发精准90/100

亮点

  • 触发词精准覆盖 Cerebras 核心功能
  • description 清晰描述目标用户和使用场景
  • 边界清晰不易误触
结构规范95/100

待提升项

  • 缺少 When to Use 显式章节 原报告严重程度:轻微

    文档包含 Guidelines 但未使用标准 When to Use 章节名

    改进建议:建议将 Guidelines 章节重命名为 When to Use 以符合规范

亮点

  • 结构完整:Overview → Instructions → Examples → Guidelines
  • 提供端到端代码示例(TypeScript/Python)
  • frontmatter 元数据完整规范
执行可靠90/100

亮点

  • API 参数配置正确(baseURL, model names)
  • 覆盖 streaming、tool use、JSON mode 等关键场景
  • 提供速率限制监控和 fallback 策略建议
证据可验 (前四项均值)90/100

取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。

正文静态检测

100 / 100 · skillpi-20261123-no-r3-v1

正文未命中当前规则。

分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。

权限与使用前检查

根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。

  • 安装或获取外部依赖

    使用官方来源并锁定版本,在隔离环境检查安装脚本。当前文档检查不覆盖后续下载的代码。

    主文档提及 · 第 194, 195 行
  • 账号、密钥或授权

    使用专用、最小权限账号,不把密钥粘贴到公开内容或命令日志;核对接收数据的服务与租户。

    主文档提及 · 第 36, 152 行
文档引用的域名或地址

这些地址可能用于文档链接或示例,不是已批准的联网清单。使用前核对实际目的地及发送的数据。

  • api.cerebras.ai

本站展示提示不会授予权限。涉及文件改动、密钥、外部发送或费用时,仍由你使用的工具按需确认。

安全评级与访问范围

safe · 静态证据核验,不代表运行安全保证。

使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。