agentsociety.survey.models

Module Contents

Classes

QuestionType

Question

Page

Survey

Represents a survey with metadata and associated pages containing questions.

API

class agentsociety.survey.models.QuestionType

Bases: str, enum.Enum

TEXT

‘text’

RADIO

‘radiogroup’

CHECKBOX

‘checkbox’

BOOLEAN

‘boolean’

RATING

‘rating’

MATRIX

‘matrix’

class agentsociety.survey.models.Question

Bases: pydantic.BaseModel

name: str

None

title: str

None

type: agentsociety.survey.models.QuestionType

None

choices: List[str]

[]

columns: List[str]

[]

rows: List[str]

[]

required: bool

True

min_rating: int

1

max_rating: int

5

classmethod parse_choices(value: Any) → List[str]
class agentsociety.survey.models.Page

Bases: pydantic.BaseModel

name: str

None

elements: List[agentsociety.survey.models.Question]

None

class agentsociety.survey.models.Survey

Bases: pydantic.BaseModel

Represents a survey with metadata and associated pages containing questions.

id: uuid.UUID

None

Unique identifier for the survey

title: str = <Multiline-String>

Title of the survey

description: str = <Multiline-String>

Description of the survey

pages: List[agentsociety.survey.models.Page]

None

List of pages in the survey

responses: Dict[str, dict]

None

Dictionary mapping response IDs to their data

created_at: datetime.datetime

‘Field(…)’

Timestamp of when the survey was created

to_prompt() → List[str]

Convert the questionnaire into a list of strings, where each string represents one question.

  • Description:

    • Converts the survey into a list of individual question prompts, each containing the survey context and one specific question.

  • Returns:

    • List[str]: A list of strings, each representing one question with its context and instructions.