Response Types

Understanding different types of responses from Zonia

Text Responses

Direct Answers

User: "What is JavaScript?"

Zonia: "JavaScript is a programming language that enables interactive web pages..."

Structured Lists

User: "List the benefits of React"

Zonia: "Here are the key benefits of React: 1. Virtual DOM for better performance 2. Component-based architecture 3. Rich ecosystem 4. Strong community support"

Code Responses

Code Examples

// User: "Show me a React component example"
// Zonia's response:

import React, { useState } from 'react';

function Counter() {
	const [count, setCount] = useState(0);

	return (
		<div>
			<p>Count: {count}</p>
			<button onClick={() => setCount(count + 1)}>
				Increment
			</button>
		</div>
	);
}

Code Explanations

Code Breakdown:

  • Imports React and useState hook
  • Defines a functional component
  • Uses state management
  • Returns JSX markup

Interactive Responses

Follow-up Questions

User: "I want to build a website"

Zonia: "I can help with that. Let me ask a few questions: 1. What type of website do you need? 2. What features are essential? 3. Do you have a design in mind?"

Suggestions

User: "How can I improve my code?"

Zonia: "Based on your code, here are suggestions: • Add error handling • Implement input validation • Consider using TypeScript Would you like details about any of these?"

Response Formats API

// Request specific response formats
const response = await zonia.ask({
	question: "Explain arrays",
	format: {
		type: "structured",
		style: "tutorial",
		includeExamples: true,
		codeLanguage: "javascript"
	}
});

// Stream responses for real-time interaction
const stream = await zonia.askStream({
	question: "Write a blog post",
	format: {
		type: "progressive",
		sections: ["intro", "main", "conclusion"]
	},
	onProgress: (chunk) => {
		console.log(chunk.section, chunk.content);
	}
});