Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.praison.ai/llms.txt

Use this file to discover all available pages before exploring further.

Generate LaTeX-formatted academic papers using specialized AI models designed for scientific writing.

Quick Start

1

Setup

Install PraisonAI and set up HuggingFace access:
pip install "praisonaiagents[llm]"
export HUGGINGFACE_API_KEY="your-key"   # for CAJAL-4B via litellm
# Optional fallback: export OPENAI_API_KEY="your-key"
2

Simple Scientific Writing

Create a specialized scientific writer agent:
from praisonaiagents import Agent, tool


@tool
def format_latex_section(title: str, content: str) -> str:
    """Wrap prose in a LaTeX \\section{} block."""
    return f"\\section{{{title}}}\n{content}\n"


@tool
def format_citation(authors: str, year: int, title: str, venue: str) -> str:
    """Render an APA citation."""
    return f"{authors} ({year}). {title}. *{venue}*."


agent = Agent(
    name="Scientific Writer",
    instructions="You are a specialised scientific paper writer. Use LaTeX formatting and APA citations.",
    llm="huggingface/Agnuxo/CAJAL-4B-P2PCLAW",
    tools=[format_latex_section, format_citation],
)

agent.start(
    "Write a short paper (Abstract + Introduction + Conclusion) on "
    "'Climate change effects on coral reef biodiversity'."
)
Swap llm="huggingface/Agnuxo/CAJAL-4B-P2PCLAW" for any other model (e.g. gpt-4o-mini) to use a general-purpose LLM if HuggingFace access is unavailable.

How It Works

The scientific writing system uses specialized agents for different parts of academic paper creation:
StagePurposeOutput
Literature ReviewSurvey existing researchAPA-formatted citations
Methodology DesignCreate research approachLaTeX methods section
Paper WritingAssemble final documentComplete LaTeX paper

Multi-Agent Workflow

Use multiple specialized agents for comprehensive paper generation:
from praisonaiagents import Agent, AgentTeam, Task, tool


@tool
def format_latex_section(title: str, content: str) -> str:
    """Wrap prose in a LaTeX \\section{} block."""
    return f"\\section{{{title}}}\n{content}\n"


@tool
def format_citation(authors: str, year: int, title: str, venue: str) -> str:
    """Render an APA citation."""
    return f"{authors} ({year}). {title}. *{venue}*."


literature_reviewer = Agent(
    name="Literature Reviewer",
    instructions="Survey academic literature. Produce 5–8 APA citations.",
    tools=[format_citation],
)

methodology_designer = Agent(
    name="Methodology Designer",
    instructions="Design a reproducible research methodology.",
    tools=[format_latex_section],
)

scientific_writer = Agent(
    name="Scientific Writer",
    instructions="Assemble the final paper. Use LaTeX + APA.",
    llm="huggingface/Agnuxo/CAJAL-4B-P2PCLAW",
    tools=[format_latex_section, format_citation],
)

topic = "Transformer architectures for protein folding prediction"

t1 = Task(name="review_literature", description=f"Review literature on: {topic}",
          agent=literature_reviewer, expected_output="APA literature review.")
t2 = Task(name="design_methodology", description=f"Design methodology for: {topic}",
          agent=methodology_designer, expected_output="LaTeX methods section.")
t3 = Task(name="write_paper",
          description=f"Combine review + methodology into a full paper on: {topic}.",
          agent=scientific_writer, expected_output="Complete LaTeX paper.")

team = AgentTeam(
    agents=[literature_reviewer, methodology_designer, scientific_writer],
    tasks=[t1, t2, t3],
)
print(team.start())

YAML Configuration

framework: praisonai
topic: "Climate change effects on coral reef biodiversity"

roles:
  literature_reviewer:
    role: "Literature Reviewer"
    goal: "Survey recent academic work on {topic} and produce an APA review."
    backstory: "Expert in academic literature surveying and citation hygiene."
    llm: "gpt-4o-mini"
    tasks:
      review_literature:
        description: "Produce a concise literature review with 5-8 APA citations."
        expected_output: "APA-formatted literature review."

  methodology_designer:
    role: "Methodology Designer"
    goal: "Design a reproducible research methodology for {topic}."
    backstory: "Specialises in rigorous experimental design."
    llm: "gpt-4o-mini"
    tasks:
      design_methodology:
        description: "Write a reproducible methods section in LaTeX."
        expected_output: "LaTeX methods section."

  scientific_writer:
    role: "Scientific Writer"
    goal: "Assemble the final LaTeX paper on {topic}."
    backstory: >-
      Specialised in LaTeX-formatted academic papers, fine-tuned on
      scientific literature (CAJAL-4B checkpoint).
    llm: "huggingface/Agnuxo/CAJAL-4B-P2PCLAW"
    tasks:
      write_paper:
        description: >-
          Combine the literature review and methodology into a full
          scientific paper on {topic}. Use LaTeX formatting.
        expected_output: "Complete LaTeX paper."

Which Option to Choose?


Configuration Options

ToolPurposeInputs
format_latex_sectionWrap prose in \section{}title: str, content: str
format_citationBuild APA citation lineauthors: str, year: int, title: str, venue: str

Model Options

ModelBest ForSetup
huggingface/Agnuxo/CAJAL-4B-P2PCLAWLaTeX-fluent academic writingRequires HuggingFace API key
gpt-4o-miniGeneral-purpose fallbackRequires OpenAI API key
Local modelsPrivacy/cost controlRun your own inference server

Best Practices

Use CAJAL-4B for LaTeX-fluent output when HuggingFace access is available. Fall back to gpt-4o-mini for general-purpose writing when needed.
Add more @tool functions like format_equation, format_table, or format_figure_caption to enhance the writer’s capabilities.
For lengthy papers, create separate tasks for each section (Introduction, Methods, Results, Discussion) to maintain focus and quality.
Set up both HuggingFace and OpenAI API keys for maximum flexibility. Consider local inference servers for high-volume usage.

Research Assistant

Multi-agent research workflow for comprehensive analysis

Agents Concepts

Learn about agent fundamentals and architecture

Tasks & AgentTeam

Understand task coordination and team workflows

YAML Configuration

Complete YAML configuration reference