Integrate QuantumFlow with your favorite AI frameworks. Full support for OpenAI, LangChain, CrewAI, AutoGen, and Claude Desktop (MCP).
Direct integration with OpenAI function calling API for GPT-4 and GPT-3.5-turbo models.
pip install quantumflow-sdk openaifrom openai import OpenAI
from quantumflow.integrations.openai_functions import (
get_quantum_tools,
execute_quantum_function,
)
import json
client = OpenAI()
# Chat with quantum capabilities
response = client.chat.completions.create(
model="gpt-4",
messages=[
{"role": "user", "content": "Compress these tokens: 100, 200, 150, 175"}
],
tools=get_quantum_tools(),
tool_choice="auto",
)
# Execute the function call
if response.choices[0].message.tool_calls:
tool_call = response.choices[0].message.tool_calls[0]
result = execute_quantum_function(
tool_call.function.name,
json.loads(tool_call.function.arguments)
)
print(result)from openai import OpenAI
from quantumflow.integrations.openai_functions import QuantumAssistant
# Initialize OpenAI client
client = OpenAI()
# Create quantum-enabled assistant
assistant = QuantumAssistant(client, model="gpt-4")
# Chat naturally - assistant handles function calls automatically
response = assistant.chat(
"I have token values [100, 200, 150, 175, 225, 180]. "
"Can you compress them and tell me the compression ratio?"
)
print(response)
# Follow-up conversation
response = assistant.chat(
"Now perform a QKD key exchange with 256-bit key length"
)
print(response)
# Reset conversation if needed
assistant.reset()get_quantum_functions()Returns function definitions for OpenAI function calling API (legacy format)get_quantum_tools()Returns tool definitions for OpenAI tools API (newer format)execute_quantum_function(name, args)Execute a quantum function by name with given argumentsQuantumAssistant(client, model)Helper class for chat with automatic function handling