Conversations in Noxus represent interactive chat sessions with AI models. They provide a structured way to build chatbots, virtual assistants, and other conversational AI applications with support for multiple AI models, custom tools, context management, and file handling.
# Send a simple text messagemessage = MessageRequest(content="Hello! How can you help me today?")response = conversation.add_message(message)print(f"AI Response: {response.message_parts}")# Continue the conversationfollow_up = MessageRequest(content="Can you explain quantum computing in simple terms?")response = conversation.add_message(follow_up)print(f"AI Response: {response.message_parts}")
Enable AI to search the web for current information:
from noxus_sdk.resources.conversations import WebResearchToolweb_tool = WebResearchTool( enabled=True, extra_instructions="Focus on recent and reliable sources")
Knowledge Base Tools
Access your knowledge bases for specialized information:
from noxus_sdk.resources.conversations import KnowledgeBaseQaToolkb_tool = KnowledgeBaseQaTool( enabled=True, kb_id="your_knowledge_base_id", extra_instructions="Provide detailed answers with citations")
Workflow Tools
Execute workflows from within conversations:
from noxus_sdk.resources.conversations import WorkflowToolworkflow_tool = WorkflowTool( enabled=True, workflow={ "id": "workflow_id", "name": "Data Processor", "description": "Process and analyze data" })
Noxus Q&A Tool
Get help with Noxus platform features:
from noxus_sdk.resources.conversations import NoxusQaToolnoxus_tool = NoxusQaTool( enabled=True, extra_instructions="Explain features clearly with examples")
# Simple Q&A bot with knowledge baseqa_settings = ConversationSettings( model=["gpt-4o-mini"], temperature=0.3, # Lower temperature for factual responses tools=[KnowledgeBaseQaTool( enabled=True, kb_id="faq_kb_id", extra_instructions="Provide accurate answers based on the knowledge base" )], extra_instructions="You are a helpful FAQ bot. Always check the knowledge base first.")qa_bot = client.conversations.create(name="FAQ Bot", settings=qa_settings)
# Research assistant with web accessresearch_settings = ConversationSettings( model=["gpt-4o"], temperature=0.4, tools=[ WebResearchTool( enabled=True, extra_instructions="Use recent, authoritative sources" ) ], extra_instructions="You are a research assistant. Always cite your sources and provide comprehensive answers.")research_assistant = client.conversations.create( name="Research Assistant", settings=research_settings)
# Limit response lengthsettings = ConversationSettings(max_tokens=300)# Provide clear instructionssettings = ConversationSettings( extra_instructions="Keep responses under 100 words. Be direct and helpful.")
Error Handling
Implement robust error handling:
try: response = conversation.add_message(message) return response.message_partsexcept Exception as e: print(f"Error in conversation: {e}") return "I'm sorry, I encountered an error. Please try again."