Skip to main content ホーム クリエイター jeremylongshore tons-of-skills-marketplace mistral-core-workflow-b
mistral-core-workflow-b Execute Mistral AI embeddings, function calling, and RAG pipelines.
Use when implementing semantic search, RAG applications,
tool-augmented LLM interactions, or code embeddings.
Trigger with phrases like "mistral embeddings", "mistral function calling",
"mistral tools", "mistral RAG", "mistral semantic search".
インストールへ移動 Skills Marketplace コミュニティが作成したAIスキルを発見・探索
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
直接コマンドでは確認用 Prompt が省略されます。実行前にソースを確認してください。
npx skills add https://github.com/jeremylongshore/tons-of-skills-marketplace --skill mistral-core-workflow-bコマンドは1行のまま表示されます。コピー前に横へスクロールして全体を確認してください。
ローカルで確認しますか?SkillsMP が現在取得できるファイルをダウンロードできます。
Zipをダウンロード ダウンロード中... このリポジトリの他の Skills langchain-deploy-integration Deploy a LangChain 1.0 / LangGraph 1.0 app to Cloud Run, Vercel, or LangServe correctly — with timeouts sized for chain length, cold-start mitigation, SSE anti-buffering headers, and Secret Manager over .env. Use when prepping a first production deploy, debugging a stream that hangs behind a proxy, or diagnosing p99 latency spikes. Trigger with "langchain deploy", "langchain cloud run", "langchain vercel python", "langchain langserve", or "langchain docker".
langchain-langgraph-agents Build a correct LangGraph 1.0 ReAct agent with create_react_agent — typed tools, error propagation, recursion caps, and stop conditions that actually stop. Use when writing a first tool-calling agent, migrating from AgentExecutor or initialize_agent, or diagnosing an agent that loops on vague prompts. Trigger with "langgraph agent", "create_react_agent", "langgraph tool calling", "AgentExecutor migration", or "agent loop cost".
langchain-langgraph-human-in-loop Build LangGraph 1.0 human-in-the-loop approval flows with interrupt_before /
interrupt_after and Command(resume=...) — JSON-serializable state, clean
resume semantics, and UI wiring for approval decisions. Use when adding an
approval gate before an expensive tool call, wiring a Slack/web UI for agent
approvals, or debugging a graph that crashes on interrupt.
Trigger with "langgraph human in loop", "langgraph interrupt_before",
"langgraph approval flow", "Command resume", "langgraph HITL".
name mistral-core-workflow-b description Execute Mistral AI embeddings, function calling, and RAG pipelines.
Use when implementing semantic search, RAG applications,
tool-augmented LLM interactions, or code embeddings.
Trigger with phrases like "mistral embeddings", "mistral function calling",
"mistral tools", "mistral RAG", "mistral semantic search".
allowed-tools Read, Write, Edit, Bash(npm:*), Grep version 1.12.0 license MIT author Jeremy Longshore <jeremy@intentsolutions.io> tags ["saas","mistral","llm","embeddings","workflow"] compatibility Designed for Claude Code
Mistral AI Core Workflow B: Embeddings & Function Calling
Overview
Secondary workflows for Mistral AI: text/code embeddings with mistral-embed (1024 dimensions), function calling (tool use) with any chat model, and RAG pipeline combining both. Mistral supports auto, any, and none tool choice modes.
Prerequisites
Completed mistral-install-auth setup
MISTRAL_API_KEY environment variable set
Familiarity with mistral-core-workflow-a
Instructions
Step 1: Generate Text Embeddings
import { Mistral } from '@mistralai/mistralai' ;
const client = new Mistral ({ apiKey : process.env .MISTRAL_API_KEY });
const response = await client.embeddings .create ({
model : 'mistral-embed' ,
inputs : ['Machine learning is fascinating.' ],
});
const vector = response.data [0 ].embedding ;
console .log (`Dimensions: ${vector.length} ` );
console .log (`Tokens used: ${response.usage.totalTokens} ` );
Step 2: Batch Embeddings with Rate Awareness
async function ( ): < [][]> {
: [][] = [];
( i = ; i < texts. ; i += batchSize) {
batch = texts. (i, i + batchSize);
response = client. . ({
: ,
: batch,
});
allEmbeddings. (...response. . ( d. ));
}
allEmbeddings;
}
docs = [ , , ];
embeddings = (docs);
batchEmbed
texts : string [],
batchSize = 64 ,
Promise
number
const
allEmbeddings
number
for
let
0
length
const
slice
const
await
embeddings
create
model
'mistral-embed'
inputs
push
data
map
d =>
embedding
return
const
'doc1...'
'doc2...'
const
await
batchEmbed
Step 3: Semantic Search with Cosine Similarity function cosineSimilarity (a : number [], b : number [] ): number {
let dot = 0 , normA = 0 , normB = 0 ;
for (let i = 0 ; i < a.length ; i++) {
dot += a[i] * b[i];
normA += a[i] * a[i];
normB += b[i] * b[i];
}
return dot / (Math .sqrt (normA) * Math .sqrt (normB));
}
class SemanticSearch {
private documents : Array <{ text : string ; embedding : number [] }> = [];
private client : Mistral ;
constructor ( ) {
this .client = new Mistral ({ apiKey : process.env .MISTRAL_API_KEY });
}
async index (texts : string []): Promise <void > {
const response = await this .client .embeddings .create ({
model : 'mistral-embed' ,
inputs : texts,
});
this .documents = texts.map ((text, i ) => ({
text,
embedding : response.data [i].embedding ,
}));
}
async search (query : string , topK = 5 ): Promise <Array <{ text : string ; score : number }>> {
const qEmbed = await this .client .embeddings .create ({
model : 'mistral-embed' ,
inputs : [query],
});
const qVec = qEmbed.data [0 ].embedding ;
return this .documents
.map (doc => ({ text : doc.text , score : cosineSimilarity (qVec, doc.embedding ) }))
.sort ((a, b ) => b.score - a.score )
.slice (0 , topK);
}
}
Step 4: Function Calling (Tool Use)
const tools = [
{
type : 'function' as const ,
function : {
name : 'get_weather' ,
description : 'Get current weather for a city' ,
parameters : {
type : 'object' ,
properties : {
city : { type : 'string' , description : 'City name (e.g., "Paris")' },
units : { type : 'string' , enum : ['celsius' , 'fahrenheit' ], default : 'celsius' },
},
required : ['city' ],
},
},
},
{
type : 'function' as const ,
function : {
name : 'search_database' ,
description : 'Search product database by query' ,
parameters : {
type : 'object' ,
properties : {
query : { type : 'string' },
limit : { type : 'integer' , default : 10 },
},
required : ['query' ],
},
},
},
];
const response = await client.chat .complete ({
model : 'mistral-large-latest' ,
messages : [{ role : 'user' , content : "What's the weather in Paris?" }],
tools,
toolChoice : 'auto' ,
});
Step 5: Tool Execution Loop
const toolRegistry : Record <string , (args : any ) => Promise <any >> = {
get_weather : async ({ city, units }) => ({ city, temp : 22 , units : units ?? 'celsius' }),
search_database : async ({ query, limit }) => ({ results : [], total : 0 }),
};
async function chatWithTools (userMessage : string ): Promise <string > {
const messages : any [] = [{ role : 'user' , content : userMessage }];
while (true ) {
const response = await client.chat .complete ({
model : 'mistral-large-latest' ,
messages,
tools,
toolChoice : 'auto' ,
});
const choice = response.choices ?.[0 ];
if (!choice) throw new Error ('No response from model' );
if (choice.message .toolCalls ?.length ) {
messages.push (choice.message );
for (const call of choice.message .toolCalls ) {
const fn = toolRegistry[call.function .name ];
if (!fn) throw new Error (`Unknown tool: ${call.function .name} ` );
const args = JSON .parse (call.function .arguments );
const result = await fn (args);
messages.push ({
role : 'tool' ,
name : call.function .name ,
content : JSON .stringify (result),
toolCallId : call.id ,
});
}
continue ;
}
return choice.message .content ?? '' ;
}
}
Step 6: RAG Pipeline (Retrieval-Augmented Generation) async function ragChat (
query : string ,
searcher : SemanticSearch ,
topK = 3 ,
): Promise <{ answer : string ; sources : string [] }> {
const results = await searcher.search (query, topK);
const context = results.map ((r, i ) => `[${i + 1 } ] ${r.text} ` ).join ('\n\n' );
const response = await client.chat .complete ({
model : 'mistral-small-latest' ,
messages : [
{
role : 'system' ,
content : `Answer based ONLY on the provided context. Cite sources as [1], [2], etc. If the context doesn't contain the answer, say "I don't have enough information."` ,
},
{
role : 'user' ,
content : `Context:\n${context} \n\nQuestion: ${query} ` ,
},
],
temperature : 0.1 ,
});
return {
answer : response.choices ?.[0 ]?.message ?.content ?? '' ,
sources : results.map (r => r.text ),
};
}
Output
Text embeddings with mistral-embed (1024 dimensions)
Semantic search with cosine similarity ranking
Function calling with tool execution loop
RAG pipeline 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 tool definitions Infinite tool loop Model keeps calling tools Add max iteration count (e.g., 10) RAG hallucination Insufficient context Add more documents, increase topK 400 Bad RequestMissing toolCallId Each tool result must include the matching toolCallId
Resources
Next Steps For SDK patterns, see mistral-sdk-patterns. For agents, see mistral-webhooks-events.