Spaces:
Sleeping
Sleeping
File size: 2,413 Bytes
371cfc1 | 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 50 51 52 53 54 55 56 57 58 59 60 | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
"""
Data models for the Ask Answer Env Environment.
A slot-filling environment where agents must decide between asking
clarifying questions or answering early.
"""
from typing import Literal, Optional
from pydantic import BaseModel, Field
from openenv.core.env_server.types import Action, Observation
class AskAnswerAction(Action):
"""
Action for the Ask Answer Env environment.
Two action types:
- "ask": Ask about a specific slot (city, date, budget, or style)
- "answer": Provide final answer with slot values
"""
type: Literal["ask", "answer"] = Field(..., description="Action type: 'ask' or 'answer'")
slot: Optional[Literal["city", "date", "budget", "style"]] = Field(
default=None, description="Slot to ask about (only for 'ask' type)"
)
city: Optional[str] = Field(default=None, description="City answer (only for 'answer' type)")
date: Optional[str] = Field(default=None, description="Date answer (only for 'answer' type)")
budget: Optional[str] = Field(default=None, description="Budget answer (only for 'answer' type)")
style: Optional[str] = Field(default=None, description="Style answer (only for 'answer' type)")
class KnownSlots(BaseModel):
"""Slots that have been revealed to the agent."""
city: Optional[str] = Field(default=None, description="Known city value")
date: Optional[str] = Field(default=None, description="Known date value")
budget: Optional[str] = Field(default=None, description="Known budget value")
style: Optional[str] = Field(default=None, description="Known style value")
class AskAnswerObservation(Observation):
"""Observation from the Ask Answer Env environment."""
prompt: str = Field(default="Plan a short trip for me.", description="The user prompt")
known: KnownSlots = Field(default_factory=KnownSlots, description="Currently known slot values")
steps_left: int = Field(default=3, description="Number of steps remaining")
# Correctness info (populated when done=True after ANSWER action)
core_correct_count: Optional[int] = Field(
default=None, description="Number of core slots correct (0-3), None if not answered yet"
)
|