Creating a conversation is the first step to building any conversational AI application. Every conversation requires settings that define its behavior and capabilities.
from noxus_sdk.client import Clientfrom noxus_sdk.resources.conversations import ConversationSettingsclient = Client(api_key="your_api_key_here")# Basic conversation settingssettings = ConversationSettings( model=["gpt-4o-mini"], temperature=0.7, max_tokens=300, extra_instructions="You are a helpful assistant.")# Create the conversationconversation = client.conversations.create( name="My First Conversation", settings=settings)print(f"Created conversation: {conversation.id}")
Choose the appropriate AI model for your use case:
# Single modelsettings = ConversationSettings( model=["gpt-4o-mini"] # Fast and cost-effective)# Multiple models (fallback order)settings = ConversationSettings( model=["gpt-4o", "gpt-4o-mini"] # Try GPT-4o first, fallback to mini)# Different models for different purposescreative_settings = ConversationSettings( model=["gpt-4o"], # More creative and capable temperature=0.8)factual_settings = ConversationSettings( model=["gpt-4o-mini"], # Fast for factual queries temperature=0.2)
from noxus_sdk.resources.conversations import WebResearchToolweb_tool = WebResearchTool( enabled=True, extra_instructions="Focus on recent, reliable sources. Always cite sources.")research_settings = ConversationSettings( model=["gpt-4o-mini"], temperature=0.4, max_tokens=600, tools=[web_tool], extra_instructions="Use web research when you need current information.")research_bot = client.conversations.create( name="Research Assistant", settings=research_settings)
from noxus_sdk.resources.conversations import KnowledgeBaseQaTool# Single knowledge basekb_tool = KnowledgeBaseQaTool( enabled=True, kb_id="your_knowledge_base_id", extra_instructions="Provide detailed answers with specific references.")# Multiple knowledge bases with selectorfrom noxus_sdk.resources.conversations import KnowledgeBaseSelectorToolkb_selector = KnowledgeBaseSelectorTool( enabled=True, extra_instructions="Choose the most relevant knowledge base for each query.")kb_settings = ConversationSettings( model=["gpt-4o-mini"], temperature=0.3, tools=[kb_tool, kb_selector], extra_instructions="Always check knowledge bases first for company-specific information.")support_bot = client.conversations.create( name="Support Bot", settings=kb_settings)
from noxus_sdk.resources.conversations import ( ConversationSettings, KnowledgeBaseQaTool, WebResearchTool)# Support bot with knowledge base and escalationsupport_kb_tool = KnowledgeBaseQaTool( enabled=True, kb_id="support_kb_id", extra_instructions="Check for existing solutions and troubleshooting steps.")support_settings = ConversationSettings( model=["gpt-4o-mini"], temperature=0.3, # Consistent, helpful responses max_tokens=400, tools=[support_kb_tool], extra_instructions="""You are a customer support assistant. - Always be empathetic and helpful - Check the knowledge base for solutions first - If you can't solve the issue, suggest contacting human support - Ask clarifying questions when needed""")support_bot = client.conversations.create( name="Customer Support Bot", settings=support_settings)
content_settings = ConversationSettings( model=["gpt-4o"], temperature=0.7, # Creative but controlled max_tokens=800, tools=[WebResearchTool( enabled=True, extra_instructions="Research current trends and examples" )], extra_instructions="""You are a content creation assistant. - Help with blog posts, social media, and marketing copy - Research current trends when relevant - Ask about target audience and goals - Provide multiple options when possible""")content_assistant = client.conversations.create( name="Content Creator", settings=content_settings)
from noxus_sdk.resources.conversations import ( WebResearchTool, KnowledgeBaseQaTool, WorkflowTool, NoxusQaTool)# Comprehensive assistant with multiple capabilitiesmulti_tool_settings = ConversationSettings( model=["gpt-4o"], temperature=0.6, max_tokens=600, tools=[ WebResearchTool( enabled=True, extra_instructions="Use for current events and recent information" ), KnowledgeBaseQaTool( enabled=True, kb_id="company_kb_id", extra_instructions="Use for company policies and procedures" ), WorkflowTool( enabled=True, workflow={ "id": "report_generator_id", "name": "Report Generator", "description": "Generate formatted reports" } ), NoxusQaTool( enabled=True, extra_instructions="Help with Noxus platform questions" ) ], extra_instructions="""You are a versatile AI assistant with multiple tools: - Use web research for current information - Check company knowledge base for internal information - Use workflows for complex data processing - Help with Noxus platform questions - Choose the most appropriate tool for each request""")versatile_assistant = client.conversations.create( name="Versatile Assistant", settings=multi_tool_settings)
Create conversations that use pre-configured agents:
# First, get an existing agentagent = client.agents.get("agent_id_here")# Create conversation using the agent's settingsagent_conversation = client.conversations.create( name="Chat with Agent", agent_id=agent.id # Uses agent's settings automatically)# No need to specify settings - they come from the agentprint(f"Created conversation with agent: {agent.name}")
def validate_conversation_settings(settings): """Validate conversation settings before creation""" # Check required fields if not settings.model: raise ValueError("Model is required") # Validate temperature range if not 0.0 <= settings.temperature <= 1.0: raise ValueError("Temperature must be between 0.0 and 1.0") # Validate max_tokens if settings.max_tokens <= 0: raise ValueError("max_tokens must be positive") # Check tool configuration for tool in settings.tools: if hasattr(tool, 'kb_id') and not tool.kb_id: raise ValueError("Knowledge base tool requires kb_id") return True# Use validationtry: validate_conversation_settings(settings) conversation = client.conversations.create(name="Test", settings=settings)except ValueError as e: print(f"Invalid settings: {e}")
def test_conversation(conversation, test_messages): """Test a conversation with sample messages""" results = [] for message_text in test_messages: try: message = MessageRequest(content=message_text) response = conversation.add_message(message) results.append({ "input": message_text, "output": response.message_parts, "success": True }) except Exception as e: results.append({ "input": message_text, "output": str(e), "success": False }) return results# Test the conversationtest_messages = [ "Hello, how can you help me?", "What's the weather like today?", "Can you help me write a blog post?"]test_results = test_conversation(support_bot, test_messages)for result in test_results: status = "✅" if result["success"] else "❌" print(f"{status} {result['input'][:30]}... -> {result['output'][:50]}...")
# ✅ Good - descriptive and purposefulconversation = client.conversations.create( name="Customer Support - Product Questions", settings=settings)# ❌ Bad - generic and unclearconversation = client.conversations.create( name="Bot 1", settings=settings)
Settings Organization
Create reusable settings configurations:
# Define common settingsSUPPORT_SETTINGS = ConversationSettings( model=["gpt-4o-mini"], temperature=0.3, max_tokens=400, extra_instructions="Be helpful and empathetic")CREATIVE_SETTINGS = ConversationSettings( model=["gpt-4o"], temperature=0.8, max_tokens=800, extra_instructions="Be creative and engaging")# Use predefined settingssupport_bot = client.conversations.create( name="Support Bot", settings=SUPPORT_SETTINGS)
Tool Selection
Only enable tools that are needed:
# ✅ Good - specific tools for specific purposessupport_tools = [ KnowledgeBaseQaTool(enabled=True, kb_id="support_kb")]research_tools = [ WebResearchTool(enabled=True), KnowledgeBaseQaTool(enabled=True, kb_id="research_kb")]# ❌ Bad - too many tools without clear purposeall_tools = [web_tool, kb_tool1, kb_tool2, workflow_tool, noxus_tool]