"user","content"=>$msg]; $conv_hist[] = ["role"=>"assistant","content"=>($chapters[] = LlamaCli_raw($msg,$sys_msg,["debug_level"=>0]))]; for($no=1; $no < $total_no_of_chapters; $no++) { $msg = "Write me the title of chapter number $no."; $conv_hist[] = ["role"=>"user","content"=>$msg]; $conv_hist[] = ["role"=>"assistant","content"=>($chapters[] = LlamaCli_raw($msg,$sys_msg,["previousConversation"=>$conv_hist, "debug_level"=>0]))]; } // 3. CHAPTER CONTENTS $content = []; foreach($chapters as $chapter_title) $content[$chapter_title] = LlamaCli_raw( "Write 2 paragraphs for a chapter titled $chapter_title in a book called $book_title. Output content only, no chat.", "You are an expert $expert." ); print_r([$book_title, $content]);