Design, conduct and analyze results of AI-powered surveys and experiments. Simulate social science and market research with large numbers of AI agents and LLMs.
Something to take into consideration when sending the JSON data of the surveys/results to the remote server and loading them back to edsl. Reproduction code:
from edsl.questions import QuestionLinearScale
import json
q = QuestionLinearScale(
question_text="How much do you like ice cream?",
question_options=[1, 2, 3, 4, 5],
question_name="ice_cream",
option_labels={1: "I hate it", 5: "I love it"}
)
q_dict = q.to_dict()
#simulation of sending to a remote endpoint
json_data = json.dumps(q_dict)
# here code to send the data
# ....
#simulation of loading the request data
q_dict = json.loads(json_data)
new_q = QuestionLinearScale.from_dict(q_dict) # this triggers a validation error
#fix code (converting the option_labels keys to int)
if q_dict["question_type"] == "linear_scale":
option_labels = q_dict["option_labels"]
option_labels = {int(key): value for key, value in option_labels.items()}
q_dict["option_labels"] = option_labels
new_q = QuestionLinearScale.from_dict(q_dict)
Something to take into consideration when sending the JSON data of the surveys/results to the remote server and loading them back to edsl. Reproduction code: