openconvert.client module
OpenConvert Client
Client class for connecting to the OpenConvert OpenAgents network, discovering conversion agents, and performing file conversions.
- class openconvert.client.OpenConvertClient(agent_id=None)[source]
Bases:
objectClient for interacting with the OpenConvert OpenAgents network.
- Parameters:
agent_id (str | None)
- __init__(agent_id=None)[source]
Initialize the OpenConvert client.
- Parameters:
agent_id (str | None) – Optional agent ID. If not provided, a random one will be generated.
- async connect(host='network.openconvert.ai', port=8765)[source]
Connect to the OpenConvert network.
- async discover_agents(source_format, target_format)[source]
Discover agents capable of performing a specific conversion.
- async convert_file(input_file, output_file, source_format, target_format, prompt=None, timeout=60)[source]
Convert a single file using the OpenConvert network.
- Parameters:
- Returns:
True if conversion successful
- Return type:
- async convert_files_batch(files, timeout=60)[source]
Convert multiple files in batch.
- Parameters:
files (List[Dict[str, Any]]) – List of file conversion specifications, each containing: - input_file: Path to input file - output_file: Path to output file - source_format: Source MIME type - target_format: Target MIME type - prompt: Optional conversion prompt
timeout (int) – Timeout per file in seconds
- Returns:
List of success flags for each conversion
- Return type:
- async openconvert.client.convert_file(input_file, output_file, source_format=None, target_format=None, prompt=None, host='network.openconvert.ai', port=8765)[source]
Convenience function to convert a single file.
- Parameters:
input_file (Path) – Path to input file
output_file (Path) – Path to output file
source_format (str | None) – Source MIME type (auto-detected if None)
target_format (str | None) – Target MIME type (auto-detected if None)
prompt (str | None) – Optional conversion instructions
host (str) – Network host
port (int) – Network port
- Returns:
True if conversion successful
- Return type:
OpenConvertClient
- class openconvert.client.OpenConvertClient(agent_id=None)[source]
Bases:
objectClient for interacting with the OpenConvert OpenAgents network.
- Parameters:
agent_id (str | None)
- __init__(agent_id=None)[source]
Initialize the OpenConvert client.
- Parameters:
agent_id (str | None) – Optional agent ID. If not provided, a random one will be generated.
- async connect(host='network.openconvert.ai', port=8765)[source]
Connect to the OpenConvert network.
- async discover_agents(source_format, target_format)[source]
Discover agents capable of performing a specific conversion.
- async convert_file(input_file, output_file, source_format, target_format, prompt=None, timeout=60)[source]
Convert a single file using the OpenConvert network.
- Parameters:
- Returns:
True if conversion successful
- Return type:
- async convert_files_batch(files, timeout=60)[source]
Convert multiple files in batch.
- Parameters:
files (List[Dict[str, Any]]) – List of file conversion specifications, each containing: - input_file: Path to input file - output_file: Path to output file - source_format: Source MIME type - target_format: Target MIME type - prompt: Optional conversion prompt
timeout (int) – Timeout per file in seconds
- Returns:
List of success flags for each conversion
- Return type: