File size: 1,831 Bytes
d1221ff
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
999c3ec
 
 
 
 
 
 
 
d1221ff
 
 
 
 
 
 
 
 
999c3ec
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
"""Pydantic models for the Long-Context Summarization environment."""
from typing import Optional, List, Dict, Any
from pydantic import Field

from openenv.core.env_server.types import Action, Observation, State


class SummarizationAction(Action):
    """Action containing the model's text response (summary or answer)."""

    response: str = Field(..., description="The model's text response")


class SummarizationObservation(Observation):
    """Observation containing conversation messages and episode metadata."""

    messages: List[Dict[str, str]] = Field(
        default_factory=list,
        description="Conversation messages in OpenAI chat format",
    )
    step_type: str = Field(
        default="summarize",
        description="Current step: 'summarize', 'update_summary', 'answer', or 'done'",
    )
    task_name: str = Field(default="easy", description="Task difficulty: easy/medium/hard")
    context_length: int = Field(default=0, description="Total context length in characters")
    truncation_ratio: float = Field(
        default=0.7, description="Fraction of context shown to the model"
    )
    category: Optional[str] = Field(
        default=None,
        description="Coarse content domain such as history, science, geography, or software",
    )
    source_type: Optional[str] = Field(
        default=None,
        description="Source style such as encyclopedic_passage, long_form_reference, or scientific_paper",
    )


class SummarizationState(State):
    """Internal state tracking episode metadata."""

    task_name: str = Field(default="easy")
    step_type: str = Field(default="summarize")
    context_length: int = Field(default=0)
    question: Optional[str] = Field(default=None)
    category: Optional[str] = Field(default=None)
    source_type: Optional[str] = Field(default=None)