edsl 0.1.30.dev1__py3-none-any.whl → 0.1.30.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/__version__.py +1 -1
- edsl/agents/Invigilator.py +4 -5
- edsl/data/Cache.py +13 -3
- edsl/data_transfer_models.py +4 -0
- edsl/jobs/Jobs.py +7 -0
- edsl/jobs/buckets/ModelBuckets.py +10 -0
- edsl/jobs/buckets/TokenBucket.py +20 -3
- edsl/jobs/interviews/Interview.py +7 -6
- edsl/jobs/runners/JobsRunnerAsyncio.py +2 -0
- edsl/jobs/tasks/QuestionTaskCreator.py +15 -6
- edsl/language_models/LanguageModel.py +4 -5
- edsl/scenarios/FileStore.py +147 -4
- {edsl-0.1.30.dev1.dist-info → edsl-0.1.30.dev2.dist-info}/METADATA +1 -1
- {edsl-0.1.30.dev1.dist-info → edsl-0.1.30.dev2.dist-info}/RECORD +16 -16
- {edsl-0.1.30.dev1.dist-info → edsl-0.1.30.dev2.dist-info}/LICENSE +0 -0
- {edsl-0.1.30.dev1.dist-info → edsl-0.1.30.dev2.dist-info}/WHEEL +0 -0
edsl/__version__.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
__version__ = "0.1.30.
|
1
|
+
__version__ = "0.1.30.dev2"
|
edsl/agents/Invigilator.py
CHANGED
@@ -74,15 +74,14 @@ class InvigilatorAI(PromptConstructorMixin, InvigilatorBase):
|
|
74
74
|
|
75
75
|
This cleans up the raw response to make it suitable to pass to AgentResponseDict.
|
76
76
|
"""
|
77
|
-
# not actually used, but this removes the temptation to delete agent from the signature
|
78
77
|
_ = agent
|
79
78
|
try:
|
80
79
|
response = question._validate_answer(raw_response)
|
81
80
|
except Exception as e:
|
81
|
+
"""If the response is invalid, remove it from the cache and raise the exception."""
|
82
82
|
self._remove_from_cache(raw_response)
|
83
83
|
raise e
|
84
84
|
|
85
|
-
# breakpoint()
|
86
85
|
question_dict = self.survey.question_names_to_questions()
|
87
86
|
for other_question, answer in self.current_answers.items():
|
88
87
|
if other_question in question_dict:
|
@@ -95,12 +94,10 @@ class InvigilatorAI(PromptConstructorMixin, InvigilatorBase):
|
|
95
94
|
question_dict[new_question].comment = answer
|
96
95
|
|
97
96
|
combined_dict = {**question_dict, **scenario}
|
98
|
-
# print("combined_dict: ", combined_dict)
|
99
|
-
# print("response: ", response)
|
100
|
-
# breakpoint()
|
101
97
|
answer = question._translate_answer_code_to_answer(
|
102
98
|
response["answer"], combined_dict
|
103
99
|
)
|
100
|
+
#breakpoint()
|
104
101
|
data = {
|
105
102
|
"answer": answer,
|
106
103
|
"comment": response.get(
|
@@ -111,6 +108,8 @@ class InvigilatorAI(PromptConstructorMixin, InvigilatorBase):
|
|
111
108
|
"cached_response": raw_response.get("cached_response", None),
|
112
109
|
"usage": raw_response.get("usage", {}),
|
113
110
|
"raw_model_response": raw_model_response,
|
111
|
+
"cache_used": raw_response.get("cache_used", False),
|
112
|
+
"cache_key": raw_response.get("cache_key", None),
|
114
113
|
}
|
115
114
|
return AgentResponseDict(**data)
|
116
115
|
|
edsl/data/Cache.py
CHANGED
@@ -41,6 +41,7 @@ class Cache(Base):
|
|
41
41
|
data: Optional[Union["SQLiteDict", dict]] = None,
|
42
42
|
immediate_write: bool = True,
|
43
43
|
method=None,
|
44
|
+
verbose = False
|
44
45
|
):
|
45
46
|
"""
|
46
47
|
Create two dictionaries to store the cache data.
|
@@ -59,6 +60,7 @@ class Cache(Base):
|
|
59
60
|
self.new_entries = {}
|
60
61
|
self.new_entries_to_write_later = {}
|
61
62
|
self.coop = None
|
63
|
+
self.verbose = verbose
|
62
64
|
|
63
65
|
self.filename = filename
|
64
66
|
if filename and data:
|
@@ -122,7 +124,7 @@ class Cache(Base):
|
|
122
124
|
system_prompt: str,
|
123
125
|
user_prompt: str,
|
124
126
|
iteration: int,
|
125
|
-
) -> Union[None, str]:
|
127
|
+
) -> tuple(Union[None, str], str):
|
126
128
|
"""
|
127
129
|
Fetch a value (LLM output) from the cache.
|
128
130
|
|
@@ -135,7 +137,7 @@ class Cache(Base):
|
|
135
137
|
Return None if the response is not found.
|
136
138
|
|
137
139
|
>>> c = Cache()
|
138
|
-
>>> c.fetch(model="gpt-3", parameters="default", system_prompt="Hello", user_prompt="Hi", iteration=1) is None
|
140
|
+
>>> c.fetch(model="gpt-3", parameters="default", system_prompt="Hello", user_prompt="Hi", iteration=1)[0] is None
|
139
141
|
True
|
140
142
|
|
141
143
|
|
@@ -151,8 +153,13 @@ class Cache(Base):
|
|
151
153
|
)
|
152
154
|
entry = self.data.get(key, None)
|
153
155
|
if entry is not None:
|
156
|
+
if self.verbose:
|
157
|
+
print(f"Cache hit for key: {key}")
|
154
158
|
self.fetched_data[key] = entry
|
155
|
-
|
159
|
+
else:
|
160
|
+
if self.verbose:
|
161
|
+
print(f"Cache miss for key: {key}")
|
162
|
+
return None if entry is None else entry.output, key
|
156
163
|
|
157
164
|
def store(
|
158
165
|
self,
|
@@ -354,6 +361,9 @@ class Cache(Base):
|
|
354
361
|
for key, entry in self.new_entries_to_write_later.items():
|
355
362
|
self.data[key] = entry
|
356
363
|
|
364
|
+
if self.filename:
|
365
|
+
self.write(self.filename)
|
366
|
+
|
357
367
|
####################
|
358
368
|
# DUNDER / USEFUL
|
359
369
|
####################
|
edsl/data_transfer_models.py
CHANGED
@@ -17,6 +17,8 @@ class AgentResponseDict(UserDict):
|
|
17
17
|
cached_response=None,
|
18
18
|
raw_model_response=None,
|
19
19
|
simple_model_raw_response=None,
|
20
|
+
cache_used=None,
|
21
|
+
cache_key=None,
|
20
22
|
):
|
21
23
|
"""Initialize the AgentResponseDict object."""
|
22
24
|
usage = usage or {"prompt_tokens": 0, "completion_tokens": 0}
|
@@ -30,5 +32,7 @@ class AgentResponseDict(UserDict):
|
|
30
32
|
"cached_response": cached_response,
|
31
33
|
"raw_model_response": raw_model_response,
|
32
34
|
"simple_model_raw_response": simple_model_raw_response,
|
35
|
+
"cache_used": cache_used,
|
36
|
+
"cache_key": cache_key,
|
33
37
|
}
|
34
38
|
)
|
edsl/jobs/Jobs.py
CHANGED
@@ -461,6 +461,13 @@ class Jobs(Base):
|
|
461
461
|
remote_inference = False
|
462
462
|
|
463
463
|
if remote_inference:
|
464
|
+
from edsl.agents.Agent import Agent
|
465
|
+
from edsl.language_models.registry import Model
|
466
|
+
from edsl.results.Result import Result
|
467
|
+
from edsl.results.Results import Results
|
468
|
+
from edsl.scenarios.Scenario import Scenario
|
469
|
+
from edsl.surveys.Survey import Survey
|
470
|
+
|
464
471
|
self._output("Remote inference activated. Sending job to server...")
|
465
472
|
if remote_cache:
|
466
473
|
self._output(
|
@@ -24,6 +24,16 @@ 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
|
+
|
28
|
+
def turbo_mode_on(self):
|
29
|
+
"""Set the refill rate to infinity for both buckets."""
|
30
|
+
self.requests_bucket.turbo_mode_on()
|
31
|
+
self.tokens_bucket.turbo_mode_on()
|
32
|
+
|
33
|
+
def turbo_mode_off(self):
|
34
|
+
"""Restore the refill rate to its original value for both buckets."""
|
35
|
+
self.requests_bucket.turbo_mode_off()
|
36
|
+
self.tokens_bucket.turbo_mode_off()
|
27
37
|
|
28
38
|
@classmethod
|
29
39
|
def infinity_bucket(cls, model_name: str = "not_specified") -> "ModelBuckets":
|
edsl/jobs/buckets/TokenBucket.py
CHANGED
@@ -17,12 +17,29 @@ class TokenBucket:
|
|
17
17
|
self.bucket_name = bucket_name
|
18
18
|
self.bucket_type = bucket_type
|
19
19
|
self.capacity = capacity # Maximum number of tokens
|
20
|
+
self._old_capacity = capacity
|
20
21
|
self.tokens = capacity # Current number of available tokens
|
21
22
|
self.refill_rate = refill_rate # Rate at which tokens are refilled
|
23
|
+
self._old_refill_rate = refill_rate
|
22
24
|
self.last_refill = time.monotonic() # Last refill time
|
23
|
-
|
24
25
|
self.log: List[Any] = []
|
25
|
-
|
26
|
+
self.turbo_mode = False
|
27
|
+
|
28
|
+
def turbo_mode_on(self):
|
29
|
+
"""Set the refill rate to infinity."""
|
30
|
+
if self.turbo_mode:
|
31
|
+
pass
|
32
|
+
else:
|
33
|
+
self.turbo_mode = True
|
34
|
+
self.capacity=float("inf")
|
35
|
+
self.refill_rate=float("inf")
|
36
|
+
|
37
|
+
def turbo_mode_off(self):
|
38
|
+
"""Restore the refill rate to its original value."""
|
39
|
+
self.turbo_mode = False
|
40
|
+
self.capacity = self._old_capacity
|
41
|
+
self.refill_rate = self._old_refill_rate
|
42
|
+
|
26
43
|
def __add__(self, other) -> "TokenBucket":
|
27
44
|
"""Combine two token buckets.
|
28
45
|
|
@@ -98,7 +115,7 @@ class TokenBucket:
|
|
98
115
|
raise ValueError(msg)
|
99
116
|
while self.tokens < amount:
|
100
117
|
self.refill()
|
101
|
-
await asyncio.sleep(0.
|
118
|
+
await asyncio.sleep(0.01) # Sleep briefly to prevent busy waiting
|
102
119
|
self.tokens -= amount
|
103
120
|
|
104
121
|
now = time.monotonic()
|
@@ -30,14 +30,14 @@ class Interview(InterviewStatusMixin, InterviewTaskBuildingMixin):
|
|
30
30
|
|
31
31
|
def __init__(
|
32
32
|
self,
|
33
|
-
agent: Agent,
|
34
|
-
survey: Survey,
|
35
|
-
scenario: Scenario,
|
36
|
-
model: Type[LanguageModel],
|
37
|
-
debug: bool = False,
|
33
|
+
agent: 'Agent',
|
34
|
+
survey: 'Survey',
|
35
|
+
scenario: 'Scenario',
|
36
|
+
model: Type['LanguageModel'],
|
37
|
+
debug: Optional[bool] = False,
|
38
38
|
iteration: int = 0,
|
39
39
|
cache: "Cache" = None,
|
40
|
-
sidecar_model: LanguageModel = None,
|
40
|
+
sidecar_model: 'LanguageModel' = None,
|
41
41
|
):
|
42
42
|
"""Initialize the Interview instance.
|
43
43
|
|
@@ -99,6 +99,7 @@ class Interview(InterviewStatusMixin, InterviewTaskBuildingMixin):
|
|
99
99
|
if model_buckets is None or hasattr(self.agent, "answer_question_directly"):
|
100
100
|
model_buckets = ModelBuckets.infinity_bucket()
|
101
101
|
|
102
|
+
# FOR TESTING
|
102
103
|
# model_buckets = ModelBuckets.infinity_bucket()
|
103
104
|
|
104
105
|
## build the tasks using the InterviewTaskBuildingMixin
|
@@ -88,6 +88,7 @@ class JobsRunnerAsyncio(JobsRunnerStatusMixin):
|
|
88
88
|
self.total_interviews.append(interview)
|
89
89
|
|
90
90
|
async def run_async(self, cache=None) -> Results:
|
91
|
+
from edsl.results.Results import Results
|
91
92
|
if cache is None:
|
92
93
|
self.cache = Cache()
|
93
94
|
else:
|
@@ -98,6 +99,7 @@ class JobsRunnerAsyncio(JobsRunnerStatusMixin):
|
|
98
99
|
return Results(survey=self.jobs.survey, data=data)
|
99
100
|
|
100
101
|
def simple_run(self):
|
102
|
+
from edsl.results.Results import Results
|
101
103
|
data = asyncio.run(self.run_async())
|
102
104
|
return Results(survey=self.jobs.survey, data=data)
|
103
105
|
|
@@ -144,17 +144,26 @@ class QuestionTaskCreator(UserList):
|
|
144
144
|
self.task_status = TaskStatus.FAILED
|
145
145
|
raise e
|
146
146
|
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
147
|
+
## This isn't working
|
148
|
+
#breakpoint()
|
149
|
+
if results.get('cache_used', False):
|
150
|
+
self.tokens_bucket.add_tokens(requested_tokens)
|
151
|
+
self.requests_bucket.add_tokens(1)
|
152
|
+
self.from_cache = True
|
153
|
+
#print("Turning on turbo!")
|
154
|
+
self.tokens_bucket.turbo_mode_on()
|
155
|
+
self.requests_bucket.turbo_mode_on()
|
156
|
+
else:
|
157
|
+
#breakpoint()
|
158
|
+
#print("Turning off turbo!")
|
159
|
+
self.tokens_bucket.turbo_mode_off()
|
160
|
+
self.requests_bucket.turbo_mode_off()
|
153
161
|
|
154
162
|
_ = results.pop("cached_response", None)
|
155
163
|
|
156
164
|
tracker = self.cached_token_usage if self.from_cache else self.new_token_usage
|
157
165
|
|
166
|
+
|
158
167
|
# TODO: This is hacky. The 'func' call should return an object that definitely has a 'usage' key.
|
159
168
|
usage = results.get("usage", {"prompt_tokens": 0, "completion_tokens": 0})
|
160
169
|
prompt_tokens = usage.get("prompt_tokens", 0)
|
@@ -323,12 +323,10 @@ class LanguageModel(
|
|
323
323
|
image_hash = hashlib.md5(encoded_image.encode()).hexdigest()
|
324
324
|
cache_call_params["user_prompt"] = f"{user_prompt} {image_hash}"
|
325
325
|
|
326
|
-
cached_response = cache.fetch(**cache_call_params)
|
327
|
-
|
326
|
+
cached_response, cache_key = cache.fetch(**cache_call_params)
|
328
327
|
if cached_response:
|
329
328
|
response = json.loads(cached_response)
|
330
329
|
cache_used = True
|
331
|
-
cache_key = None
|
332
330
|
else:
|
333
331
|
remote_call = hasattr(self, "remote") and self.remote
|
334
332
|
f = (
|
@@ -340,7 +338,7 @@ class LanguageModel(
|
|
340
338
|
if encoded_image:
|
341
339
|
params["encoded_image"] = encoded_image
|
342
340
|
response = await f(**params)
|
343
|
-
|
341
|
+
new_cache_key = cache.store(
|
344
342
|
user_prompt=user_prompt,
|
345
343
|
model=str(self.model),
|
346
344
|
parameters=self.parameters,
|
@@ -348,6 +346,7 @@ class LanguageModel(
|
|
348
346
|
response=response,
|
349
347
|
iteration=iteration,
|
350
348
|
)
|
349
|
+
assert new_cache_key == cache_key
|
351
350
|
cache_used = False
|
352
351
|
|
353
352
|
return response, cache_used, cache_key
|
@@ -412,7 +411,7 @@ class LanguageModel(
|
|
412
411
|
|
413
412
|
dict_response.update(
|
414
413
|
{
|
415
|
-
"
|
414
|
+
"cache_used": cache_used,
|
416
415
|
"cache_key": cache_key,
|
417
416
|
"usage": raw_response.get("usage", {}),
|
418
417
|
"raw_model_response": raw_response,
|
edsl/scenarios/FileStore.py
CHANGED
@@ -31,6 +31,9 @@ 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
|
+
|
35
|
+
def __repr__(self):
|
36
|
+
return f"FileStore(filename='{self.filename}', binary='{self.binary}', 'suffix'={self.suffix})"
|
34
37
|
|
35
38
|
def encode_file_to_base64_string(self, file_path):
|
36
39
|
try:
|
@@ -86,6 +89,7 @@ class FileStore(Scenario):
|
|
86
89
|
# Create a StringIO object for text data
|
87
90
|
return io.StringIO(text_data)
|
88
91
|
|
92
|
+
|
89
93
|
def to_tempfile(self, suffix=None):
|
90
94
|
if suffix is None:
|
91
95
|
suffix = self.suffix
|
@@ -97,8 +101,14 @@ class FileStore(Scenario):
|
|
97
101
|
file_like_object = self.base64_to_text_file(self["base64_string"])
|
98
102
|
|
99
103
|
# Create a named temporary file
|
100
|
-
|
101
|
-
temp_file.
|
104
|
+
mode = 'wb' if self.binary else 'w'
|
105
|
+
temp_file = tempfile.NamedTemporaryFile(delete=False, suffix=suffix, mode=mode)
|
106
|
+
|
107
|
+
if self.binary:
|
108
|
+
temp_file.write(file_like_object.read())
|
109
|
+
else:
|
110
|
+
temp_file.write(file_like_object.read())
|
111
|
+
|
102
112
|
temp_file.close()
|
103
113
|
|
104
114
|
return temp_file.name
|
@@ -120,11 +130,132 @@ class CSVFileStore(FileStore):
|
|
120
130
|
def __init__(self, filename):
|
121
131
|
super().__init__(filename, suffix=".csv")
|
122
132
|
|
133
|
+
@classmethod
|
134
|
+
def example(cls):
|
135
|
+
from edsl.results.Results import Results
|
136
|
+
r = Results.example()
|
137
|
+
import tempfile
|
138
|
+
with tempfile.NamedTemporaryFile(suffix=".csv", delete=False) as f:
|
139
|
+
r.to_csv(filename=f.name)
|
140
|
+
return cls(f.name)
|
141
|
+
|
142
|
+
def view(self):
|
143
|
+
import pandas as pd
|
144
|
+
return pd.read_csv(self.to_tempfile())
|
145
|
+
|
123
146
|
|
124
147
|
class PDFFileStore(FileStore):
|
125
148
|
def __init__(self, filename):
|
126
149
|
super().__init__(filename, suffix=".pdf")
|
127
150
|
|
151
|
+
def view(self):
|
152
|
+
pdf_path = self.to_tempfile()
|
153
|
+
print(f"PDF path: {pdf_path}") # Print the path to ensure it exists
|
154
|
+
import os
|
155
|
+
import subprocess
|
156
|
+
if os.path.exists(pdf_path):
|
157
|
+
try:
|
158
|
+
if os.name == 'posix':
|
159
|
+
# for cool kids
|
160
|
+
subprocess.run(['open', pdf_path], check=True) # macOS
|
161
|
+
elif os.name == 'nt':
|
162
|
+
os.startfile(pdf_path) # Windows
|
163
|
+
else:
|
164
|
+
subprocess.run(['xdg-open', pdf_path], check=True) # Linux
|
165
|
+
except Exception as e:
|
166
|
+
print(f"Error opening PDF: {e}")
|
167
|
+
else:
|
168
|
+
print("PDF file was not created successfully.")
|
169
|
+
|
170
|
+
@classmethod
|
171
|
+
def example(cls):
|
172
|
+
import textwrap
|
173
|
+
pdf_string = textwrap.dedent("""\
|
174
|
+
%PDF-1.4
|
175
|
+
1 0 obj
|
176
|
+
<< /Type /Catalog /Pages 2 0 R >>
|
177
|
+
endobj
|
178
|
+
2 0 obj
|
179
|
+
<< /Type /Pages /Kids [3 0 R] /Count 1 >>
|
180
|
+
endobj
|
181
|
+
3 0 obj
|
182
|
+
<< /Type /Page /Parent 2 0 R /MediaBox [0 0 612 792] /Contents 4 0 R >>
|
183
|
+
endobj
|
184
|
+
4 0 obj
|
185
|
+
<< /Length 44 >>
|
186
|
+
stream
|
187
|
+
BT
|
188
|
+
/F1 24 Tf
|
189
|
+
100 700 Td
|
190
|
+
(Hello, World!) Tj
|
191
|
+
ET
|
192
|
+
endstream
|
193
|
+
endobj
|
194
|
+
5 0 obj
|
195
|
+
<< /Type /Font /Subtype /Type1 /BaseFont /Helvetica >>
|
196
|
+
endobj
|
197
|
+
6 0 obj
|
198
|
+
<< /ProcSet [/PDF /Text] /Font << /F1 5 0 R >> >>
|
199
|
+
endobj
|
200
|
+
xref
|
201
|
+
0 7
|
202
|
+
0000000000 65535 f
|
203
|
+
0000000010 00000 n
|
204
|
+
0000000053 00000 n
|
205
|
+
0000000100 00000 n
|
206
|
+
0000000173 00000 n
|
207
|
+
0000000232 00000 n
|
208
|
+
0000000272 00000 n
|
209
|
+
trailer
|
210
|
+
<< /Size 7 /Root 1 0 R >>
|
211
|
+
startxref
|
212
|
+
318
|
213
|
+
%%EOF""")
|
214
|
+
import tempfile
|
215
|
+
with tempfile.NamedTemporaryFile(suffix=".pdf", delete=False) as f:
|
216
|
+
f.write(pdf_string.encode())
|
217
|
+
return cls(f.name)
|
218
|
+
|
219
|
+
class PNGFileStore(FileStore):
|
220
|
+
def __init__(self, filename):
|
221
|
+
super().__init__(filename, suffix=".png")
|
222
|
+
|
223
|
+
@classmethod
|
224
|
+
def example(cls):
|
225
|
+
import textwrap
|
226
|
+
png_string = textwrap.dedent("""\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""")
|
227
|
+
import tempfile
|
228
|
+
with tempfile.NamedTemporaryFile(suffix=".png", delete=False) as f:
|
229
|
+
f.write(png_string.encode())
|
230
|
+
return cls(f.name)
|
231
|
+
|
232
|
+
def view(self):
|
233
|
+
import matplotlib.pyplot as plt
|
234
|
+
import matplotlib.image as mpimg
|
235
|
+
img = mpimg.imread(self.to_tempfile())
|
236
|
+
plt.imshow(img)
|
237
|
+
plt.show()
|
238
|
+
|
239
|
+
class SQLiteFileStore(FileStore):
|
240
|
+
def __init__(self, filename):
|
241
|
+
super().__init__(filename, suffix=".sqlite")
|
242
|
+
|
243
|
+
@classmethod
|
244
|
+
def example(cls):
|
245
|
+
import sqlite3
|
246
|
+
import tempfile
|
247
|
+
with tempfile.NamedTemporaryFile(suffix=".sqlite", delete=False) as f:
|
248
|
+
conn = sqlite3.connect(f.name)
|
249
|
+
c = conn.cursor()
|
250
|
+
c.execute('''CREATE TABLE stocks (date text)''')
|
251
|
+
conn.commit()
|
252
|
+
|
253
|
+
def view(self):
|
254
|
+
import subprocess
|
255
|
+
import os
|
256
|
+
sqlite_path = self.to_tempfile()
|
257
|
+
os.system(f"sqlite3 {sqlite_path}")
|
258
|
+
|
128
259
|
|
129
260
|
if __name__ == "__main__":
|
130
261
|
# file_path = "../conjure/examples/Ex11-2.sav"
|
@@ -132,9 +263,21 @@ if __name__ == "__main__":
|
|
132
263
|
# info = fs.push()
|
133
264
|
# print(info)
|
134
265
|
|
266
|
+
#fs = CSVFileStore.example()
|
267
|
+
#fs.to_tempfile()
|
268
|
+
# print(fs.view())
|
269
|
+
|
270
|
+
#fs = PDFFileStore.example()
|
271
|
+
#fs.view()
|
272
|
+
|
273
|
+
#fs = PDFFileStore("paper.pdf")
|
274
|
+
#fs.view()
|
135
275
|
# from edsl import Conjure
|
136
276
|
|
277
|
+
fs = PNGFileStore("robot.png")
|
278
|
+
fs.view()
|
279
|
+
|
137
280
|
# c = Conjure(datafile_name=fs.to_tempfile())
|
138
|
-
f = PDFFileStore("paper.pdf")
|
281
|
+
#f = PDFFileStore("paper.pdf")
|
139
282
|
# print(f.to_tempfile())
|
140
|
-
f.push()
|
283
|
+
#f.push()
|
@@ -1,10 +1,10 @@
|
|
1
1
|
edsl/Base.py,sha256=ttNxUotSd9LSEJl2w6LdMtT78d0nMQvYDJ0q4JkqBfg,8945
|
2
2
|
edsl/BaseDiff.py,sha256=RoVEh52UJs22yMa7k7jv8se01G62jJNWnBzaZngo-Ug,8260
|
3
3
|
edsl/__init__.py,sha256=E6PkWI_owu8AUc4uJs2XWDVozqSbcRWzsIqf8_Kskho,1631
|
4
|
-
edsl/__version__.py,sha256
|
4
|
+
edsl/__version__.py,sha256=-lT1XKLeTsH6U1YdFFpTqOAdz-C3X4Rpkde8dWxY83s,28
|
5
5
|
edsl/agents/Agent.py,sha256=nSAwyfro0aj2qezDb-CfTIoSQb35ZC6xQTx2A5pph3s,27085
|
6
6
|
edsl/agents/AgentList.py,sha256=07RpCsqAJxyAEMY4NvvqWOXSk11i6b80UZhOwa1-y9A,9468
|
7
|
-
edsl/agents/Invigilator.py,sha256=
|
7
|
+
edsl/agents/Invigilator.py,sha256=RQ4tnBCzG4u-0f_IJt6bhoRxxvbGlVJ29CE1eFpvv8M,10797
|
8
8
|
edsl/agents/InvigilatorBase.py,sha256=ncha1HF2V1Dz4f50Gekg6AzUXCD2Af82ztfSJZbgOHY,7469
|
9
9
|
edsl/agents/PromptConstructionMixin.py,sha256=MP2Frmm9iP3J50ijXKrr6YYIjB_38UuA2J7Mysfs0ZQ,15913
|
10
10
|
edsl/agents/__init__.py,sha256=a3H1lxDwu9HR8fwh79C5DgxPSFv_bE2rzQ6y1D8Ba5c,80
|
@@ -34,13 +34,13 @@ edsl/conversation/next_speaker_utilities.py,sha256=bqr5JglCd6bdLc9IZ5zGOAsmN2F4E
|
|
34
34
|
edsl/coop/__init__.py,sha256=4iZCwJSzJVyjBYk8ggGxY2kZjq9dXVT1jhyPDNyew4I,115
|
35
35
|
edsl/coop/coop.py,sha256=Kv6oUOZ9uuxxR59Rn6IG-tB3JaN2z8AnHVW8G-RSLQE,26928
|
36
36
|
edsl/coop/utils.py,sha256=BeBcMWWl9Kxjll_WfDQNHbp-6ct9QjVn4ph2V4ph6XE,3347
|
37
|
-
edsl/data/Cache.py,sha256=
|
37
|
+
edsl/data/Cache.py,sha256=0xpTrLTD9E76RgvrhBN0qsEGEwvy3xA7OoqoF-bLdQE,15532
|
38
38
|
edsl/data/CacheEntry.py,sha256=AnZBUautQc19KhE6NkI87U_P9wDZI2eu-8B1XopPTOI,7235
|
39
39
|
edsl/data/CacheHandler.py,sha256=DTr8nJnbl_SidhsDetqbshu1DV-njPFiPPosUWTIBok,4789
|
40
40
|
edsl/data/SQLiteDict.py,sha256=V5Nfnxctgh4Iblqcw1KmbnkjtfmWrrombROSQ3mvg6A,8979
|
41
41
|
edsl/data/__init__.py,sha256=KBNGGEuGHq--D-TlpAQmvv_If906dJc1Gsy028zOx78,170
|
42
42
|
edsl/data/orm.py,sha256=Jz6rvw5SrlxwysTL0QI9r68EflKxeEBmf6j6himHDS8,238
|
43
|
-
edsl/data_transfer_models.py,sha256=
|
43
|
+
edsl/data_transfer_models.py,sha256=XAkM85ATAJJdOLYj165U1XUsGDu1Mv7KzJAAYdJEXUY,1158
|
44
44
|
edsl/enums.py,sha256=lW4rMKJJ-AsBdtDw_u6TitlNbHkTznorVPjqqmUKPE0,4876
|
45
45
|
edsl/exceptions/__init__.py,sha256=HVg-U-rJ0fRoG9Rws6gnK5S9B68SkPWDPsoD6KpMZ-A,1370
|
46
46
|
edsl/exceptions/agents.py,sha256=3SORFwFbMGrF6-vAL2GrKEVdPcXo7md_k2oYufnVXHA,673
|
@@ -66,12 +66,12 @@ edsl/inference_services/rate_limits_cache.py,sha256=HYslviz7mxF9U4CUTPAkoyBsiXjS
|
|
66
66
|
edsl/inference_services/registry.py,sha256=-Yz86do-KZraunIrziVs9b95EbY-__JUnQb5Ulni7KI,483
|
67
67
|
edsl/inference_services/write_available.py,sha256=NNwhATlaMp8IYY635MSx-oYxt5X15acjAfaqYCo_I1Y,285
|
68
68
|
edsl/jobs/Answers.py,sha256=z4TADN-iHIrbMtI1jVyiaetv0OkTv768dFBpREIQC6c,1799
|
69
|
-
edsl/jobs/Jobs.py,sha256=
|
69
|
+
edsl/jobs/Jobs.py,sha256=lxeq6xc6zvtFQGDQDfNvnaOw03eWKpmPiQiQZGH9ITY,29146
|
70
70
|
edsl/jobs/__init__.py,sha256=aKuAyd_GoalGj-k7djOoVwEbFUE2XLPlikXaA1_8yAg,32
|
71
71
|
edsl/jobs/buckets/BucketCollection.py,sha256=LA8DBVwMdeTFCbSDI0S2cDzfi_Qo6kRizwrG64tE8S4,1844
|
72
|
-
edsl/jobs/buckets/ModelBuckets.py,sha256=
|
73
|
-
edsl/jobs/buckets/TokenBucket.py,sha256=
|
74
|
-
edsl/jobs/interviews/Interview.py,sha256
|
72
|
+
edsl/jobs/buckets/ModelBuckets.py,sha256=GBKnKOuiKoF2ENStDnAP-0Jy0m7jwyydXTPmvuOp6r0,2423
|
73
|
+
edsl/jobs/buckets/TokenBucket.py,sha256=TWKT-Ks_WOqM_DWG3b-ILFwLSeFTqGh80ITXH5uCEkc,5773
|
74
|
+
edsl/jobs/interviews/Interview.py,sha256=-BQTCW99N1_DeYWt--PHOvlblyRo9FhnbjqE0lHed14,9750
|
75
75
|
edsl/jobs/interviews/InterviewStatistic.py,sha256=hY5d2EkIJ96NilPpZAvZZzZoxLXM7ss3xx5MIcKtTPs,1856
|
76
76
|
edsl/jobs/interviews/InterviewStatisticsCollection.py,sha256=_ZZ0fnZBQiIywP9Q_wWjpWhlfcPe2cn32GKut10t5RI,788
|
77
77
|
edsl/jobs/interviews/InterviewStatusDictionary.py,sha256=MSyys4hOWe1d8gfsUvAPbcKrs8YiPnz8jpufBSJL7SU,2485
|
@@ -82,10 +82,10 @@ edsl/jobs/interviews/ReportErrors.py,sha256=RSzDU2rWwtjfztj7sqaMab0quCiY-X2bG3AE
|
|
82
82
|
edsl/jobs/interviews/interview_exception_tracking.py,sha256=tIcX92udnkE5fcM5_WXjRF9xgTq2P0uaDXxZf3NQGG0,3271
|
83
83
|
edsl/jobs/interviews/interview_status_enum.py,sha256=KJ-1yLAHdX-p8TiFnM0M3v1tnBwkq4aMCuBX6-ytrI8,229
|
84
84
|
edsl/jobs/interviews/retry_management.py,sha256=9Efn4B3aV45vbocnF6J5WQt88i2FgFjoi5ALzGUukEE,1375
|
85
|
-
edsl/jobs/runners/JobsRunnerAsyncio.py,sha256=
|
85
|
+
edsl/jobs/runners/JobsRunnerAsyncio.py,sha256=rKtNF1CXN9_9JjvNYEpouI2jLGRZPyesq3hH4rIYbmY,11932
|
86
86
|
edsl/jobs/runners/JobsRunnerStatusData.py,sha256=-mxcmX0a38GGO9DQ-ItTmj6mvCUk5uC-UudT77lXTG4,10327
|
87
87
|
edsl/jobs/runners/JobsRunnerStatusMixin.py,sha256=yxnXuOovwHgfDokNuluH_qulBcM0gCcbpCQibqVKXFI,3137
|
88
|
-
edsl/jobs/tasks/QuestionTaskCreator.py,sha256=
|
88
|
+
edsl/jobs/tasks/QuestionTaskCreator.py,sha256=UjCCVGJ5L4xe96v-LWG2w6uYKYvRQm--5HFeijH9GNM,10481
|
89
89
|
edsl/jobs/tasks/TaskCreators.py,sha256=DbCt5BzJ0CsMSquqLyLdk8el031Wst7vCszVW5EltX8,2418
|
90
90
|
edsl/jobs/tasks/TaskHistory.py,sha256=ZVellGW1cvwqdHt98dYPl0FYhk3VqRGHAZETDOxEkqg,10939
|
91
91
|
edsl/jobs/tasks/TaskStatusLog.py,sha256=bqH36a32F12fjX-M-4lNOhHaK2-WLFzKE-r0PxZPRjI,546
|
@@ -93,7 +93,7 @@ edsl/jobs/tasks/task_management.py,sha256=KMToZuXzMlnHRHUF_VHL0-lHMTGhklf2GHVuwE
|
|
93
93
|
edsl/jobs/tasks/task_status_enum.py,sha256=DOyrz61YlIS8R1W7izJNphcLrJ7I_ReUlfdRmk23h0Q,5333
|
94
94
|
edsl/jobs/tokens/InterviewTokenUsage.py,sha256=u_6-IHpGFwZ6qMEXr24-jyLVUSSp4dSs_4iAZsBv7O4,1100
|
95
95
|
edsl/jobs/tokens/TokenUsage.py,sha256=odj2-wDNEbHl9noyFAQ0DSKV0D9cv3aDOpmXufKZ8O4,1323
|
96
|
-
edsl/language_models/LanguageModel.py,sha256=
|
96
|
+
edsl/language_models/LanguageModel.py,sha256=r2wLIaF2vTlCNjEhDrDRKOZozmWvw6KkCEANLnZXOPE,18916
|
97
97
|
edsl/language_models/ModelList.py,sha256=DLeAq7o8uniZkP_-z8vJDMwf4JXksqLoPqOeeLI3QBE,2687
|
98
98
|
edsl/language_models/RegisterLanguageModelsMeta.py,sha256=2bvWrVau2BRo-Bb1aO-QATH8xxuW_tF7NmqBMGDOfSg,8191
|
99
99
|
edsl/language_models/__init__.py,sha256=bvY7Gy6VkX1gSbNkRbGPS-M1kUnb0EohL0FSagaEaTs,109
|
@@ -151,7 +151,7 @@ edsl/results/ResultsFetchMixin.py,sha256=VEa0TKDcXbnTinSKs9YaE4WjOSLmlp9Po1_9kkl
|
|
151
151
|
edsl/results/ResultsGGMixin.py,sha256=SAYz8p4wb1g8x6KhBVz9NHOGib2c2XsqtTclpADrFeM,4344
|
152
152
|
edsl/results/ResultsToolsMixin.py,sha256=I19kAO-BKszgjxzMljE1W8ZsOnpozmO2nc43-XBbrZk,2976
|
153
153
|
edsl/results/__init__.py,sha256=2YcyiVtXi-3vIV0ZzOy1PqBLm2gaziufJVi4fdNrAt8,80
|
154
|
-
edsl/scenarios/FileStore.py,sha256=
|
154
|
+
edsl/scenarios/FileStore.py,sha256=UNlPRq0lAG0UJyVT60IZF52l4PBSzhkq4OVqvPMlN6c,8743
|
155
155
|
edsl/scenarios/Scenario.py,sha256=KCMze1PL0uxLMrqaneEXZBDc65q7AUV71zZIEmeGSVo,14766
|
156
156
|
edsl/scenarios/ScenarioHtmlMixin.py,sha256=EmugmbPJYW5eZS30rM6pDMDQD9yrrvHjmgZWB1qBfq4,1882
|
157
157
|
edsl/scenarios/ScenarioImageMixin.py,sha256=VJ5FqyPrL5-ieORlWMpnjmOAFIau8QFZCIZyEBKgb6I,3530
|
@@ -197,7 +197,7 @@ edsl/utilities/interface.py,sha256=AaKpWiwWBwP2swNXmnFlIf3ZFsjfsR5bjXQAW47tD-8,1
|
|
197
197
|
edsl/utilities/repair_functions.py,sha256=tftmklAqam6LOQQu_-9U44N-llycffhW8LfO63vBmNw,929
|
198
198
|
edsl/utilities/restricted_python.py,sha256=5-_zUhrNbos7pLhDl9nr8d24auRlquR6w-vKkmNjPiA,2060
|
199
199
|
edsl/utilities/utilities.py,sha256=oU5Gg6szTGqsJ2yBOS0aC3XooezLE8By3SdrQLLpqvA,10107
|
200
|
-
edsl-0.1.30.
|
201
|
-
edsl-0.1.30.
|
202
|
-
edsl-0.1.30.
|
203
|
-
edsl-0.1.30.
|
200
|
+
edsl-0.1.30.dev2.dist-info/LICENSE,sha256=_qszBDs8KHShVYcYzdMz3HNMtH-fKN_p5zjoVAVumFc,1111
|
201
|
+
edsl-0.1.30.dev2.dist-info/METADATA,sha256=E88M0TlFjZQbNyP7oupVGflYCzZ7Mgni7nKm25RaD5U,4103
|
202
|
+
edsl-0.1.30.dev2.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
|
203
|
+
edsl-0.1.30.dev2.dist-info/RECORD,,
|
File without changes
|
File without changes
|