Assembly: minions
Filename: mistral.py
Author: Terry D. Eppler
Created: 09-05-2026
Last Modified By: Terry D. Eppler
Last Modified On: 09-06-2026
mistral.py
Copyright © 2026 Terry D. Eppler
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the “Software”), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
You can contact me at: terryeppler@gmail.com or eppler.terry@epa.gov
Mistral AI Minion implementations.
AggregatedChoice
Bases: TypedDict
Relevant choice data from the stream accumulator.
Purpose
Describes the aggregated assistant message used to continue a tool turn.
Attributes:
| Name |
Type |
Description |
message |
dict[str, object]
|
Accumulated assistant message fields.
|
AggregatedResponse
Bases: TypedDict
Relevant response data from the stream accumulator.
Purpose
Describes completion choices produced by the native accumulator.
Attributes:
Minion(model: str, instructions: str, tools: Sequence[MistralTool] | None = None, functions: Sequence[ToolFunction] | None = None, max_turns: int = 10, name: str | None = None)
Mistral workflow agent with client-managed local tool execution.
Purpose
Orchestrates provider-native model turns and dispatches registered Fonky or
other local functions while preserving native responses and hosted tools.
Attributes:
| Name |
Type |
Description |
minion_name |
str
|
Default specialization name.
|
name |
str
|
|
model |
str
|
Provider model identifier.
|
instructions |
str
|
|
tools |
list[MistralTool]
|
Native tool declarations.
|
functions |
dict[str, ToolFunction]
|
Registered local callables by name.
|
max_turns |
int
|
Maximum model turns per execution.
|
api_key |
str
|
Centralized provider credential.
|
prompt |
str
|
Most recently accepted user prompt.
|
client |
Mistral
|
|
provider |
Agent
|
|
tool |
MistralTool | None
|
Most recently inspected tool declaration.
|
tool_calls |
Sequence[ToolCall]
|
Most recent local tool requests.
|
result |
ChatCompletionResponse | AssistantMessage | None
|
|
Initialize a Mistral Minion.
Purpose
Stores configuration, registers native schemas and matching local functions,
and initializes the provider client and remote agent.
Parameters:
| Name |
Type |
Description |
Default |
model
|
str
|
Nonblank provider model identifier.
|
required
|
instructions
|
str
|
Nonblank system instructions.
|
required
|
tools
|
Sequence[MistralTool] | None
|
Optional native tool declarations.
|
None
|
functions
|
Sequence[ToolFunction] | None
|
Optional matching local callables.
|
None
|
max_turns
|
int
|
Positive model-turn limit; defaults to 10.
|
10
|
name
|
str | None
|
Optional nonblank display name.
|
None
|
Returns:
| Name | Type |
Description |
None |
None
|
Initializes the provider workflow agent.
|
Raises:
| Type |
Description |
ValueError
|
If required configuration, tool correspondence or limits are invalid.
|
TypeError
|
If tool or callable collections are invalid.
|
Source code in mistral.py
| def __init__( self, model: str, instructions: str, tools: Sequence[ MistralTool ] | None=None, functions: Sequence[ ToolFunction ] | None=None, max_turns: int=10, name: str | None=None ) -> None:
"""Initialize a Mistral Minion.
Purpose:
Stores configuration, registers native schemas and matching local functions,
and initializes the provider client and remote agent.
Args:
model (str): Nonblank provider model identifier.
instructions (str): Nonblank system instructions.
tools (Sequence[MistralTool] | None): Optional native tool declarations.
functions (Sequence[ToolFunction] | None): Optional matching local callables.
max_turns (int): Positive model-turn limit; defaults to 10.
name (str | None): Optional nonblank display name.
Returns:
None: Initializes the provider workflow agent.
Raises:
ValueError: If required configuration, tool correspondence or limits are invalid.
TypeError: If tool or callable collections are invalid.
"""
if not isinstance( model, str ) or not model.strip( ):
raise ValueError( 'Argument "model" must be a nonblank string!' )
if not isinstance( instructions, str ) or not instructions.strip( ):
raise ValueError( 'Argument "instructions" must be a nonblank string!' )
if type( max_turns ) is not int or max_turns < 1:
raise ValueError( 'Argument "max_turns" must be a positive integer!' )
self.name = self.minion_name if name is None else name
if not isinstance( self.name, str ) or not self.name.strip( ):
raise ValueError( 'Argument "name" must be a nonblank string!' )
if tools is not None and (not isinstance( tools, Sequence ) or isinstance( tools, (str, bytes, bytearray) )):
raise TypeError( 'Argument "tools" must be a sequence of native tools!' )
if functions is not None and (not isinstance( functions, Sequence ) or isinstance( functions, (str, bytes, bytearray) )):
raise TypeError( 'Argument "functions" must be a sequence of callables!' )
self.model = model
self.instructions = instructions
self.tools = list( tools ) if tools is not None else [ ]
function_list = list( functions ) if functions is not None else [ ]
if not all( callable( function ) for function in function_list ):
raise TypeError( 'Argument "functions" must contain callables!' )
self.functions = { function.__name__: function for function in function_list }
if len( self.functions ) != len( function_list ):
raise ValueError( 'Argument "functions" must contain unique names!' )
self.max_turns = max_turns
self.api_key = cfg.MISTRAL_API_KEY
self.prompt = ''
self.result = None
self.tool = None
self.tool_calls = [ ]
self.validate_tools( )
if not self.api_key.strip( ):
raise ValueError( 'Configuration "MISTRAL_API_KEY" cannot be empty!' )
self.client = Mistral( api_key=self.api_key )
self.provider = self.create( )
|
Read a local function-tool name.
Purpose
Distinguishes typed local declarations from native hosted tools without reflection.
Parameters:
| Name |
Type |
Description |
Default |
tool
|
MistralTool
|
Native model or dictionary schema.
|
required
|
Returns:
| Type |
Description |
str | None
|
str | None: Local function name, or None for a hosted declaration.
|
Raises:
| Type |
Description |
Error
|
If validation or execution fails.
|
Source code in mistral.py
| def get_tool_name( self, tool: MistralTool ) -> str | None:
"""Read a local function-tool name.
Purpose:
Distinguishes typed local declarations from native hosted tools without reflection.
Args:
tool (MistralTool): Native model or dictionary schema.
Returns:
str | None: Local function name, or None for a hosted declaration.
Raises:
Error: If validation or execution fails.
"""
try:
throw_if( 'tool', tool )
self.tool = tool
if isinstance( self.tool, dict ):
if self.tool.get( 'type' ) != 'function':
return None
function = self.tool.get( 'function' )
if not isinstance( function, dict ):
raise TypeError( 'Mistral function tool requires a function object!' )
name = function.get( 'name' )
elif isinstance( self.tool, FunctionTool ):
name = self.tool.function.name
elif isinstance( self.tool, (CodeInterpreterTool, CustomConnector, DocumentLibraryTool, ImageGenerationTool, WebSearchTool, WebSearchPremiumTool) ):
return None
else:
raise TypeError( 'Argument "tool" must be a native Mistral tool!' )
throw_if( 'tool.function.name', name )
if not isinstance( name, str ):
raise TypeError( 'Mistral function name must be a string!' )
return name
except Error:
raise
except Exception as e:
if 'fonky.boogr' in sys.modules and isinstance( e, sys.modules[ 'fonky.boogr' ].Error ):
raise
exception = Error( e )
exception.module = 'mistral'
exception.cause = 'Minion'
exception.method = 'get_tool_name( self, tool: MistralTool ) -> str | None'
Logger( ).write( exception )
raise exception
|
Validate exact schema-to-callable pairing.
Purpose
Retains native hosted tools and enforces matching local callable names.
Returns:
| Name | Type |
Description |
None |
None
|
Validates registered declarations.
|
Source code in mistral.py
| def validate_tools( self ) -> None:
"""Validate exact schema-to-callable pairing.
Purpose:
Retains native hosted tools and enforces matching local callable names.
Returns:
None: Validates registered declarations.
"""
names = [ name for tool in self.tools if ( name := self.get_tool_name( tool ) ) is not None ]
if len( names ) != len( set( names ) ):
raise ValueError( 'Argument "tools" must contain unique function names!' )
missing = sorted( set( names ).difference( self.functions ) )
extra = sorted( set( self.functions ).difference( names ) )
if missing or extra:
raise ValueError( f'Mistral tools and functions must match exactly; missing={missing}, extra={extra}!' )
|
create() -> Agent
Create the remote Mistral agent.
Purpose
Creates the native remote resource using configured members.
Returns:
| Name | Type |
Description |
Agent |
Agent
|
Native remote agent resource.
|
Raises:
| Type |
Description |
Error
|
If validation or execution fails.
|
Source code in mistral.py
| def create( self ) -> Agent:
"""Create the remote Mistral agent.
Purpose:
Creates the native remote resource using configured members.
Returns:
Agent: Native remote agent resource.
Raises:
Error: If validation or execution fails.
"""
try:
return self.client.beta.agents.create( name=self.name, model=self.model, instructions=self.instructions, tools=self.tools or None )
except Error:
raise
except Exception as e:
if 'fonky.boogr' in sys.modules and isinstance( e, sys.modules[ 'fonky.boogr' ].Error ):
raise
exception = Error( e )
exception.module = 'mistral'
exception.cause = 'Minion'
exception.method = 'create( self ) -> Agent'
Logger( ).write( exception )
raise exception
|
run(prompt: str) -> ChatCompletionResponse
Execute the Mistral workflow.
Purpose
Continues native model turns until local tools finish or the turn limit is reached.
Parameters:
| Name |
Type |
Description |
Default |
prompt
|
str
|
|
required
|
Returns:
| Name | Type |
Description |
ChatCompletionResponse |
ChatCompletionResponse
|
|
Raises:
| Type |
Description |
Error
|
If validation or execution fails.
|
Source code in mistral.py
| def run( self, prompt: str ) -> ChatCompletionResponse:
"""Execute the Mistral workflow.
Purpose:
Continues native model turns until local tools finish or the turn limit is reached.
Args:
prompt (str): Nonblank user input.
Returns:
ChatCompletionResponse: Final native completion.
Raises:
Error: If validation or execution fails.
"""
try:
throw_if( 'prompt', prompt )
if not isinstance( prompt, str ):
raise TypeError( 'Argument "prompt" must be a string!' )
self.prompt = prompt
self.result = None
messages: list[ MistralMessage ] = [ UserMessage( content=self.prompt ) ]
for _ in range( self.max_turns ):
result = self.client.agents.complete( agent_id=self.provider.id, messages=messages )
self.result = result
message = result.choices[ 0 ].message
tool_calls = message.tool_calls or [ ]
if not tool_calls:
return result
messages.append( message )
messages.extend( self.execute_tools( tool_calls ) )
raise RuntimeError( f'Mistral workflow exceeded {self.max_turns} model turns!' )
except Error:
raise
except Exception as e:
if 'fonky.boogr' in sys.modules and isinstance( e, sys.modules[ 'fonky.boogr' ].Error ):
raise
exception = Error( e )
exception.module = 'mistral'
exception.cause = 'Minion'
exception.method = 'run( self, prompt: str ) -> ChatCompletionResponse'
Logger( ).write( exception )
raise exception
|
run_async(prompt: str) -> ChatCompletionResponse
async
Execute the Mistral workflow.
Purpose
Continues native model turns until local tools finish or the turn limit is reached.
Parameters:
| Name |
Type |
Description |
Default |
prompt
|
str
|
|
required
|
Returns:
| Name | Type |
Description |
ChatCompletionResponse |
ChatCompletionResponse
|
|
Raises:
| Type |
Description |
Error
|
If validation or execution fails.
|
Source code in mistral.py
| async def run_async( self, prompt: str ) -> ChatCompletionResponse:
"""Execute the Mistral workflow.
Purpose:
Continues native model turns until local tools finish or the turn limit is reached.
Args:
prompt (str): Nonblank user input.
Returns:
ChatCompletionResponse: Final native completion.
Raises:
Error: If validation or execution fails.
"""
try:
throw_if( 'prompt', prompt )
if not isinstance( prompt, str ):
raise TypeError( 'Argument "prompt" must be a string!' )
self.prompt = prompt
self.result = None
messages: list[ MistralMessage ] = [ UserMessage( content=self.prompt ) ]
for _ in range( self.max_turns ):
result = await self.client.agents.complete_async( agent_id=self.provider.id, messages=messages )
self.result = result
message = result.choices[ 0 ].message
tool_calls = message.tool_calls or [ ]
if not tool_calls:
return result
messages.append( message )
messages.extend( await self.execute_tools_async( tool_calls ) )
raise RuntimeError( f'Mistral workflow exceeded {self.max_turns} model turns!' )
except Error:
raise
except Exception as e:
if 'fonky.boogr' in sys.modules and isinstance( e, sys.modules[ 'fonky.boogr' ].Error ):
raise
exception = Error( e )
exception.module = 'mistral'
exception.cause = 'Minion'
exception.method = 'run_async( self, prompt: str ) -> ChatCompletionResponse'
Logger( ).write( exception )
raise exception
|
stream(prompt: str) -> Iterator[CompletionEvent]
Start a streamed Mistral workflow.
Purpose
Delegates validation and the complete streaming lifecycle to stream_events.
Parameters:
| Name |
Type |
Description |
Default |
prompt
|
str
|
|
required
|
Returns:
| Type |
Description |
Iterator[CompletionEvent]
|
Iterator[CompletionEvent]: Native streamed events.
|
Source code in mistral.py
| def stream( self, prompt: str ) -> Iterator[ CompletionEvent ]:
"""Start a streamed Mistral workflow.
Purpose:
Delegates validation and the complete streaming lifecycle to stream_events.
Args:
prompt (str): Nonblank user input.
Returns:
Iterator[CompletionEvent]: Native streamed events.
"""
return self.stream_events( prompt )
|
stream_events(prompt: str) -> Iterator[CompletionEvent]
Execute the Mistral workflow.
Purpose
Continues native model turns until local tools finish or the turn limit is reached.
Parameters:
| Name |
Type |
Description |
Default |
prompt
|
str
|
|
required
|
Yields:
| Name | Type |
Description |
CompletionEvent |
CompletionEvent
|
|
Raises:
| Type |
Description |
Error
|
If validation or execution fails.
|
Source code in mistral.py
| def stream_events( self, prompt: str ) -> Iterator[ CompletionEvent ]:
"""Execute the Mistral workflow.
Purpose:
Continues native model turns until local tools finish or the turn limit is reached.
Args:
prompt (str): Nonblank user input.
Yields:
CompletionEvent: Native streamed event.
Raises:
Error: If validation or execution fails.
"""
try:
throw_if( 'prompt', prompt )
if not isinstance( prompt, str ):
raise TypeError( 'Argument "prompt" must be a string!' )
self.prompt = prompt
self.result = None
messages: list[ MistralMessage ] = [ UserMessage( content=self.prompt ) ]
for _ in range( self.max_turns ):
chunks: list[ CompletionChunk ] = [ ]
for event in self.client.agents.stream( agent_id=self.provider.id, messages=messages ):
chunks.append( event.data )
yield event
if not chunks:
raise RuntimeError( 'Mistral streaming returned no completion chunks!' )
aggregate = cast( AggregatedResponse, accumulate_chunks_to_response_dict( chunks ) )
message = AssistantMessage.model_validate( aggregate[ 'choices' ][ 0 ][ 'message' ] )
self.result = message
tool_calls = message.tool_calls or [ ]
if not tool_calls:
return
messages.append( message )
messages.extend( self.execute_tools( tool_calls ) )
raise RuntimeError( f'Mistral workflow exceeded {self.max_turns} model turns!' )
except Error:
raise
except Exception as e:
if 'fonky.boogr' in sys.modules and isinstance( e, sys.modules[ 'fonky.boogr' ].Error ):
raise
exception = Error( e )
exception.module = 'mistral'
exception.cause = 'Minion'
exception.method = 'stream_events( self, prompt: str ) -> Iterator[ CompletionEvent ]'
Logger( ).write( exception )
raise exception
|
Execute local Mistral tool calls.
Purpose
Dispatches registered local functions and returns correlated tool-result messages.
Parameters:
| Name |
Type |
Description |
Default |
tool_calls
|
Sequence[ToolCall]
|
Nonempty provider-requested calls.
|
required
|
Returns:
| Type |
Description |
list[ToolMessage]
|
list[ToolMessage]: Native correlated results.
|
Raises:
| Type |
Description |
Error
|
If validation or execution fails.
|
Source code in mistral.py
| def execute_tools( self, tool_calls: Sequence[ ToolCall ] ) -> list[ ToolMessage ]:
"""Execute local Mistral tool calls.
Purpose:
Dispatches registered local functions and returns correlated tool-result messages.
Args:
tool_calls (Sequence[ToolCall]): Nonempty provider-requested calls.
Returns:
list[ToolMessage]: Native correlated results.
Raises:
Error: If validation or execution fails.
"""
try:
throw_if( 'tool_calls', tool_calls )
if not isinstance( tool_calls, Sequence ) or isinstance( tool_calls, (str, bytes, bytearray) ):
raise TypeError( 'Argument "tool_calls" must be a sequence!' )
self.tool_calls = tool_calls
calls = self.tool_calls
messages: list[ ToolMessage ] = [ ]
for tool_call in calls:
function = self.functions.get( tool_call.function.name )
if function is None:
raise ValueError( f'Mistral requested an unregistered tool: "{tool_call.function.name}"!' )
arguments = self.parse_arguments( tool_call.function.arguments )
if iscoroutinefunction( function ):
raise TypeError( f'Tool "{tool_call.function.name}" requires async execution!' )
output = function( **arguments )
if isawaitable( output ):
if asyncio.iscoroutine( output ):
output.close( )
raise TypeError( f'Tool "{tool_call.function.name}" requires async execution!' )
messages.append( ToolMessage( name=tool_call.function.name, content=self.serialize_result( output ), tool_call_id=tool_call.id ) )
return messages
except Error:
raise
except Exception as e:
if 'fonky.boogr' in sys.modules and isinstance( e, sys.modules[ 'fonky.boogr' ].Error ):
raise
exception = Error( e )
exception.module = 'mistral'
exception.cause = 'Minion'
exception.method = 'execute_tools( self, tool_calls: Sequence[ ToolCall ] ) -> list[ ToolMessage ]'
Logger( ).write( exception )
raise exception
|
Execute local Mistral tool calls.
Purpose
Dispatches registered local functions and returns correlated tool-result messages.
Parameters:
| Name |
Type |
Description |
Default |
tool_calls
|
Sequence[ToolCall]
|
Nonempty provider-requested calls.
|
required
|
Returns:
| Type |
Description |
list[ToolMessage]
|
list[ToolMessage]: Native correlated results.
|
Raises:
| Type |
Description |
Error
|
If validation or execution fails.
|
Source code in mistral.py
| async def execute_tools_async( self, tool_calls: Sequence[ ToolCall ] ) -> list[ ToolMessage ]:
"""Execute local Mistral tool calls.
Purpose:
Dispatches registered local functions and returns correlated tool-result messages.
Args:
tool_calls (Sequence[ToolCall]): Nonempty provider-requested calls.
Returns:
list[ToolMessage]: Native correlated results.
Raises:
Error: If validation or execution fails.
"""
try:
throw_if( 'tool_calls', tool_calls )
if not isinstance( tool_calls, Sequence ) or isinstance( tool_calls, (str, bytes, bytearray) ):
raise TypeError( 'Argument "tool_calls" must be a sequence!' )
self.tool_calls = tool_calls
calls = self.tool_calls
messages: list[ ToolMessage ] = [ ]
for tool_call in calls:
function = self.functions.get( tool_call.function.name )
if function is None:
raise ValueError( f'Mistral requested an unregistered tool: "{tool_call.function.name}"!' )
arguments = self.parse_arguments( tool_call.function.arguments )
if iscoroutinefunction( function ):
output = await function( **arguments )
else:
output = await asyncio.to_thread( function, **arguments )
if isawaitable( output ):
output = await output
messages.append( ToolMessage( name=tool_call.function.name, content=self.serialize_result( output ), tool_call_id=tool_call.id ) )
return messages
except Error:
raise
except Exception as e:
if 'fonky.boogr' in sys.modules and isinstance( e, sys.modules[ 'fonky.boogr' ].Error ):
raise
exception = Error( e )
exception.module = 'mistral'
exception.cause = 'Minion'
exception.method = 'execute_tools_async( self, tool_calls: Sequence[ ToolCall ] ) -> list[ ToolMessage ]'
Logger( ).write( exception )
raise exception
|
parse_arguments(arguments: str | dict[str, object]) -> dict[str, object]
staticmethod
Parse model-supplied arguments.
Purpose
Decodes external JSON without rejecting a valid empty keyword object.
Parameters:
| Name |
Type |
Description |
Default |
arguments
|
str | dict[str, object]
|
JSON text or decoded object.
|
required
|
Returns:
| Type |
Description |
dict[str, object]
|
dict[str, object]: Decoded keyword arguments.
|
Raises:
| Type |
Description |
Error
|
If validation or execution fails.
|
Source code in mistral.py
| @staticmethod
def parse_arguments( arguments: str | dict[ str, object ] ) -> dict[ str, object ]:
"""Parse model-supplied arguments.
Purpose:
Decodes external JSON without rejecting a valid empty keyword object.
Args:
arguments (str | dict[str, object]): JSON text or decoded object.
Returns:
dict[str, object]: Decoded keyword arguments.
Raises:
Error: If validation or execution fails.
"""
try:
if isinstance( arguments, dict ):
return arguments
throw_if( 'arguments', arguments )
if not isinstance( arguments, str ):
raise TypeError( 'Tool arguments must be JSON text!' )
values = json.loads( arguments )
if not isinstance( values, dict ):
raise TypeError( 'Tool arguments must be a JSON object!' )
return values
except Error:
raise
except Exception as e:
if 'fonky.boogr' in sys.modules and isinstance( e, sys.modules[ 'fonky.boogr' ].Error ):
raise
exception = Error( e )
exception.module = 'mistral'
exception.cause = 'Minion'
exception.method = 'parse_arguments( arguments: str | dict[ str, object ] ) -> dict[ str, object ]'
Logger( ).write( exception )
raise exception
|
serialize_result(result: object) -> str
staticmethod
Serialize a local tool result.
Purpose
Preserves text and JSON-compatible structured results at the provider boundary.
Parameters:
| Name |
Type |
Description |
Default |
result
|
object
|
Tool output, including null and empty values.
|
required
|
Returns:
| Name | Type |
Description |
str |
str
|
Provider-compatible result content.
|
Raises:
| Type |
Description |
Error
|
If validation or execution fails.
|
Source code in mistral.py
| @staticmethod
def serialize_result( result: object ) -> str:
"""Serialize a local tool result.
Purpose:
Preserves text and JSON-compatible structured results at the provider boundary.
Args:
result (object): Tool output, including null and empty values.
Returns:
str: Provider-compatible result content.
Raises:
Error: If validation or execution fails.
"""
try:
if isinstance( result, str ):
return result
return json.dumps( serialize_value( result ), ensure_ascii=False, allow_nan=False )
except Error:
raise
except Exception as e:
if 'fonky.boogr' in sys.modules and isinstance( e, sys.modules[ 'fonky.boogr' ].Error ):
raise
exception = Error( e )
exception.module = 'mistral'
exception.cause = 'Minion'
exception.method = 'serialize_result( result: object ) -> str'
Logger( ).write( exception )
raise exception
|
DataMinion(model: str, instructions: str, tools: Sequence[MistralTool] | None = None, functions: Sequence[ToolFunction] | None = None, max_turns: int = 10, name: str | None = None)
Bases: Minion
Mistral Minion specialized for data workflows.
Purpose
Provides the Data Minion specialization of the native Mistral workflow agent.
Inherits execution, configuration and tool orchestration from Minion.
Attributes:
| Name |
Type |
Description |
minion_name |
str
|
Default display name for this specialization.
|
Source code in mistral.py
| def __init__( self, model: str, instructions: str, tools: Sequence[ MistralTool ] | None=None, functions: Sequence[ ToolFunction ] | None=None, max_turns: int=10, name: str | None=None ) -> None:
"""Initialize a Mistral Minion.
Purpose:
Stores configuration, registers native schemas and matching local functions,
and initializes the provider client and remote agent.
Args:
model (str): Nonblank provider model identifier.
instructions (str): Nonblank system instructions.
tools (Sequence[MistralTool] | None): Optional native tool declarations.
functions (Sequence[ToolFunction] | None): Optional matching local callables.
max_turns (int): Positive model-turn limit; defaults to 10.
name (str | None): Optional nonblank display name.
Returns:
None: Initializes the provider workflow agent.
Raises:
ValueError: If required configuration, tool correspondence or limits are invalid.
TypeError: If tool or callable collections are invalid.
"""
if not isinstance( model, str ) or not model.strip( ):
raise ValueError( 'Argument "model" must be a nonblank string!' )
if not isinstance( instructions, str ) or not instructions.strip( ):
raise ValueError( 'Argument "instructions" must be a nonblank string!' )
if type( max_turns ) is not int or max_turns < 1:
raise ValueError( 'Argument "max_turns" must be a positive integer!' )
self.name = self.minion_name if name is None else name
if not isinstance( self.name, str ) or not self.name.strip( ):
raise ValueError( 'Argument "name" must be a nonblank string!' )
if tools is not None and (not isinstance( tools, Sequence ) or isinstance( tools, (str, bytes, bytearray) )):
raise TypeError( 'Argument "tools" must be a sequence of native tools!' )
if functions is not None and (not isinstance( functions, Sequence ) or isinstance( functions, (str, bytes, bytearray) )):
raise TypeError( 'Argument "functions" must be a sequence of callables!' )
self.model = model
self.instructions = instructions
self.tools = list( tools ) if tools is not None else [ ]
function_list = list( functions ) if functions is not None else [ ]
if not all( callable( function ) for function in function_list ):
raise TypeError( 'Argument "functions" must contain callables!' )
self.functions = { function.__name__: function for function in function_list }
if len( self.functions ) != len( function_list ):
raise ValueError( 'Argument "functions" must contain unique names!' )
self.max_turns = max_turns
self.api_key = cfg.MISTRAL_API_KEY
self.prompt = ''
self.result = None
self.tool = None
self.tool_calls = [ ]
self.validate_tools( )
if not self.api_key.strip( ):
raise ValueError( 'Configuration "MISTRAL_API_KEY" cannot be empty!' )
self.client = Mistral( api_key=self.api_key )
self.provider = self.create( )
|
GovernanceMinion(model: str, instructions: str, tools: Sequence[MistralTool] | None = None, functions: Sequence[ToolFunction] | None = None, max_turns: int = 10, name: str | None = None)
Bases: Minion
Mistral Minion specialized for governance workflows.
Purpose
Provides the Governance Minion specialization of the native Mistral workflow agent.
Inherits execution, configuration and tool orchestration from Minion.
Attributes:
| Name |
Type |
Description |
minion_name |
str
|
Default display name for this specialization.
|
Source code in mistral.py
| def __init__( self, model: str, instructions: str, tools: Sequence[ MistralTool ] | None=None, functions: Sequence[ ToolFunction ] | None=None, max_turns: int=10, name: str | None=None ) -> None:
"""Initialize a Mistral Minion.
Purpose:
Stores configuration, registers native schemas and matching local functions,
and initializes the provider client and remote agent.
Args:
model (str): Nonblank provider model identifier.
instructions (str): Nonblank system instructions.
tools (Sequence[MistralTool] | None): Optional native tool declarations.
functions (Sequence[ToolFunction] | None): Optional matching local callables.
max_turns (int): Positive model-turn limit; defaults to 10.
name (str | None): Optional nonblank display name.
Returns:
None: Initializes the provider workflow agent.
Raises:
ValueError: If required configuration, tool correspondence or limits are invalid.
TypeError: If tool or callable collections are invalid.
"""
if not isinstance( model, str ) or not model.strip( ):
raise ValueError( 'Argument "model" must be a nonblank string!' )
if not isinstance( instructions, str ) or not instructions.strip( ):
raise ValueError( 'Argument "instructions" must be a nonblank string!' )
if type( max_turns ) is not int or max_turns < 1:
raise ValueError( 'Argument "max_turns" must be a positive integer!' )
self.name = self.minion_name if name is None else name
if not isinstance( self.name, str ) or not self.name.strip( ):
raise ValueError( 'Argument "name" must be a nonblank string!' )
if tools is not None and (not isinstance( tools, Sequence ) or isinstance( tools, (str, bytes, bytearray) )):
raise TypeError( 'Argument "tools" must be a sequence of native tools!' )
if functions is not None and (not isinstance( functions, Sequence ) or isinstance( functions, (str, bytes, bytearray) )):
raise TypeError( 'Argument "functions" must be a sequence of callables!' )
self.model = model
self.instructions = instructions
self.tools = list( tools ) if tools is not None else [ ]
function_list = list( functions ) if functions is not None else [ ]
if not all( callable( function ) for function in function_list ):
raise TypeError( 'Argument "functions" must contain callables!' )
self.functions = { function.__name__: function for function in function_list }
if len( self.functions ) != len( function_list ):
raise ValueError( 'Argument "functions" must contain unique names!' )
self.max_turns = max_turns
self.api_key = cfg.MISTRAL_API_KEY
self.prompt = ''
self.result = None
self.tool = None
self.tool_calls = [ ]
self.validate_tools( )
if not self.api_key.strip( ):
raise ValueError( 'Configuration "MISTRAL_API_KEY" cannot be empty!' )
self.client = Mistral( api_key=self.api_key )
self.provider = self.create( )
|
ResearchMinion(model: str, instructions: str, tools: Sequence[MistralTool] | None = None, functions: Sequence[ToolFunction] | None = None, max_turns: int = 10, name: str | None = None)
Bases: Minion
Mistral Minion specialized for research workflows.
Purpose
Provides the Research Minion specialization of the native Mistral workflow agent.
Inherits execution, configuration and tool orchestration from Minion.
Attributes:
| Name |
Type |
Description |
minion_name |
str
|
Default display name for this specialization.
|
Source code in mistral.py
| def __init__( self, model: str, instructions: str, tools: Sequence[ MistralTool ] | None=None, functions: Sequence[ ToolFunction ] | None=None, max_turns: int=10, name: str | None=None ) -> None:
"""Initialize a Mistral Minion.
Purpose:
Stores configuration, registers native schemas and matching local functions,
and initializes the provider client and remote agent.
Args:
model (str): Nonblank provider model identifier.
instructions (str): Nonblank system instructions.
tools (Sequence[MistralTool] | None): Optional native tool declarations.
functions (Sequence[ToolFunction] | None): Optional matching local callables.
max_turns (int): Positive model-turn limit; defaults to 10.
name (str | None): Optional nonblank display name.
Returns:
None: Initializes the provider workflow agent.
Raises:
ValueError: If required configuration, tool correspondence or limits are invalid.
TypeError: If tool or callable collections are invalid.
"""
if not isinstance( model, str ) or not model.strip( ):
raise ValueError( 'Argument "model" must be a nonblank string!' )
if not isinstance( instructions, str ) or not instructions.strip( ):
raise ValueError( 'Argument "instructions" must be a nonblank string!' )
if type( max_turns ) is not int or max_turns < 1:
raise ValueError( 'Argument "max_turns" must be a positive integer!' )
self.name = self.minion_name if name is None else name
if not isinstance( self.name, str ) or not self.name.strip( ):
raise ValueError( 'Argument "name" must be a nonblank string!' )
if tools is not None and (not isinstance( tools, Sequence ) or isinstance( tools, (str, bytes, bytearray) )):
raise TypeError( 'Argument "tools" must be a sequence of native tools!' )
if functions is not None and (not isinstance( functions, Sequence ) or isinstance( functions, (str, bytes, bytearray) )):
raise TypeError( 'Argument "functions" must be a sequence of callables!' )
self.model = model
self.instructions = instructions
self.tools = list( tools ) if tools is not None else [ ]
function_list = list( functions ) if functions is not None else [ ]
if not all( callable( function ) for function in function_list ):
raise TypeError( 'Argument "functions" must contain callables!' )
self.functions = { function.__name__: function for function in function_list }
if len( self.functions ) != len( function_list ):
raise ValueError( 'Argument "functions" must contain unique names!' )
self.max_turns = max_turns
self.api_key = cfg.MISTRAL_API_KEY
self.prompt = ''
self.result = None
self.tool = None
self.tool_calls = [ ]
self.validate_tools( )
if not self.api_key.strip( ):
raise ValueError( 'Configuration "MISTRAL_API_KEY" cannot be empty!' )
self.client = Mistral( api_key=self.api_key )
self.provider = self.create( )
|
CodingMinion(model: str, instructions: str, tools: Sequence[MistralTool] | None = None, functions: Sequence[ToolFunction] | None = None, max_turns: int = 10, name: str | None = None)
Bases: Minion
Mistral Minion specialized for software workflows.
Purpose
Provides the Coding Minion specialization of the native Mistral workflow agent.
Inherits execution, configuration and tool orchestration from Minion.
Attributes:
| Name |
Type |
Description |
minion_name |
str
|
Default display name for this specialization.
|
Source code in mistral.py
| def __init__( self, model: str, instructions: str, tools: Sequence[ MistralTool ] | None=None, functions: Sequence[ ToolFunction ] | None=None, max_turns: int=10, name: str | None=None ) -> None:
"""Initialize a Mistral Minion.
Purpose:
Stores configuration, registers native schemas and matching local functions,
and initializes the provider client and remote agent.
Args:
model (str): Nonblank provider model identifier.
instructions (str): Nonblank system instructions.
tools (Sequence[MistralTool] | None): Optional native tool declarations.
functions (Sequence[ToolFunction] | None): Optional matching local callables.
max_turns (int): Positive model-turn limit; defaults to 10.
name (str | None): Optional nonblank display name.
Returns:
None: Initializes the provider workflow agent.
Raises:
ValueError: If required configuration, tool correspondence or limits are invalid.
TypeError: If tool or callable collections are invalid.
"""
if not isinstance( model, str ) or not model.strip( ):
raise ValueError( 'Argument "model" must be a nonblank string!' )
if not isinstance( instructions, str ) or not instructions.strip( ):
raise ValueError( 'Argument "instructions" must be a nonblank string!' )
if type( max_turns ) is not int or max_turns < 1:
raise ValueError( 'Argument "max_turns" must be a positive integer!' )
self.name = self.minion_name if name is None else name
if not isinstance( self.name, str ) or not self.name.strip( ):
raise ValueError( 'Argument "name" must be a nonblank string!' )
if tools is not None and (not isinstance( tools, Sequence ) or isinstance( tools, (str, bytes, bytearray) )):
raise TypeError( 'Argument "tools" must be a sequence of native tools!' )
if functions is not None and (not isinstance( functions, Sequence ) or isinstance( functions, (str, bytes, bytearray) )):
raise TypeError( 'Argument "functions" must be a sequence of callables!' )
self.model = model
self.instructions = instructions
self.tools = list( tools ) if tools is not None else [ ]
function_list = list( functions ) if functions is not None else [ ]
if not all( callable( function ) for function in function_list ):
raise TypeError( 'Argument "functions" must contain callables!' )
self.functions = { function.__name__: function for function in function_list }
if len( self.functions ) != len( function_list ):
raise ValueError( 'Argument "functions" must contain unique names!' )
self.max_turns = max_turns
self.api_key = cfg.MISTRAL_API_KEY
self.prompt = ''
self.result = None
self.tool = None
self.tool_calls = [ ]
self.validate_tools( )
if not self.api_key.strip( ):
raise ValueError( 'Configuration "MISTRAL_API_KEY" cannot be empty!' )
self.client = Mistral( api_key=self.api_key )
self.provider = self.create( )
|
WritingMinion(model: str, instructions: str, tools: Sequence[MistralTool] | None = None, functions: Sequence[ToolFunction] | None = None, max_turns: int = 10, name: str | None = None)
Bases: Minion
Mistral Minion specialized for writing workflows.
Purpose
Provides the Writing Minion specialization of the native Mistral workflow agent.
Inherits execution, configuration and tool orchestration from Minion.
Attributes:
| Name |
Type |
Description |
minion_name |
str
|
Default display name for this specialization.
|
Source code in mistral.py
| def __init__( self, model: str, instructions: str, tools: Sequence[ MistralTool ] | None=None, functions: Sequence[ ToolFunction ] | None=None, max_turns: int=10, name: str | None=None ) -> None:
"""Initialize a Mistral Minion.
Purpose:
Stores configuration, registers native schemas and matching local functions,
and initializes the provider client and remote agent.
Args:
model (str): Nonblank provider model identifier.
instructions (str): Nonblank system instructions.
tools (Sequence[MistralTool] | None): Optional native tool declarations.
functions (Sequence[ToolFunction] | None): Optional matching local callables.
max_turns (int): Positive model-turn limit; defaults to 10.
name (str | None): Optional nonblank display name.
Returns:
None: Initializes the provider workflow agent.
Raises:
ValueError: If required configuration, tool correspondence or limits are invalid.
TypeError: If tool or callable collections are invalid.
"""
if not isinstance( model, str ) or not model.strip( ):
raise ValueError( 'Argument "model" must be a nonblank string!' )
if not isinstance( instructions, str ) or not instructions.strip( ):
raise ValueError( 'Argument "instructions" must be a nonblank string!' )
if type( max_turns ) is not int or max_turns < 1:
raise ValueError( 'Argument "max_turns" must be a positive integer!' )
self.name = self.minion_name if name is None else name
if not isinstance( self.name, str ) or not self.name.strip( ):
raise ValueError( 'Argument "name" must be a nonblank string!' )
if tools is not None and (not isinstance( tools, Sequence ) or isinstance( tools, (str, bytes, bytearray) )):
raise TypeError( 'Argument "tools" must be a sequence of native tools!' )
if functions is not None and (not isinstance( functions, Sequence ) or isinstance( functions, (str, bytes, bytearray) )):
raise TypeError( 'Argument "functions" must be a sequence of callables!' )
self.model = model
self.instructions = instructions
self.tools = list( tools ) if tools is not None else [ ]
function_list = list( functions ) if functions is not None else [ ]
if not all( callable( function ) for function in function_list ):
raise TypeError( 'Argument "functions" must contain callables!' )
self.functions = { function.__name__: function for function in function_list }
if len( self.functions ) != len( function_list ):
raise ValueError( 'Argument "functions" must contain unique names!' )
self.max_turns = max_turns
self.api_key = cfg.MISTRAL_API_KEY
self.prompt = ''
self.result = None
self.tool = None
self.tool_calls = [ ]
self.validate_tools( )
if not self.api_key.strip( ):
raise ValueError( 'Configuration "MISTRAL_API_KEY" cannot be empty!' )
self.client = Mistral( api_key=self.api_key )
self.provider = self.create( )
|
PlanningMinion(model: str, instructions: str, tools: Sequence[MistralTool] | None = None, functions: Sequence[ToolFunction] | None = None, max_turns: int = 10, name: str | None = None)
Bases: Minion
Mistral Minion specialized for planning workflows.
Purpose
Provides the Planning Minion specialization of the native Mistral workflow agent.
Inherits execution, configuration and tool orchestration from Minion.
Attributes:
| Name |
Type |
Description |
minion_name |
str
|
Default display name for this specialization.
|
Source code in mistral.py
| def __init__( self, model: str, instructions: str, tools: Sequence[ MistralTool ] | None=None, functions: Sequence[ ToolFunction ] | None=None, max_turns: int=10, name: str | None=None ) -> None:
"""Initialize a Mistral Minion.
Purpose:
Stores configuration, registers native schemas and matching local functions,
and initializes the provider client and remote agent.
Args:
model (str): Nonblank provider model identifier.
instructions (str): Nonblank system instructions.
tools (Sequence[MistralTool] | None): Optional native tool declarations.
functions (Sequence[ToolFunction] | None): Optional matching local callables.
max_turns (int): Positive model-turn limit; defaults to 10.
name (str | None): Optional nonblank display name.
Returns:
None: Initializes the provider workflow agent.
Raises:
ValueError: If required configuration, tool correspondence or limits are invalid.
TypeError: If tool or callable collections are invalid.
"""
if not isinstance( model, str ) or not model.strip( ):
raise ValueError( 'Argument "model" must be a nonblank string!' )
if not isinstance( instructions, str ) or not instructions.strip( ):
raise ValueError( 'Argument "instructions" must be a nonblank string!' )
if type( max_turns ) is not int or max_turns < 1:
raise ValueError( 'Argument "max_turns" must be a positive integer!' )
self.name = self.minion_name if name is None else name
if not isinstance( self.name, str ) or not self.name.strip( ):
raise ValueError( 'Argument "name" must be a nonblank string!' )
if tools is not None and (not isinstance( tools, Sequence ) or isinstance( tools, (str, bytes, bytearray) )):
raise TypeError( 'Argument "tools" must be a sequence of native tools!' )
if functions is not None and (not isinstance( functions, Sequence ) or isinstance( functions, (str, bytes, bytearray) )):
raise TypeError( 'Argument "functions" must be a sequence of callables!' )
self.model = model
self.instructions = instructions
self.tools = list( tools ) if tools is not None else [ ]
function_list = list( functions ) if functions is not None else [ ]
if not all( callable( function ) for function in function_list ):
raise TypeError( 'Argument "functions" must contain callables!' )
self.functions = { function.__name__: function for function in function_list }
if len( self.functions ) != len( function_list ):
raise ValueError( 'Argument "functions" must contain unique names!' )
self.max_turns = max_turns
self.api_key = cfg.MISTRAL_API_KEY
self.prompt = ''
self.result = None
self.tool = None
self.tool_calls = [ ]
self.validate_tools( )
if not self.api_key.strip( ):
raise ValueError( 'Configuration "MISTRAL_API_KEY" cannot be empty!' )
self.client = Mistral( api_key=self.api_key )
self.provider = self.create( )
|
ComplianceMinion(model: str, instructions: str, tools: Sequence[MistralTool] | None = None, functions: Sequence[ToolFunction] | None = None, max_turns: int = 10, name: str | None = None)
Bases: Minion
Mistral Minion specialized for compliance, legal, and budget workflows.
Purpose
Provides the Compliance Minion specialization of the native Mistral workflow agent.
Inherits execution, configuration and tool orchestration from Minion.
Attributes:
| Name |
Type |
Description |
minion_name |
str
|
Default display name for this specialization.
|
Source code in mistral.py
| def __init__( self, model: str, instructions: str, tools: Sequence[ MistralTool ] | None=None, functions: Sequence[ ToolFunction ] | None=None, max_turns: int=10, name: str | None=None ) -> None:
"""Initialize a Mistral Minion.
Purpose:
Stores configuration, registers native schemas and matching local functions,
and initializes the provider client and remote agent.
Args:
model (str): Nonblank provider model identifier.
instructions (str): Nonblank system instructions.
tools (Sequence[MistralTool] | None): Optional native tool declarations.
functions (Sequence[ToolFunction] | None): Optional matching local callables.
max_turns (int): Positive model-turn limit; defaults to 10.
name (str | None): Optional nonblank display name.
Returns:
None: Initializes the provider workflow agent.
Raises:
ValueError: If required configuration, tool correspondence or limits are invalid.
TypeError: If tool or callable collections are invalid.
"""
if not isinstance( model, str ) or not model.strip( ):
raise ValueError( 'Argument "model" must be a nonblank string!' )
if not isinstance( instructions, str ) or not instructions.strip( ):
raise ValueError( 'Argument "instructions" must be a nonblank string!' )
if type( max_turns ) is not int or max_turns < 1:
raise ValueError( 'Argument "max_turns" must be a positive integer!' )
self.name = self.minion_name if name is None else name
if not isinstance( self.name, str ) or not self.name.strip( ):
raise ValueError( 'Argument "name" must be a nonblank string!' )
if tools is not None and (not isinstance( tools, Sequence ) or isinstance( tools, (str, bytes, bytearray) )):
raise TypeError( 'Argument "tools" must be a sequence of native tools!' )
if functions is not None and (not isinstance( functions, Sequence ) or isinstance( functions, (str, bytes, bytearray) )):
raise TypeError( 'Argument "functions" must be a sequence of callables!' )
self.model = model
self.instructions = instructions
self.tools = list( tools ) if tools is not None else [ ]
function_list = list( functions ) if functions is not None else [ ]
if not all( callable( function ) for function in function_list ):
raise TypeError( 'Argument "functions" must contain callables!' )
self.functions = { function.__name__: function for function in function_list }
if len( self.functions ) != len( function_list ):
raise ValueError( 'Argument "functions" must contain unique names!' )
self.max_turns = max_turns
self.api_key = cfg.MISTRAL_API_KEY
self.prompt = ''
self.result = None
self.tool = None
self.tool_calls = [ ]
self.validate_tools( )
if not self.api_key.strip( ):
raise ValueError( 'Configuration "MISTRAL_API_KEY" cannot be empty!' )
self.client = Mistral( api_key=self.api_key )
self.provider = self.create( )
|
BusinessMinion(model: str, instructions: str, tools: Sequence[MistralTool] | None = None, functions: Sequence[ToolFunction] | None = None, max_turns: int = 10, name: str | None = None)
Bases: Minion
Mistral Minion specialized for business, finance, and marketing workflows.
Purpose
Provides the Business Minion specialization of the native Mistral workflow agent.
Inherits execution, configuration and tool orchestration from Minion.
Attributes:
| Name |
Type |
Description |
minion_name |
str
|
Default display name for this specialization.
|
Source code in mistral.py
| def __init__( self, model: str, instructions: str, tools: Sequence[ MistralTool ] | None=None, functions: Sequence[ ToolFunction ] | None=None, max_turns: int=10, name: str | None=None ) -> None:
"""Initialize a Mistral Minion.
Purpose:
Stores configuration, registers native schemas and matching local functions,
and initializes the provider client and remote agent.
Args:
model (str): Nonblank provider model identifier.
instructions (str): Nonblank system instructions.
tools (Sequence[MistralTool] | None): Optional native tool declarations.
functions (Sequence[ToolFunction] | None): Optional matching local callables.
max_turns (int): Positive model-turn limit; defaults to 10.
name (str | None): Optional nonblank display name.
Returns:
None: Initializes the provider workflow agent.
Raises:
ValueError: If required configuration, tool correspondence or limits are invalid.
TypeError: If tool or callable collections are invalid.
"""
if not isinstance( model, str ) or not model.strip( ):
raise ValueError( 'Argument "model" must be a nonblank string!' )
if not isinstance( instructions, str ) or not instructions.strip( ):
raise ValueError( 'Argument "instructions" must be a nonblank string!' )
if type( max_turns ) is not int or max_turns < 1:
raise ValueError( 'Argument "max_turns" must be a positive integer!' )
self.name = self.minion_name if name is None else name
if not isinstance( self.name, str ) or not self.name.strip( ):
raise ValueError( 'Argument "name" must be a nonblank string!' )
if tools is not None and (not isinstance( tools, Sequence ) or isinstance( tools, (str, bytes, bytearray) )):
raise TypeError( 'Argument "tools" must be a sequence of native tools!' )
if functions is not None and (not isinstance( functions, Sequence ) or isinstance( functions, (str, bytes, bytearray) )):
raise TypeError( 'Argument "functions" must be a sequence of callables!' )
self.model = model
self.instructions = instructions
self.tools = list( tools ) if tools is not None else [ ]
function_list = list( functions ) if functions is not None else [ ]
if not all( callable( function ) for function in function_list ):
raise TypeError( 'Argument "functions" must contain callables!' )
self.functions = { function.__name__: function for function in function_list }
if len( self.functions ) != len( function_list ):
raise ValueError( 'Argument "functions" must contain unique names!' )
self.max_turns = max_turns
self.api_key = cfg.MISTRAL_API_KEY
self.prompt = ''
self.result = None
self.tool = None
self.tool_calls = [ ]
self.validate_tools( )
if not self.api_key.strip( ):
raise ValueError( 'Configuration "MISTRAL_API_KEY" cannot be empty!' )
self.client = Mistral( api_key=self.api_key )
self.provider = self.create( )
|
ImageGenerationMinion(model: str, instructions: str, tools: Sequence[MistralTool] | None = None, functions: Sequence[ToolFunction] | None = None, max_turns: int = 10, name: str | None = None)
Bases: Minion
Mistral Minion specialized for image-generation workflows.
Purpose
Provides the Image Generation Minion specialization of the native Mistral workflow agent.
Inherits execution, configuration and tool orchestration from Minion.
Attributes:
| Name |
Type |
Description |
minion_name |
str
|
Default display name for this specialization.
|
Source code in mistral.py
| def __init__( self, model: str, instructions: str, tools: Sequence[ MistralTool ] | None=None, functions: Sequence[ ToolFunction ] | None=None, max_turns: int=10, name: str | None=None ) -> None:
"""Initialize a Mistral Minion.
Purpose:
Stores configuration, registers native schemas and matching local functions,
and initializes the provider client and remote agent.
Args:
model (str): Nonblank provider model identifier.
instructions (str): Nonblank system instructions.
tools (Sequence[MistralTool] | None): Optional native tool declarations.
functions (Sequence[ToolFunction] | None): Optional matching local callables.
max_turns (int): Positive model-turn limit; defaults to 10.
name (str | None): Optional nonblank display name.
Returns:
None: Initializes the provider workflow agent.
Raises:
ValueError: If required configuration, tool correspondence or limits are invalid.
TypeError: If tool or callable collections are invalid.
"""
if not isinstance( model, str ) or not model.strip( ):
raise ValueError( 'Argument "model" must be a nonblank string!' )
if not isinstance( instructions, str ) or not instructions.strip( ):
raise ValueError( 'Argument "instructions" must be a nonblank string!' )
if type( max_turns ) is not int or max_turns < 1:
raise ValueError( 'Argument "max_turns" must be a positive integer!' )
self.name = self.minion_name if name is None else name
if not isinstance( self.name, str ) or not self.name.strip( ):
raise ValueError( 'Argument "name" must be a nonblank string!' )
if tools is not None and (not isinstance( tools, Sequence ) or isinstance( tools, (str, bytes, bytearray) )):
raise TypeError( 'Argument "tools" must be a sequence of native tools!' )
if functions is not None and (not isinstance( functions, Sequence ) or isinstance( functions, (str, bytes, bytearray) )):
raise TypeError( 'Argument "functions" must be a sequence of callables!' )
self.model = model
self.instructions = instructions
self.tools = list( tools ) if tools is not None else [ ]
function_list = list( functions ) if functions is not None else [ ]
if not all( callable( function ) for function in function_list ):
raise TypeError( 'Argument "functions" must contain callables!' )
self.functions = { function.__name__: function for function in function_list }
if len( self.functions ) != len( function_list ):
raise ValueError( 'Argument "functions" must contain unique names!' )
self.max_turns = max_turns
self.api_key = cfg.MISTRAL_API_KEY
self.prompt = ''
self.result = None
self.tool = None
self.tool_calls = [ ]
self.validate_tools( )
if not self.api_key.strip( ):
raise ValueError( 'Configuration "MISTRAL_API_KEY" cannot be empty!' )
self.client = Mistral( api_key=self.api_key )
self.provider = self.create( )
|
ImageAnalysisMinion(model: str, instructions: str, tools: Sequence[MistralTool] | None = None, functions: Sequence[ToolFunction] | None = None, max_turns: int = 10, name: str | None = None)
Bases: Minion
Mistral Minion specialized for image-analysis workflows.
Purpose
Provides the Image Analysis Minion specialization of the native Mistral workflow agent.
Inherits execution, configuration and tool orchestration from Minion.
Attributes:
| Name |
Type |
Description |
minion_name |
str
|
Default display name for this specialization.
|
Source code in mistral.py
| def __init__( self, model: str, instructions: str, tools: Sequence[ MistralTool ] | None=None, functions: Sequence[ ToolFunction ] | None=None, max_turns: int=10, name: str | None=None ) -> None:
"""Initialize a Mistral Minion.
Purpose:
Stores configuration, registers native schemas and matching local functions,
and initializes the provider client and remote agent.
Args:
model (str): Nonblank provider model identifier.
instructions (str): Nonblank system instructions.
tools (Sequence[MistralTool] | None): Optional native tool declarations.
functions (Sequence[ToolFunction] | None): Optional matching local callables.
max_turns (int): Positive model-turn limit; defaults to 10.
name (str | None): Optional nonblank display name.
Returns:
None: Initializes the provider workflow agent.
Raises:
ValueError: If required configuration, tool correspondence or limits are invalid.
TypeError: If tool or callable collections are invalid.
"""
if not isinstance( model, str ) or not model.strip( ):
raise ValueError( 'Argument "model" must be a nonblank string!' )
if not isinstance( instructions, str ) or not instructions.strip( ):
raise ValueError( 'Argument "instructions" must be a nonblank string!' )
if type( max_turns ) is not int or max_turns < 1:
raise ValueError( 'Argument "max_turns" must be a positive integer!' )
self.name = self.minion_name if name is None else name
if not isinstance( self.name, str ) or not self.name.strip( ):
raise ValueError( 'Argument "name" must be a nonblank string!' )
if tools is not None and (not isinstance( tools, Sequence ) or isinstance( tools, (str, bytes, bytearray) )):
raise TypeError( 'Argument "tools" must be a sequence of native tools!' )
if functions is not None and (not isinstance( functions, Sequence ) or isinstance( functions, (str, bytes, bytearray) )):
raise TypeError( 'Argument "functions" must be a sequence of callables!' )
self.model = model
self.instructions = instructions
self.tools = list( tools ) if tools is not None else [ ]
function_list = list( functions ) if functions is not None else [ ]
if not all( callable( function ) for function in function_list ):
raise TypeError( 'Argument "functions" must contain callables!' )
self.functions = { function.__name__: function for function in function_list }
if len( self.functions ) != len( function_list ):
raise ValueError( 'Argument "functions" must contain unique names!' )
self.max_turns = max_turns
self.api_key = cfg.MISTRAL_API_KEY
self.prompt = ''
self.result = None
self.tool = None
self.tool_calls = [ ]
self.validate_tools( )
if not self.api_key.strip( ):
raise ValueError( 'Configuration "MISTRAL_API_KEY" cannot be empty!' )
self.client = Mistral( api_key=self.api_key )
self.provider = self.create( )
|
ImageEditingMinion(model: str, instructions: str, tools: Sequence[MistralTool] | None = None, functions: Sequence[ToolFunction] | None = None, max_turns: int = 10, name: str | None = None)
Bases: Minion
Mistral Minion specialized for image-editing workflows.
Purpose
Provides the Image Editing Minion specialization of the native Mistral workflow agent.
Inherits execution, configuration and tool orchestration from Minion.
Attributes:
| Name |
Type |
Description |
minion_name |
str
|
Default display name for this specialization.
|
Source code in mistral.py
| def __init__( self, model: str, instructions: str, tools: Sequence[ MistralTool ] | None=None, functions: Sequence[ ToolFunction ] | None=None, max_turns: int=10, name: str | None=None ) -> None:
"""Initialize a Mistral Minion.
Purpose:
Stores configuration, registers native schemas and matching local functions,
and initializes the provider client and remote agent.
Args:
model (str): Nonblank provider model identifier.
instructions (str): Nonblank system instructions.
tools (Sequence[MistralTool] | None): Optional native tool declarations.
functions (Sequence[ToolFunction] | None): Optional matching local callables.
max_turns (int): Positive model-turn limit; defaults to 10.
name (str | None): Optional nonblank display name.
Returns:
None: Initializes the provider workflow agent.
Raises:
ValueError: If required configuration, tool correspondence or limits are invalid.
TypeError: If tool or callable collections are invalid.
"""
if not isinstance( model, str ) or not model.strip( ):
raise ValueError( 'Argument "model" must be a nonblank string!' )
if not isinstance( instructions, str ) or not instructions.strip( ):
raise ValueError( 'Argument "instructions" must be a nonblank string!' )
if type( max_turns ) is not int or max_turns < 1:
raise ValueError( 'Argument "max_turns" must be a positive integer!' )
self.name = self.minion_name if name is None else name
if not isinstance( self.name, str ) or not self.name.strip( ):
raise ValueError( 'Argument "name" must be a nonblank string!' )
if tools is not None and (not isinstance( tools, Sequence ) or isinstance( tools, (str, bytes, bytearray) )):
raise TypeError( 'Argument "tools" must be a sequence of native tools!' )
if functions is not None and (not isinstance( functions, Sequence ) or isinstance( functions, (str, bytes, bytearray) )):
raise TypeError( 'Argument "functions" must be a sequence of callables!' )
self.model = model
self.instructions = instructions
self.tools = list( tools ) if tools is not None else [ ]
function_list = list( functions ) if functions is not None else [ ]
if not all( callable( function ) for function in function_list ):
raise TypeError( 'Argument "functions" must contain callables!' )
self.functions = { function.__name__: function for function in function_list }
if len( self.functions ) != len( function_list ):
raise ValueError( 'Argument "functions" must contain unique names!' )
self.max_turns = max_turns
self.api_key = cfg.MISTRAL_API_KEY
self.prompt = ''
self.result = None
self.tool = None
self.tool_calls = [ ]
self.validate_tools( )
if not self.api_key.strip( ):
raise ValueError( 'Configuration "MISTRAL_API_KEY" cannot be empty!' )
self.client = Mistral( api_key=self.api_key )
self.provider = self.create( )
|
TranslationMinion(model: str, instructions: str, tools: Sequence[MistralTool] | None = None, functions: Sequence[ToolFunction] | None = None, max_turns: int = 10, name: str | None = None)
Bases: Minion
Mistral Minion specialized for translation workflows.
Purpose
Provides the Translation Minion specialization of the native Mistral workflow agent.
Inherits execution, configuration and tool orchestration from Minion.
Attributes:
| Name |
Type |
Description |
minion_name |
str
|
Default display name for this specialization.
|
Source code in mistral.py
| def __init__( self, model: str, instructions: str, tools: Sequence[ MistralTool ] | None=None, functions: Sequence[ ToolFunction ] | None=None, max_turns: int=10, name: str | None=None ) -> None:
"""Initialize a Mistral Minion.
Purpose:
Stores configuration, registers native schemas and matching local functions,
and initializes the provider client and remote agent.
Args:
model (str): Nonblank provider model identifier.
instructions (str): Nonblank system instructions.
tools (Sequence[MistralTool] | None): Optional native tool declarations.
functions (Sequence[ToolFunction] | None): Optional matching local callables.
max_turns (int): Positive model-turn limit; defaults to 10.
name (str | None): Optional nonblank display name.
Returns:
None: Initializes the provider workflow agent.
Raises:
ValueError: If required configuration, tool correspondence or limits are invalid.
TypeError: If tool or callable collections are invalid.
"""
if not isinstance( model, str ) or not model.strip( ):
raise ValueError( 'Argument "model" must be a nonblank string!' )
if not isinstance( instructions, str ) or not instructions.strip( ):
raise ValueError( 'Argument "instructions" must be a nonblank string!' )
if type( max_turns ) is not int or max_turns < 1:
raise ValueError( 'Argument "max_turns" must be a positive integer!' )
self.name = self.minion_name if name is None else name
if not isinstance( self.name, str ) or not self.name.strip( ):
raise ValueError( 'Argument "name" must be a nonblank string!' )
if tools is not None and (not isinstance( tools, Sequence ) or isinstance( tools, (str, bytes, bytearray) )):
raise TypeError( 'Argument "tools" must be a sequence of native tools!' )
if functions is not None and (not isinstance( functions, Sequence ) or isinstance( functions, (str, bytes, bytearray) )):
raise TypeError( 'Argument "functions" must be a sequence of callables!' )
self.model = model
self.instructions = instructions
self.tools = list( tools ) if tools is not None else [ ]
function_list = list( functions ) if functions is not None else [ ]
if not all( callable( function ) for function in function_list ):
raise TypeError( 'Argument "functions" must contain callables!' )
self.functions = { function.__name__: function for function in function_list }
if len( self.functions ) != len( function_list ):
raise ValueError( 'Argument "functions" must contain unique names!' )
self.max_turns = max_turns
self.api_key = cfg.MISTRAL_API_KEY
self.prompt = ''
self.result = None
self.tool = None
self.tool_calls = [ ]
self.validate_tools( )
if not self.api_key.strip( ):
raise ValueError( 'Configuration "MISTRAL_API_KEY" cannot be empty!' )
self.client = Mistral( api_key=self.api_key )
self.provider = self.create( )
|
TranscriptionMinion(model: str, instructions: str, tools: Sequence[MistralTool] | None = None, functions: Sequence[ToolFunction] | None = None, max_turns: int = 10, name: str | None = None)
Bases: Minion
Mistral Minion specialized for transcription workflows.
Purpose
Provides the Transcription Minion specialization of the native Mistral workflow agent.
Inherits execution, configuration and tool orchestration from Minion.
Attributes:
| Name |
Type |
Description |
minion_name |
str
|
Default display name for this specialization.
|
Source code in mistral.py
| def __init__( self, model: str, instructions: str, tools: Sequence[ MistralTool ] | None=None, functions: Sequence[ ToolFunction ] | None=None, max_turns: int=10, name: str | None=None ) -> None:
"""Initialize a Mistral Minion.
Purpose:
Stores configuration, registers native schemas and matching local functions,
and initializes the provider client and remote agent.
Args:
model (str): Nonblank provider model identifier.
instructions (str): Nonblank system instructions.
tools (Sequence[MistralTool] | None): Optional native tool declarations.
functions (Sequence[ToolFunction] | None): Optional matching local callables.
max_turns (int): Positive model-turn limit; defaults to 10.
name (str | None): Optional nonblank display name.
Returns:
None: Initializes the provider workflow agent.
Raises:
ValueError: If required configuration, tool correspondence or limits are invalid.
TypeError: If tool or callable collections are invalid.
"""
if not isinstance( model, str ) or not model.strip( ):
raise ValueError( 'Argument "model" must be a nonblank string!' )
if not isinstance( instructions, str ) or not instructions.strip( ):
raise ValueError( 'Argument "instructions" must be a nonblank string!' )
if type( max_turns ) is not int or max_turns < 1:
raise ValueError( 'Argument "max_turns" must be a positive integer!' )
self.name = self.minion_name if name is None else name
if not isinstance( self.name, str ) or not self.name.strip( ):
raise ValueError( 'Argument "name" must be a nonblank string!' )
if tools is not None and (not isinstance( tools, Sequence ) or isinstance( tools, (str, bytes, bytearray) )):
raise TypeError( 'Argument "tools" must be a sequence of native tools!' )
if functions is not None and (not isinstance( functions, Sequence ) or isinstance( functions, (str, bytes, bytearray) )):
raise TypeError( 'Argument "functions" must be a sequence of callables!' )
self.model = model
self.instructions = instructions
self.tools = list( tools ) if tools is not None else [ ]
function_list = list( functions ) if functions is not None else [ ]
if not all( callable( function ) for function in function_list ):
raise TypeError( 'Argument "functions" must contain callables!' )
self.functions = { function.__name__: function for function in function_list }
if len( self.functions ) != len( function_list ):
raise ValueError( 'Argument "functions" must contain unique names!' )
self.max_turns = max_turns
self.api_key = cfg.MISTRAL_API_KEY
self.prompt = ''
self.result = None
self.tool = None
self.tool_calls = [ ]
self.validate_tools( )
if not self.api_key.strip( ):
raise ValueError( 'Configuration "MISTRAL_API_KEY" cannot be empty!' )
self.client = Mistral( api_key=self.api_key )
self.provider = self.create( )
|
SpeechMinion(model: str, instructions: str, tools: Sequence[MistralTool] | None = None, functions: Sequence[ToolFunction] | None = None, max_turns: int = 10, name: str | None = None)
Bases: Minion
Mistral Minion specialized for speech workflows.
Purpose
Provides the Speech Minion specialization of the native Mistral workflow agent.
Inherits execution, configuration and tool orchestration from Minion.
Attributes:
| Name |
Type |
Description |
minion_name |
str
|
Default display name for this specialization.
|
Source code in mistral.py
| def __init__( self, model: str, instructions: str, tools: Sequence[ MistralTool ] | None=None, functions: Sequence[ ToolFunction ] | None=None, max_turns: int=10, name: str | None=None ) -> None:
"""Initialize a Mistral Minion.
Purpose:
Stores configuration, registers native schemas and matching local functions,
and initializes the provider client and remote agent.
Args:
model (str): Nonblank provider model identifier.
instructions (str): Nonblank system instructions.
tools (Sequence[MistralTool] | None): Optional native tool declarations.
functions (Sequence[ToolFunction] | None): Optional matching local callables.
max_turns (int): Positive model-turn limit; defaults to 10.
name (str | None): Optional nonblank display name.
Returns:
None: Initializes the provider workflow agent.
Raises:
ValueError: If required configuration, tool correspondence or limits are invalid.
TypeError: If tool or callable collections are invalid.
"""
if not isinstance( model, str ) or not model.strip( ):
raise ValueError( 'Argument "model" must be a nonblank string!' )
if not isinstance( instructions, str ) or not instructions.strip( ):
raise ValueError( 'Argument "instructions" must be a nonblank string!' )
if type( max_turns ) is not int or max_turns < 1:
raise ValueError( 'Argument "max_turns" must be a positive integer!' )
self.name = self.minion_name if name is None else name
if not isinstance( self.name, str ) or not self.name.strip( ):
raise ValueError( 'Argument "name" must be a nonblank string!' )
if tools is not None and (not isinstance( tools, Sequence ) or isinstance( tools, (str, bytes, bytearray) )):
raise TypeError( 'Argument "tools" must be a sequence of native tools!' )
if functions is not None and (not isinstance( functions, Sequence ) or isinstance( functions, (str, bytes, bytearray) )):
raise TypeError( 'Argument "functions" must be a sequence of callables!' )
self.model = model
self.instructions = instructions
self.tools = list( tools ) if tools is not None else [ ]
function_list = list( functions ) if functions is not None else [ ]
if not all( callable( function ) for function in function_list ):
raise TypeError( 'Argument "functions" must contain callables!' )
self.functions = { function.__name__: function for function in function_list }
if len( self.functions ) != len( function_list ):
raise ValueError( 'Argument "functions" must contain unique names!' )
self.max_turns = max_turns
self.api_key = cfg.MISTRAL_API_KEY
self.prompt = ''
self.result = None
self.tool = None
self.tool_calls = [ ]
self.validate_tools( )
if not self.api_key.strip( ):
raise ValueError( 'Configuration "MISTRAL_API_KEY" cannot be empty!' )
self.client = Mistral( api_key=self.api_key )
self.provider = self.create( )
|