edsl 0.1.38__py3-none-any.whl → 0.1.38.dev2__py3-none-any.whl
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/Base.py +31 -60
- edsl/__version__.py +1 -1
- edsl/agents/Agent.py +9 -18
- edsl/agents/AgentList.py +8 -59
- edsl/agents/Invigilator.py +7 -18
- edsl/agents/InvigilatorBase.py +19 -0
- edsl/agents/PromptConstructor.py +4 -5
- edsl/config.py +0 -8
- edsl/coop/coop.py +7 -74
- edsl/data/Cache.py +2 -27
- edsl/data/CacheEntry.py +3 -8
- edsl/data/RemoteCacheSync.py +19 -0
- edsl/enums.py +0 -2
- edsl/inference_services/GoogleService.py +15 -7
- edsl/inference_services/registry.py +0 -2
- edsl/jobs/Jobs.py +548 -88
- edsl/jobs/interviews/Interview.py +11 -11
- edsl/jobs/runners/JobsRunnerAsyncio.py +35 -140
- edsl/jobs/runners/JobsRunnerStatus.py +2 -0
- edsl/jobs/tasks/TaskHistory.py +16 -15
- edsl/language_models/LanguageModel.py +84 -44
- edsl/language_models/ModelList.py +1 -47
- edsl/language_models/registry.py +4 -57
- edsl/prompts/Prompt.py +3 -8
- edsl/questions/QuestionBase.py +16 -20
- edsl/questions/QuestionExtract.py +4 -3
- edsl/questions/question_registry.py +6 -36
- edsl/results/Dataset.py +15 -146
- edsl/results/DatasetExportMixin.py +217 -231
- edsl/results/DatasetTree.py +4 -134
- edsl/results/Result.py +9 -18
- edsl/results/Results.py +51 -145
- edsl/scenarios/FileStore.py +13 -187
- edsl/scenarios/Scenario.py +4 -61
- edsl/scenarios/ScenarioList.py +62 -237
- edsl/surveys/Survey.py +2 -16
- edsl/surveys/SurveyFlowVisualizationMixin.py +9 -67
- edsl/surveys/instructions/Instruction.py +0 -12
- edsl/templates/error_reporting/interview_details.html +3 -3
- edsl/templates/error_reporting/interviews.html +9 -18
- edsl/utilities/utilities.py +0 -15
- {edsl-0.1.38.dist-info → edsl-0.1.38.dev2.dist-info}/METADATA +1 -2
- {edsl-0.1.38.dist-info → edsl-0.1.38.dev2.dist-info}/RECORD +45 -53
- edsl/inference_services/PerplexityService.py +0 -163
- edsl/jobs/JobsChecks.py +0 -147
- edsl/jobs/JobsPrompts.py +0 -268
- edsl/jobs/JobsRemoteInferenceHandler.py +0 -239
- edsl/results/CSSParameterizer.py +0 -108
- edsl/results/TableDisplay.py +0 -198
- edsl/results/table_display.css +0 -78
- edsl/scenarios/ScenarioJoin.py +0 -127
- {edsl-0.1.38.dist-info → edsl-0.1.38.dev2.dist-info}/LICENSE +0 -0
- {edsl-0.1.38.dist-info → edsl-0.1.38.dev2.dist-info}/WHEEL +0 -0
@@ -8,7 +8,6 @@ from google.api_core.exceptions import InvalidArgument
|
|
8
8
|
from edsl.exceptions import MissingAPIKeyError
|
9
9
|
from edsl.language_models.LanguageModel import LanguageModel
|
10
10
|
from edsl.inference_services.InferenceServiceABC import InferenceServiceABC
|
11
|
-
from edsl.coop import Coop
|
12
11
|
|
13
12
|
safety_settings = [
|
14
13
|
{
|
@@ -80,8 +79,22 @@ class GoogleService(InferenceServiceABC):
|
|
80
79
|
api_token = None
|
81
80
|
model = None
|
82
81
|
|
82
|
+
@classmethod
|
83
|
+
def initialize(cls):
|
84
|
+
if cls.api_token is None:
|
85
|
+
cls.api_token = os.getenv("GOOGLE_API_KEY")
|
86
|
+
if not cls.api_token:
|
87
|
+
raise MissingAPIKeyError(
|
88
|
+
"GOOGLE_API_KEY environment variable is not set"
|
89
|
+
)
|
90
|
+
genai.configure(api_key=cls.api_token)
|
91
|
+
cls.generative_model = genai.GenerativeModel(
|
92
|
+
cls._model_, safety_settings=safety_settings
|
93
|
+
)
|
94
|
+
|
83
95
|
def __init__(self, *args, **kwargs):
|
84
96
|
super().__init__(*args, **kwargs)
|
97
|
+
self.initialize()
|
85
98
|
|
86
99
|
def get_generation_config(self) -> GenerationConfig:
|
87
100
|
return GenerationConfig(
|
@@ -103,7 +116,6 @@ class GoogleService(InferenceServiceABC):
|
|
103
116
|
if files_list is None:
|
104
117
|
files_list = []
|
105
118
|
|
106
|
-
genai.configure(api_key=self.api_token)
|
107
119
|
if (
|
108
120
|
system_prompt is not None
|
109
121
|
and system_prompt != ""
|
@@ -121,11 +133,7 @@ class GoogleService(InferenceServiceABC):
|
|
121
133
|
)
|
122
134
|
print("Will add system_prompt to user_prompt")
|
123
135
|
user_prompt = f"{system_prompt}\n{user_prompt}"
|
124
|
-
|
125
|
-
self.generative_model = genai.GenerativeModel(
|
126
|
-
self._model_,
|
127
|
-
safety_settings=safety_settings,
|
128
|
-
)
|
136
|
+
|
129
137
|
combined_prompt = [user_prompt]
|
130
138
|
for file in files_list:
|
131
139
|
if "google" not in file.external_locations:
|
@@ -12,7 +12,6 @@ from edsl.inference_services.AzureAI import AzureAIService
|
|
12
12
|
from edsl.inference_services.OllamaService import OllamaService
|
13
13
|
from edsl.inference_services.TestService import TestService
|
14
14
|
from edsl.inference_services.TogetherAIService import TogetherAIService
|
15
|
-
from edsl.inference_services.PerplexityService import PerplexityService
|
16
15
|
|
17
16
|
try:
|
18
17
|
from edsl.inference_services.MistralAIService import MistralAIService
|
@@ -32,7 +31,6 @@ services = [
|
|
32
31
|
OllamaService,
|
33
32
|
TestService,
|
34
33
|
TogetherAIService,
|
35
|
-
PerplexityService,
|
36
34
|
]
|
37
35
|
|
38
36
|
if mistral_available:
|