AGENT SKILL

mistral-core-workflow-b

Execute Mistral AI secondary workflows: Embeddings and Function Calling. Use when implementing semantic search, RAG applications, or tool-augmented LLM interactions. Trigger with phrases like "mistral embeddings", "mistral function calling", "mistral tools", "mistral RAG", "mistral semantic search".

License 许可
MIT
最近更新
2026-05-26
Stars
★ 0
Forks
0

01 前言 Front Matter

name
mistral-core-workflow-b
author
Jeremy Longshore <jeremy@intentsolutions.io>
license
MIT
version
1.0.0
description
Execute Mistral AI secondary workflows: Embeddings and Function Calling. Use when implementing semantic search, RAG applications, or tool-augmented LLM interactions. Trigger with phrases like "mistral embeddings", "mistral function calling", "mistral tools", "mistral RAG", "mistral semantic search".
allowed-tools
Read, Write, Edit, Bash(npm:*), Grep
compatible-with
claude-code, codex, openclaw

02 资源文件 1

03 SKILL.md 正文

Mistral AI Core Workflow B: Embeddings & Function Calling

Table of Contents

Overview

Secondary workflows for Mistral AI: text embeddings for semantic search/RAG and function calling for tool-augmented interactions. Uses mistral-embed (1024 dimensions) for embeddings and mistral-large-latest for function calling.

Prerequisites

  • Completed mistral-install-auth setup
  • Familiarity with mistral-core-workflow-a
  • Valid API credentials configured

Instructions

Step 1: Generate Text Embeddings

Use client.embeddings.create() with model mistral-embed and inputs array. Returns 1024-dimensional vectors per input text.

Step 2: Batch Embeddings

Pass multiple texts in the inputs array for efficient batch processing. Map response data array to extract embedding vectors.

Step 3: Build Semantic Search

Implement SemanticSearch class with indexDocuments() (embeds all docs) and search() (embeds query, ranks by cosine similarity, returns top-K results). Use cosine similarity: dot product divided by product of norms.

Step 4: Define Function Tools

Create tool definitions with JSON Schema parameters. Each tool has type function, name, description, and parameter schema with required fields.

Step 5: Implement Function Calling Loop

Send messages with tools and toolChoice: 'auto' to client.chat.complete(). Check for toolCalls in response. Execute matching tool function, add result as role: 'tool' message, and loop until model returns final text response.

Step 6: Build RAG Pipeline

Combine semantic search with chat completion. Retrieve relevant documents for user query, inject as context in system prompt, generate response with mistral-small-latest. Instruct model to answer from context only.

Output

  • Text embeddings with mistral-embed (1024 dimensions)
  • Semantic search with cosine similarity ranking
  • Function calling with tool execution loop
  • RAG chat combining retrieval and generation

Error Handling

Issue Cause Resolution
Empty embeddings Invalid input text Validate non-empty strings before API call
Tool not found Unknown function name Check tool registry matches definitions
RAG hallucination Insufficient context Add more documents, tune retrieval top-K
High latency Large batch size Split into smaller batches, add concurrency

Examples

Embeddings

const response = await client.embeddings.create({
  model: 'mistral-embed',
  inputs: ['Machine learning is fascinating.'],
});
console.log(`Dimensions: ${response.data[0].embedding.length}`); // 1024  # 1024: 1 KB

Function Calling

const response = await client.chat.complete({
  model: 'mistral-large-latest',
  messages: [{ role: 'user', content: 'Weather in Paris?' }],
  tools, toolChoice: 'auto',
});

See detailed implementation for advanced patterns.

Resources

04 同仓库更多 Skills

SamuelChien
SamuelChien/mega-skills-collection

zustand-store-ts

Create Zustand stores with TypeScript, subscribeWithSelector middleware, and proper state/action separation. Use when building React state management, creating global stores, or implementing reactive state patterns with Zustand.

★ 0
SamuelChien
SamuelChien/mega-skills-collection

zustand-store-creator

Zustand Store Creator - Auto-activating skill for Frontend Development. Triggers on: zustand store creator, zustand store creator Part of the Frontend Development skill category.

★ 0
SamuelChien
SamuelChien/mega-skills-collection

zero-trust-config-helper

Zero Trust Config Helper - Auto-activating skill for Security Advanced. Triggers on: zero trust config helper, zero trust config helper Part of the Security Advanced skill category.

★ 0
SamuelChien
SamuelChien/mega-skills-collection

zapier-integration-helper

Zapier Integration Helper - Auto-activating skill for Business Automation. Triggers on: zapier integration helper, zapier integration helper Part of the Business Automation skill category.

★ 0
SamuelChien
SamuelChien/mega-skills-collection

zai-cli

Execute z.AI CLI providing vision, search, reader, and GitHub exploration via CLI and MCP. Use when user needs image/video analysis, OCR, UI-to-code conversion, error diagnosis, real-time web search, web page to markdown extraction, or GitHub code exploration. Trigger with phrases like "analyze this image", "search the web for", "read this page", "explore this repo", or "use zai". Requires Z_AI_API_KEY.

★ 0
SamuelChien
SamuelChien/mega-skills-collection

yt-research

Research competitor YouTube channels, niches, and trending topics for your content strategy. Use this skill whenever the user says "research channels", "analyze competitors", "find trending topics", "niche analysis", "competitive research", "what are other creators doing", "scrape YouTube channels", or wants to understand the competitive landscape for a specific tool or topic area. Use when working with yt research. Trigger with 'yt', 'research'.

★ 0