edsl 0.1.30.dev2__tar.gz → 0.1.30.dev3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/PKG-INFO +1 -1
- edsl-0.1.30.dev3/edsl/__version__.py +1 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/agents/Agent.py +8 -6
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/agents/AgentList.py +9 -19
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/agents/Invigilator.py +1 -1
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/data/Cache.py +13 -14
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/data/CacheEntry.py +6 -7
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/data_transfer_models.py +1 -1
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/jobs/Jobs.py +10 -2
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/jobs/buckets/ModelBuckets.py +1 -1
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/jobs/buckets/TokenBucket.py +3 -3
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/jobs/interviews/Interview.py +5 -5
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/jobs/runners/JobsRunnerAsyncio.py +2 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/jobs/tasks/QuestionTaskCreator.py +6 -7
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/notebooks/Notebook.py +9 -9
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/questions/QuestionFreeText.py +4 -2
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/results/Results.py +2 -2
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/scenarios/FileStore.py +42 -26
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/scenarios/Scenario.py +12 -19
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/scenarios/ScenarioList.py +8 -6
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/study/Study.py +3 -5
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/surveys/Survey.py +9 -11
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/pyproject.toml +19 -18
- edsl-0.1.30.dev2/edsl/__version__.py +0 -1
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/LICENSE +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/README.md +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/Base.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/BaseDiff.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/__init__.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/agents/InvigilatorBase.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/agents/PromptConstructionMixin.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/agents/__init__.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/agents/descriptors.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/base/Base.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/config.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/conjure/AgentConstructionMixin.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/conjure/Conjure.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/conjure/InputData.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/conjure/InputDataCSV.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/conjure/InputDataMixinQuestionStats.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/conjure/InputDataPyRead.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/conjure/InputDataSPSS.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/conjure/InputDataStata.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/conjure/QuestionOptionMixin.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/conjure/QuestionTypeMixin.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/conjure/RawQuestion.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/conjure/SurveyResponses.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/conjure/__init__.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/conjure/examples/placeholder.txt +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/conjure/naming_utilities.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/conjure/utilities.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/conversation/Conversation.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/conversation/car_buying.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/conversation/mug_negotiation.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/conversation/next_speaker_utilities.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/coop/__init__.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/coop/coop.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/coop/utils.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/data/CacheHandler.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/data/SQLiteDict.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/data/__init__.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/data/orm.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/enums.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/exceptions/__init__.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/exceptions/agents.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/exceptions/configuration.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/exceptions/coop.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/exceptions/data.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/exceptions/general.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/exceptions/jobs.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/exceptions/language_models.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/exceptions/prompts.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/exceptions/questions.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/exceptions/results.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/exceptions/surveys.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/inference_services/AnthropicService.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/inference_services/DeepInfraService.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/inference_services/GoogleService.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/inference_services/InferenceServiceABC.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/inference_services/InferenceServicesCollection.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/inference_services/OpenAIService.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/inference_services/__init__.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/inference_services/models_available_cache.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/inference_services/rate_limits_cache.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/inference_services/registry.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/inference_services/write_available.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/jobs/Answers.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/jobs/__init__.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/jobs/buckets/BucketCollection.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/jobs/interviews/InterviewStatistic.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/jobs/interviews/InterviewStatisticsCollection.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/jobs/interviews/InterviewStatusDictionary.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/jobs/interviews/InterviewStatusLog.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/jobs/interviews/InterviewStatusMixin.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/jobs/interviews/InterviewTaskBuildingMixin.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/jobs/interviews/ReportErrors.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/jobs/interviews/interview_exception_tracking.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/jobs/interviews/interview_status_enum.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/jobs/interviews/retry_management.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/jobs/runners/JobsRunnerStatusData.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/jobs/runners/JobsRunnerStatusMixin.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/jobs/tasks/TaskCreators.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/jobs/tasks/TaskHistory.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/jobs/tasks/TaskStatusLog.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/jobs/tasks/task_management.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/jobs/tasks/task_status_enum.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/jobs/tokens/InterviewTokenUsage.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/jobs/tokens/TokenUsage.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/language_models/LanguageModel.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/language_models/ModelList.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/language_models/RegisterLanguageModelsMeta.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/language_models/__init__.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/language_models/registry.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/language_models/repair.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/language_models/unused/ReplicateBase.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/notebooks/__init__.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/prompts/Prompt.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/prompts/QuestionInstructionsBase.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/prompts/__init__.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/prompts/library/agent_instructions.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/prompts/library/agent_persona.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/prompts/library/question_budget.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/prompts/library/question_checkbox.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/prompts/library/question_extract.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/prompts/library/question_freetext.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/prompts/library/question_linear_scale.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/prompts/library/question_list.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/prompts/library/question_multiple_choice.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/prompts/library/question_numerical.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/prompts/library/question_rank.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/prompts/prompt_config.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/prompts/registry.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/questions/AnswerValidatorMixin.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/questions/QuestionBase.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/questions/QuestionBudget.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/questions/QuestionCheckBox.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/questions/QuestionExtract.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/questions/QuestionFunctional.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/questions/QuestionList.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/questions/QuestionMultipleChoice.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/questions/QuestionNumerical.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/questions/QuestionRank.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/questions/RegisterQuestionsMeta.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/questions/SimpleAskMixin.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/questions/__init__.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/questions/compose_questions.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/questions/derived/QuestionLikertFive.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/questions/derived/QuestionLinearScale.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/questions/derived/QuestionTopK.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/questions/derived/QuestionYesNo.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/questions/derived/__init__.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/questions/descriptors.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/questions/question_registry.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/questions/settings.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/results/Dataset.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/results/DatasetExportMixin.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/results/Result.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/results/ResultsDBMixin.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/results/ResultsExportMixin.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/results/ResultsFetchMixin.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/results/ResultsGGMixin.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/results/ResultsToolsMixin.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/results/__init__.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/scenarios/ScenarioHtmlMixin.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/scenarios/ScenarioImageMixin.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/scenarios/ScenarioListExportMixin.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/scenarios/ScenarioListPdfMixin.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/scenarios/__init__.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/shared.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/study/ObjectEntry.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/study/ProofOfWork.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/study/SnapShot.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/study/__init__.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/surveys/DAG.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/surveys/Memory.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/surveys/MemoryPlan.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/surveys/Rule.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/surveys/RuleCollection.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/surveys/SurveyCSS.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/surveys/SurveyExportMixin.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/surveys/SurveyFlowVisualizationMixin.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/surveys/__init__.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/surveys/base.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/surveys/descriptors.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/tools/__init__.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/tools/clusters.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/tools/embeddings.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/tools/embeddings_plotting.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/tools/plotting.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/tools/summarize.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/utilities/SystemInfo.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/utilities/__init__.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/utilities/ast_utilities.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/utilities/data/Registry.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/utilities/data/__init__.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/utilities/data/scooter_results.json +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/utilities/decorators.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/utilities/gcp_bucket/__init__.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/utilities/gcp_bucket/cloud_storage.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/utilities/gcp_bucket/simple_example.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/utilities/interface.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/utilities/repair_functions.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/utilities/restricted_python.py +0 -0
- {edsl-0.1.30.dev2 → edsl-0.1.30.dev3}/edsl/utilities/utilities.py +0 -0
@@ -0,0 +1 @@
|
|
1
|
+
__version__ = "0.1.30.dev3"
|
@@ -4,7 +4,8 @@ from __future__ import annotations
|
|
4
4
|
import copy
|
5
5
|
import inspect
|
6
6
|
import types
|
7
|
-
from typing import
|
7
|
+
from typing import Callable, Optional, Union
|
8
|
+
from uuid import uuid4
|
8
9
|
from edsl.Base import Base
|
9
10
|
|
10
11
|
from edsl.exceptions.agents import (
|
@@ -688,13 +689,14 @@ class Agent(Base):
|
|
688
689
|
return table
|
689
690
|
|
690
691
|
@classmethod
|
691
|
-
def example(cls) -> Agent:
|
692
|
-
"""
|
692
|
+
def example(cls, randomize: bool = False) -> Agent:
|
693
|
+
"""
|
694
|
+
Returns an example Agent instance.
|
693
695
|
|
694
|
-
|
695
|
-
Agent(traits = {'age': 22, 'hair': 'brown', 'height': 5.5})
|
696
|
+
:param randomize: If True, adds a random string to the value of an example key.
|
696
697
|
"""
|
697
|
-
|
698
|
+
addition = "" if not randomize else str(uuid4())
|
699
|
+
return cls(traits={"age": 22, "hair": f"brown{addition}", "height": 5.5})
|
698
700
|
|
699
701
|
def code(self) -> str:
|
700
702
|
"""Return the code for the agent.
|
@@ -11,23 +11,15 @@ Example usage:
|
|
11
11
|
"""
|
12
12
|
|
13
13
|
from __future__ import annotations
|
14
|
+
import csv
|
15
|
+
import json
|
14
16
|
from collections import UserList
|
15
|
-
from typing import
|
17
|
+
from typing import Any, List, Optional, Union
|
16
18
|
from rich import print_json
|
17
19
|
from rich.table import Table
|
18
|
-
import json
|
19
|
-
import csv
|
20
|
-
|
21
|
-
|
22
20
|
from simpleeval import EvalWithCompoundTypes
|
23
|
-
|
24
21
|
from edsl.Base import Base
|
25
|
-
|
26
|
-
# from edsl.agents import Agent
|
27
|
-
from edsl.utilities.decorators import (
|
28
|
-
add_edsl_version,
|
29
|
-
remove_edsl_version,
|
30
|
-
)
|
22
|
+
from edsl.utilities.decorators import add_edsl_version, remove_edsl_version
|
31
23
|
|
32
24
|
|
33
25
|
class AgentList(UserList, Base):
|
@@ -239,17 +231,15 @@ class AgentList(UserList, Base):
|
|
239
231
|
return cls(agents)
|
240
232
|
|
241
233
|
@classmethod
|
242
|
-
def example(cls) ->
|
243
|
-
"""
|
244
|
-
|
245
|
-
>>> al = AgentList.example()
|
246
|
-
>>> len(al)
|
247
|
-
2
|
234
|
+
def example(cls, randomize: bool = False) -> AgentList:
|
235
|
+
"""
|
236
|
+
Returns an example AgentList instance.
|
248
237
|
|
238
|
+
:param randomize: If True, uses Agent's randomize method.
|
249
239
|
"""
|
250
240
|
from edsl.agents.Agent import Agent
|
251
241
|
|
252
|
-
return cls([Agent.example(), Agent.example()])
|
242
|
+
return cls([Agent.example(randomize), Agent.example(randomize)])
|
253
243
|
|
254
244
|
@classmethod
|
255
245
|
def from_list(self, trait_name: str, values: List[Any]):
|
@@ -97,7 +97,7 @@ class InvigilatorAI(PromptConstructorMixin, InvigilatorBase):
|
|
97
97
|
answer = question._translate_answer_code_to_answer(
|
98
98
|
response["answer"], combined_dict
|
99
99
|
)
|
100
|
-
#breakpoint()
|
100
|
+
# breakpoint()
|
101
101
|
data = {
|
102
102
|
"answer": answer,
|
103
103
|
"comment": response.get(
|
@@ -7,17 +7,10 @@ import json
|
|
7
7
|
import os
|
8
8
|
import warnings
|
9
9
|
from typing import Optional, Union
|
10
|
-
import time
|
11
|
-
from edsl.config import CONFIG
|
12
|
-
from edsl.data.CacheEntry import CacheEntry
|
13
|
-
|
14
|
-
# from edsl.data.SQLiteDict import SQLiteDict
|
15
10
|
from edsl.Base import Base
|
11
|
+
from edsl.data.CacheEntry import CacheEntry
|
16
12
|
from edsl.utilities.utilities import dict_hash
|
17
|
-
from edsl.utilities.decorators import
|
18
|
-
add_edsl_version,
|
19
|
-
remove_edsl_version,
|
20
|
-
)
|
13
|
+
from edsl.utilities.decorators import add_edsl_version, remove_edsl_version
|
21
14
|
|
22
15
|
|
23
16
|
class Cache(Base):
|
@@ -41,7 +34,7 @@ class Cache(Base):
|
|
41
34
|
data: Optional[Union["SQLiteDict", dict]] = None,
|
42
35
|
immediate_write: bool = True,
|
43
36
|
method=None,
|
44
|
-
verbose
|
37
|
+
verbose=False,
|
45
38
|
):
|
46
39
|
"""
|
47
40
|
Create two dictionaries to store the cache data.
|
@@ -480,12 +473,18 @@ class Cache(Base):
|
|
480
473
|
webbrowser.open("file://" + filepath)
|
481
474
|
|
482
475
|
@classmethod
|
483
|
-
def example(cls) -> Cache:
|
476
|
+
def example(cls, randomize: bool = False) -> Cache:
|
484
477
|
"""
|
485
|
-
|
486
|
-
|
478
|
+
Returns an example Cache instance.
|
479
|
+
|
480
|
+
:param randomize: If True, uses CacheEntry's randomize method.
|
487
481
|
"""
|
488
|
-
return cls(
|
482
|
+
return cls(
|
483
|
+
data={
|
484
|
+
CacheEntry.example(randomize).key: CacheEntry.example(),
|
485
|
+
CacheEntry.example(randomize).key: CacheEntry.example(),
|
486
|
+
}
|
487
|
+
)
|
489
488
|
|
490
489
|
|
491
490
|
if __name__ == "__main__":
|
@@ -2,11 +2,8 @@ from __future__ import annotations
|
|
2
2
|
import json
|
3
3
|
import datetime
|
4
4
|
import hashlib
|
5
|
-
import random
|
6
5
|
from typing import Optional
|
7
|
-
|
8
|
-
|
9
|
-
# TODO: Timestamp should probably be float?
|
6
|
+
from uuid import uuid4
|
10
7
|
|
11
8
|
|
12
9
|
class CacheEntry:
|
@@ -151,10 +148,12 @@ class CacheEntry:
|
|
151
148
|
@classmethod
|
152
149
|
def example(cls, randomize: bool = False) -> CacheEntry:
|
153
150
|
"""
|
154
|
-
Returns
|
151
|
+
Returns an example CacheEntry instance.
|
152
|
+
|
153
|
+
:param randomize: If True, adds a random string to the system prompt.
|
155
154
|
"""
|
156
|
-
# if random, create a
|
157
|
-
addition = "" if not randomize else str(
|
155
|
+
# if random, create a uuid
|
156
|
+
addition = "" if not randomize else str(uuid4())
|
158
157
|
return CacheEntry(
|
159
158
|
model="gpt-3.5-turbo",
|
160
159
|
parameters={"temperature": 0.5},
|
@@ -687,7 +687,9 @@ class Jobs(Base):
|
|
687
687
|
# Example methods
|
688
688
|
#######################
|
689
689
|
@classmethod
|
690
|
-
def example(
|
690
|
+
def example(
|
691
|
+
cls, throw_exception_probability: int = 0, randomize: bool = False
|
692
|
+
) -> Jobs:
|
691
693
|
"""Return an example Jobs instance.
|
692
694
|
|
693
695
|
:param throw_exception_probability: the probability that an exception will be thrown when answering a question. This is useful for testing error handling.
|
@@ -697,10 +699,13 @@ class Jobs(Base):
|
|
697
699
|
|
698
700
|
"""
|
699
701
|
import random
|
702
|
+
from uuid import uuid4
|
700
703
|
from edsl.questions import QuestionMultipleChoice
|
701
704
|
from edsl.agents.Agent import Agent
|
702
705
|
from edsl.scenarios.Scenario import Scenario
|
703
706
|
|
707
|
+
addition = "" if not randomize else str(uuid4())
|
708
|
+
|
704
709
|
# (status, question, period)
|
705
710
|
agent_answers = {
|
706
711
|
("Joyful", "how_feeling", "morning"): "OK",
|
@@ -743,7 +748,10 @@ class Jobs(Base):
|
|
743
748
|
base_survey = Survey(questions=[q1, q2])
|
744
749
|
|
745
750
|
scenario_list = ScenarioList(
|
746
|
-
[
|
751
|
+
[
|
752
|
+
Scenario({"period": f"morning{addition}"}),
|
753
|
+
Scenario({"period": "afternoon"}),
|
754
|
+
]
|
747
755
|
)
|
748
756
|
job = base_survey.by(scenario_list).by(joy_agent, sad_agent)
|
749
757
|
|
@@ -24,7 +24,7 @@ class ModelBuckets:
|
|
24
24
|
requests_bucket=self.requests_bucket + other.requests_bucket,
|
25
25
|
tokens_bucket=self.tokens_bucket + other.tokens_bucket,
|
26
26
|
)
|
27
|
-
|
27
|
+
|
28
28
|
def turbo_mode_on(self):
|
29
29
|
"""Set the refill rate to infinity for both buckets."""
|
30
30
|
self.requests_bucket.turbo_mode_on()
|
@@ -31,15 +31,15 @@ class TokenBucket:
|
|
31
31
|
pass
|
32
32
|
else:
|
33
33
|
self.turbo_mode = True
|
34
|
-
self.capacity=float("inf")
|
35
|
-
self.refill_rate=float("inf")
|
34
|
+
self.capacity = float("inf")
|
35
|
+
self.refill_rate = float("inf")
|
36
36
|
|
37
37
|
def turbo_mode_off(self):
|
38
38
|
"""Restore the refill rate to its original value."""
|
39
39
|
self.turbo_mode = False
|
40
40
|
self.capacity = self._old_capacity
|
41
41
|
self.refill_rate = self._old_refill_rate
|
42
|
-
|
42
|
+
|
43
43
|
def __add__(self, other) -> "TokenBucket":
|
44
44
|
"""Combine two token buckets.
|
45
45
|
|
@@ -30,14 +30,14 @@ class Interview(InterviewStatusMixin, InterviewTaskBuildingMixin):
|
|
30
30
|
|
31
31
|
def __init__(
|
32
32
|
self,
|
33
|
-
agent:
|
34
|
-
survey:
|
35
|
-
scenario:
|
36
|
-
model: Type[
|
33
|
+
agent: "Agent",
|
34
|
+
survey: "Survey",
|
35
|
+
scenario: "Scenario",
|
36
|
+
model: Type["LanguageModel"],
|
37
37
|
debug: Optional[bool] = False,
|
38
38
|
iteration: int = 0,
|
39
39
|
cache: "Cache" = None,
|
40
|
-
sidecar_model:
|
40
|
+
sidecar_model: "LanguageModel" = None,
|
41
41
|
):
|
42
42
|
"""Initialize the Interview instance.
|
43
43
|
|
@@ -89,6 +89,7 @@ class JobsRunnerAsyncio(JobsRunnerStatusMixin):
|
|
89
89
|
|
90
90
|
async def run_async(self, cache=None) -> Results:
|
91
91
|
from edsl.results.Results import Results
|
92
|
+
|
92
93
|
if cache is None:
|
93
94
|
self.cache = Cache()
|
94
95
|
else:
|
@@ -100,6 +101,7 @@ class JobsRunnerAsyncio(JobsRunnerStatusMixin):
|
|
100
101
|
|
101
102
|
def simple_run(self):
|
102
103
|
from edsl.results.Results import Results
|
104
|
+
|
103
105
|
data = asyncio.run(self.run_async())
|
104
106
|
return Results(survey=self.jobs.survey, data=data)
|
105
107
|
|
@@ -144,18 +144,18 @@ class QuestionTaskCreator(UserList):
|
|
144
144
|
self.task_status = TaskStatus.FAILED
|
145
145
|
raise e
|
146
146
|
|
147
|
-
## This isn't working
|
148
|
-
#breakpoint()
|
149
|
-
if results.get(
|
147
|
+
## This isn't working
|
148
|
+
# breakpoint()
|
149
|
+
if results.get("cache_used", False):
|
150
150
|
self.tokens_bucket.add_tokens(requested_tokens)
|
151
151
|
self.requests_bucket.add_tokens(1)
|
152
152
|
self.from_cache = True
|
153
|
-
#print("Turning on turbo!")
|
153
|
+
# print("Turning on turbo!")
|
154
154
|
self.tokens_bucket.turbo_mode_on()
|
155
155
|
self.requests_bucket.turbo_mode_on()
|
156
156
|
else:
|
157
|
-
#breakpoint()
|
158
|
-
#print("Turning off turbo!")
|
157
|
+
# breakpoint()
|
158
|
+
# print("Turning off turbo!")
|
159
159
|
self.tokens_bucket.turbo_mode_off()
|
160
160
|
self.requests_bucket.turbo_mode_off()
|
161
161
|
|
@@ -163,7 +163,6 @@ class QuestionTaskCreator(UserList):
|
|
163
163
|
|
164
164
|
tracker = self.cached_token_usage if self.from_cache else self.new_token_usage
|
165
165
|
|
166
|
-
|
167
166
|
# TODO: This is hacky. The 'func' call should return an object that definitely has a 'usage' key.
|
168
167
|
usage = results.get("usage", {"prompt_tokens": 0, "completion_tokens": 0})
|
169
168
|
prompt_tokens = usage.get("prompt_tokens", 0)
|
@@ -1,14 +1,11 @@
|
|
1
1
|
"""A Notebook is a utility class that allows you to easily share/pull ipynbs from Coop."""
|
2
2
|
|
3
|
+
from __future__ import annotations
|
3
4
|
import json
|
4
5
|
from typing import Dict, List, Optional
|
5
|
-
|
6
|
-
|
6
|
+
from uuid import uuid4
|
7
7
|
from edsl.Base import Base
|
8
|
-
from edsl.utilities.decorators import
|
9
|
-
add_edsl_version,
|
10
|
-
remove_edsl_version,
|
11
|
-
)
|
8
|
+
from edsl.utilities.decorators import add_edsl_version, remove_edsl_version
|
12
9
|
|
13
10
|
|
14
11
|
class Notebook(Base):
|
@@ -192,10 +189,13 @@ class Notebook(Base):
|
|
192
189
|
return table
|
193
190
|
|
194
191
|
@classmethod
|
195
|
-
def example(cls) ->
|
192
|
+
def example(cls, randomize: bool = False) -> Notebook:
|
196
193
|
"""
|
197
|
-
|
194
|
+
Returns an example Notebook instance.
|
195
|
+
|
196
|
+
:param randomize: If True, adds a random string one of the cells' output.
|
198
197
|
"""
|
198
|
+
addition = "" if not randomize else str(uuid4())
|
199
199
|
cells = [
|
200
200
|
{
|
201
201
|
"cell_type": "markdown",
|
@@ -210,7 +210,7 @@ class Notebook(Base):
|
|
210
210
|
{
|
211
211
|
"name": "stdout",
|
212
212
|
"output_type": "stream",
|
213
|
-
"text": "Hello world!\n",
|
213
|
+
"text": f"Hello world!\n{addition}",
|
214
214
|
}
|
215
215
|
],
|
216
216
|
"source": 'print("Hello world!")',
|
@@ -1,6 +1,7 @@
|
|
1
1
|
from __future__ import annotations
|
2
2
|
import textwrap
|
3
3
|
from typing import Any, Optional
|
4
|
+
from uuid import uuid4
|
4
5
|
from edsl.questions.QuestionBase import QuestionBase
|
5
6
|
|
6
7
|
|
@@ -65,9 +66,10 @@ class QuestionFreeText(QuestionBase):
|
|
65
66
|
return question_html_content
|
66
67
|
|
67
68
|
@classmethod
|
68
|
-
def example(cls) -> QuestionFreeText:
|
69
|
+
def example(cls, randomize: bool = False) -> QuestionFreeText:
|
69
70
|
"""Return an example instance of a free text question."""
|
70
|
-
|
71
|
+
addition = "" if not randomize else str(uuid4())
|
72
|
+
return cls(question_name="how_are_you", question_text=f"How are you?{addition}")
|
71
73
|
|
72
74
|
|
73
75
|
def main():
|
@@ -949,7 +949,7 @@ class Results(UserList, Mixins, Base):
|
|
949
949
|
return Results(survey=self.survey, data=new_data, created_columns=None)
|
950
950
|
|
951
951
|
@classmethod
|
952
|
-
def example(cls, debug: bool = False) -> Results:
|
952
|
+
def example(cls, debug: bool = False, randomize: bool = False) -> Results:
|
953
953
|
"""Return an example `Results` object.
|
954
954
|
|
955
955
|
Example usage:
|
@@ -962,7 +962,7 @@ class Results(UserList, Mixins, Base):
|
|
962
962
|
from edsl.data.Cache import Cache
|
963
963
|
|
964
964
|
c = Cache()
|
965
|
-
job = Jobs.example()
|
965
|
+
job = Jobs.example(randomize=randomize)
|
966
966
|
results = job.run(cache=c, debug=debug)
|
967
967
|
return results
|
968
968
|
|
@@ -31,7 +31,7 @@ class FileStore(Scenario):
|
|
31
31
|
@classmethod
|
32
32
|
def from_dict(cls, d):
|
33
33
|
return cls(d["filename"], d["binary"], d["suffix"], d["base64_string"])
|
34
|
-
|
34
|
+
|
35
35
|
def __repr__(self):
|
36
36
|
return f"FileStore(filename='{self.filename}', binary='{self.binary}', 'suffix'={self.suffix})"
|
37
37
|
|
@@ -89,7 +89,6 @@ class FileStore(Scenario):
|
|
89
89
|
# Create a StringIO object for text data
|
90
90
|
return io.StringIO(text_data)
|
91
91
|
|
92
|
-
|
93
92
|
def to_tempfile(self, suffix=None):
|
94
93
|
if suffix is None:
|
95
94
|
suffix = self.suffix
|
@@ -101,14 +100,14 @@ class FileStore(Scenario):
|
|
101
100
|
file_like_object = self.base64_to_text_file(self["base64_string"])
|
102
101
|
|
103
102
|
# Create a named temporary file
|
104
|
-
mode =
|
103
|
+
mode = "wb" if self.binary else "w"
|
105
104
|
temp_file = tempfile.NamedTemporaryFile(delete=False, suffix=suffix, mode=mode)
|
106
|
-
|
105
|
+
|
107
106
|
if self.binary:
|
108
107
|
temp_file.write(file_like_object.read())
|
109
108
|
else:
|
110
109
|
temp_file.write(file_like_object.read())
|
111
|
-
|
110
|
+
|
112
111
|
temp_file.close()
|
113
112
|
|
114
113
|
return temp_file.name
|
@@ -133,16 +132,19 @@ class CSVFileStore(FileStore):
|
|
133
132
|
@classmethod
|
134
133
|
def example(cls):
|
135
134
|
from edsl.results.Results import Results
|
135
|
+
|
136
136
|
r = Results.example()
|
137
137
|
import tempfile
|
138
|
+
|
138
139
|
with tempfile.NamedTemporaryFile(suffix=".csv", delete=False) as f:
|
139
140
|
r.to_csv(filename=f.name)
|
140
141
|
return cls(f.name)
|
141
|
-
|
142
|
+
|
142
143
|
def view(self):
|
143
144
|
import pandas as pd
|
145
|
+
|
144
146
|
return pd.read_csv(self.to_tempfile())
|
145
|
-
|
147
|
+
|
146
148
|
|
147
149
|
class PDFFileStore(FileStore):
|
148
150
|
def __init__(self, filename):
|
@@ -153,24 +155,27 @@ class PDFFileStore(FileStore):
|
|
153
155
|
print(f"PDF path: {pdf_path}") # Print the path to ensure it exists
|
154
156
|
import os
|
155
157
|
import subprocess
|
158
|
+
|
156
159
|
if os.path.exists(pdf_path):
|
157
160
|
try:
|
158
|
-
if os.name ==
|
161
|
+
if os.name == "posix":
|
159
162
|
# for cool kids
|
160
|
-
subprocess.run([
|
161
|
-
elif os.name ==
|
163
|
+
subprocess.run(["open", pdf_path], check=True) # macOS
|
164
|
+
elif os.name == "nt":
|
162
165
|
os.startfile(pdf_path) # Windows
|
163
166
|
else:
|
164
|
-
subprocess.run([
|
167
|
+
subprocess.run(["xdg-open", pdf_path], check=True) # Linux
|
165
168
|
except Exception as e:
|
166
169
|
print(f"Error opening PDF: {e}")
|
167
170
|
else:
|
168
171
|
print("PDF file was not created successfully.")
|
169
172
|
|
170
173
|
@classmethod
|
171
|
-
def example(cls):
|
174
|
+
def example(cls):
|
172
175
|
import textwrap
|
173
|
-
|
176
|
+
|
177
|
+
pdf_string = textwrap.dedent(
|
178
|
+
"""\
|
174
179
|
%PDF-1.4
|
175
180
|
1 0 obj
|
176
181
|
<< /Type /Catalog /Pages 2 0 R >>
|
@@ -210,12 +215,15 @@ class PDFFileStore(FileStore):
|
|
210
215
|
<< /Size 7 /Root 1 0 R >>
|
211
216
|
startxref
|
212
217
|
318
|
213
|
-
%%EOF"""
|
218
|
+
%%EOF"""
|
219
|
+
)
|
214
220
|
import tempfile
|
221
|
+
|
215
222
|
with tempfile.NamedTemporaryFile(suffix=".pdf", delete=False) as f:
|
216
223
|
f.write(pdf_string.encode())
|
217
224
|
return cls(f.name)
|
218
225
|
|
226
|
+
|
219
227
|
class PNGFileStore(FileStore):
|
220
228
|
def __init__(self, filename):
|
221
229
|
super().__init__(filename, suffix=".png")
|
@@ -223,19 +231,25 @@ class PNGFileStore(FileStore):
|
|
223
231
|
@classmethod
|
224
232
|
def example(cls):
|
225
233
|
import textwrap
|
226
|
-
|
234
|
+
|
235
|
+
png_string = textwrap.dedent(
|
236
|
+
"""\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x01\x00\x00\x00\x01\x00\x08\x06\x00\x00\x00\x1f\x15\xc4\x89\x00\x00\x00\x0cIDAT\x08\xd7c\x00\x01"""
|
237
|
+
)
|
227
238
|
import tempfile
|
239
|
+
|
228
240
|
with tempfile.NamedTemporaryFile(suffix=".png", delete=False) as f:
|
229
241
|
f.write(png_string.encode())
|
230
242
|
return cls(f.name)
|
231
|
-
|
243
|
+
|
232
244
|
def view(self):
|
233
245
|
import matplotlib.pyplot as plt
|
234
246
|
import matplotlib.image as mpimg
|
247
|
+
|
235
248
|
img = mpimg.imread(self.to_tempfile())
|
236
249
|
plt.imshow(img)
|
237
250
|
plt.show()
|
238
251
|
|
252
|
+
|
239
253
|
class SQLiteFileStore(FileStore):
|
240
254
|
def __init__(self, filename):
|
241
255
|
super().__init__(filename, suffix=".sqlite")
|
@@ -244,18 +258,20 @@ class SQLiteFileStore(FileStore):
|
|
244
258
|
def example(cls):
|
245
259
|
import sqlite3
|
246
260
|
import tempfile
|
261
|
+
|
247
262
|
with tempfile.NamedTemporaryFile(suffix=".sqlite", delete=False) as f:
|
248
263
|
conn = sqlite3.connect(f.name)
|
249
264
|
c = conn.cursor()
|
250
|
-
c.execute(
|
265
|
+
c.execute("""CREATE TABLE stocks (date text)""")
|
251
266
|
conn.commit()
|
252
267
|
|
253
268
|
def view(self):
|
254
269
|
import subprocess
|
255
270
|
import os
|
271
|
+
|
256
272
|
sqlite_path = self.to_tempfile()
|
257
273
|
os.system(f"sqlite3 {sqlite_path}")
|
258
|
-
|
274
|
+
|
259
275
|
|
260
276
|
if __name__ == "__main__":
|
261
277
|
# file_path = "../conjure/examples/Ex11-2.sav"
|
@@ -263,21 +279,21 @@ if __name__ == "__main__":
|
|
263
279
|
# info = fs.push()
|
264
280
|
# print(info)
|
265
281
|
|
266
|
-
#fs = CSVFileStore.example()
|
267
|
-
#fs.to_tempfile()
|
282
|
+
# fs = CSVFileStore.example()
|
283
|
+
# fs.to_tempfile()
|
268
284
|
# print(fs.view())
|
269
285
|
|
270
|
-
#fs = PDFFileStore.example()
|
271
|
-
#fs.view()
|
286
|
+
# fs = PDFFileStore.example()
|
287
|
+
# fs.view()
|
272
288
|
|
273
|
-
#fs = PDFFileStore("paper.pdf")
|
274
|
-
#fs.view()
|
289
|
+
# fs = PDFFileStore("paper.pdf")
|
290
|
+
# fs.view()
|
275
291
|
# from edsl import Conjure
|
276
292
|
|
277
293
|
fs = PNGFileStore("robot.png")
|
278
294
|
fs.view()
|
279
295
|
|
280
296
|
# c = Conjure(datafile_name=fs.to_tempfile())
|
281
|
-
#f = PDFFileStore("paper.pdf")
|
297
|
+
# f = PDFFileStore("paper.pdf")
|
282
298
|
# print(f.to_tempfile())
|
283
|
-
#f.push()
|
299
|
+
# f.push()
|
@@ -1,21 +1,17 @@
|
|
1
1
|
"""A Scenario is a dictionary with a key/value to parameterize a question."""
|
2
2
|
|
3
|
-
import
|
3
|
+
from __future__ import annotations
|
4
4
|
import copy
|
5
|
-
from collections import UserDict
|
6
|
-
from typing import Union, List, Optional, Generator
|
7
5
|
import base64
|
8
6
|
import hashlib
|
9
7
|
import os
|
10
|
-
|
8
|
+
from collections import UserDict
|
9
|
+
from typing import Union, List, Optional, Generator
|
10
|
+
from uuid import uuid4
|
11
11
|
from edsl.Base import Base
|
12
12
|
from edsl.scenarios.ScenarioImageMixin import ScenarioImageMixin
|
13
13
|
from edsl.scenarios.ScenarioHtmlMixin import ScenarioHtmlMixin
|
14
|
-
|
15
|
-
from edsl.utilities.decorators import (
|
16
|
-
add_edsl_version,
|
17
|
-
remove_edsl_version,
|
18
|
-
)
|
14
|
+
from edsl.utilities.decorators import add_edsl_version, remove_edsl_version
|
19
15
|
|
20
16
|
|
21
17
|
class Scenario(Base, UserDict, ScenarioImageMixin, ScenarioHtmlMixin):
|
@@ -28,9 +24,7 @@ class Scenario(Base, UserDict, ScenarioImageMixin, ScenarioHtmlMixin):
|
|
28
24
|
|
29
25
|
:param data: A dictionary of keys/values for parameterizing questions.
|
30
26
|
"""
|
31
|
-
if data is None
|
32
|
-
data = {}
|
33
|
-
self.data = data
|
27
|
+
self.data = data if data is not None else {}
|
34
28
|
self.name = name
|
35
29
|
|
36
30
|
def replicate(self, n: int) -> "ScenarioList":
|
@@ -415,17 +409,16 @@ class Scenario(Base, UserDict, ScenarioImageMixin, ScenarioHtmlMixin):
|
|
415
409
|
return table
|
416
410
|
|
417
411
|
@classmethod
|
418
|
-
def example(cls) ->
|
419
|
-
"""
|
420
|
-
|
421
|
-
Example:
|
412
|
+
def example(cls, randomize: bool = False) -> Scenario:
|
413
|
+
"""
|
414
|
+
Returns an example Scenario instance.
|
422
415
|
|
423
|
-
|
424
|
-
Scenario({'persona': 'A reseacher studying whether LLMs can be used to generate surveys.'})
|
416
|
+
:param randomize: If True, adds a random string to the value of the example key.
|
425
417
|
"""
|
418
|
+
addition = "" if not randomize else str(uuid4())
|
426
419
|
return cls(
|
427
420
|
{
|
428
|
-
"persona": "A reseacher studying whether LLMs can be used to generate surveys."
|
421
|
+
"persona": f"A reseacher studying whether LLMs can be used to generate surveys.{addition}",
|
429
422
|
}
|
430
423
|
)
|
431
424
|
|