edsl 0.1.56__py3-none-any.whl → 0.1.57__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/coop/coop.py +3 -3
- edsl/jobs/jobs_pricing_estimation.py +24 -2
- {edsl-0.1.56.dist-info → edsl-0.1.57.dist-info}/METADATA +2 -2
- {edsl-0.1.56.dist-info → edsl-0.1.57.dist-info}/RECORD +8 -8
- {edsl-0.1.56.dist-info → edsl-0.1.57.dist-info}/LICENSE +0 -0
- {edsl-0.1.56.dist-info → edsl-0.1.57.dist-info}/WHEEL +0 -0
- {edsl-0.1.56.dist-info → edsl-0.1.57.dist-info}/entry_points.txt +0 -0
edsl/__version__.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
__version__ = "0.1.
|
1
|
+
__version__ = "0.1.57"
|
edsl/coop/coop.py
CHANGED
@@ -1256,13 +1256,13 @@ class Coop(CoopFunctionsMixin):
|
|
1256
1256
|
self, input: Union["Jobs", "Survey"], iterations: int = 1
|
1257
1257
|
) -> int:
|
1258
1258
|
"""
|
1259
|
-
Get the cost of a remote inference job.
|
1259
|
+
Get the estimated cost in credits of a remote inference job.
|
1260
1260
|
|
1261
1261
|
:param input: The EDSL job to send to the server.
|
1262
1262
|
|
1263
1263
|
>>> job = Jobs.example()
|
1264
1264
|
>>> coop.remote_inference_cost(input=job)
|
1265
|
-
{'
|
1265
|
+
{'credits_hold': 0.77, 'usd': 0.0076950000000000005}
|
1266
1266
|
"""
|
1267
1267
|
from ..jobs import Jobs
|
1268
1268
|
from ..surveys import Survey
|
@@ -1290,7 +1290,7 @@ class Coop(CoopFunctionsMixin):
|
|
1290
1290
|
self._resolve_server_response(response)
|
1291
1291
|
response_json = response.json()
|
1292
1292
|
return {
|
1293
|
-
"
|
1293
|
+
"credits_hold": response_json.get("cost_in_credits"),
|
1294
1294
|
"usd": response_json.get("cost_in_usd"),
|
1295
1295
|
}
|
1296
1296
|
|
@@ -366,6 +366,20 @@ class JobsPrompts:
|
|
366
366
|
},
|
367
367
|
)
|
368
368
|
|
369
|
+
@staticmethod
|
370
|
+
def usd_to_credits(usd: float) -> float:
|
371
|
+
"""Converts USD to credits."""
|
372
|
+
cents = usd * 100
|
373
|
+
credits_per_cent = 1
|
374
|
+
credits = cents * credits_per_cent
|
375
|
+
|
376
|
+
# Round up to the nearest hundredth of a credit
|
377
|
+
minicredits = math.ceil(credits * 100)
|
378
|
+
|
379
|
+
# Convert back to credits
|
380
|
+
credits = round(minicredits / 100, 2)
|
381
|
+
return credits
|
382
|
+
|
369
383
|
def estimate_job_cost_from_external_prices(
|
370
384
|
self, price_lookup: dict, iterations: int = 1
|
371
385
|
) -> dict:
|
@@ -429,8 +443,15 @@ class JobsPrompts:
|
|
429
443
|
group["cost_usd"] *= iterations
|
430
444
|
detailed_costs.append(group)
|
431
445
|
|
446
|
+
# Convert to credits
|
447
|
+
for group in detailed_costs:
|
448
|
+
group["credits_hold"] = self.usd_to_credits(group["cost_usd"])
|
449
|
+
|
432
450
|
# Calculate totals
|
433
|
-
|
451
|
+
estimated_total_cost_usd = sum(group["cost_usd"] for group in detailed_costs)
|
452
|
+
total_credits_hold = sum(
|
453
|
+
group["credits_hold"] for group in detailed_costs
|
454
|
+
)
|
434
455
|
estimated_total_input_tokens = sum(
|
435
456
|
group["tokens"]
|
436
457
|
for group in detailed_costs
|
@@ -443,7 +464,8 @@ class JobsPrompts:
|
|
443
464
|
)
|
444
465
|
|
445
466
|
output = {
|
446
|
-
"estimated_total_cost_usd":
|
467
|
+
"estimated_total_cost_usd": estimated_total_cost_usd,
|
468
|
+
"total_credits_hold": total_credits_hold,
|
447
469
|
"estimated_total_input_tokens": estimated_total_input_tokens,
|
448
470
|
"estimated_total_output_tokens": estimated_total_output_tokens,
|
449
471
|
"detailed_costs": detailed_costs,
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: edsl
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.57
|
4
4
|
Summary: Create and analyze LLM-based surveys
|
5
5
|
Home-page: https://www.expectedparrot.com/
|
6
6
|
License: MIT
|
@@ -23,7 +23,7 @@ Requires-Dist: azure-ai-inference (>=1.0.0b3,<2.0.0)
|
|
23
23
|
Requires-Dist: black[jupyter] (>=24.4.2,<25.0.0)
|
24
24
|
Requires-Dist: boto3 (>=1.34.161,<2.0.0)
|
25
25
|
Requires-Dist: google-generativeai (>=0.8.2,<0.9.0)
|
26
|
-
Requires-Dist: groq (
|
26
|
+
Requires-Dist: groq (==0.23.1)
|
27
27
|
Requires-Dist: jinja2 (>=3.1.2,<4.0.0)
|
28
28
|
Requires-Dist: json-repair (>=0.28.4,<0.29.0)
|
29
29
|
Requires-Dist: jupyter (>=1.0.0,<2.0.0)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
edsl/__init__.py,sha256=EkpMsEKqKRbN9Qqcn_y8CjX8OjlWFyhxslLrt3SJY0Q,4827
|
2
2
|
edsl/__init__original.py,sha256=PzMzANf98PrSleSThXT4anNkeVqZMdw0tfFonzsoiGk,4446
|
3
|
-
edsl/__version__.py,sha256=
|
3
|
+
edsl/__version__.py,sha256=4_3hAGEogvYbOy6vn6QDJpHwwyZfPSVQHAgrUMAMbLI,23
|
4
4
|
edsl/agents/__init__.py,sha256=AyhfXjygRHT1Pd9w16lcu5Bu0jnBmMPz86aKP1uRL3Y,93
|
5
5
|
edsl/agents/agent.py,sha256=J0y8dH8tWXffiAVhyPEWJ4xmOKdi-XtSrSlMJ08fd58,55606
|
6
6
|
edsl/agents/agent_list.py,sha256=-bm8jozPPIHJAqb-1nt9m3TZGw5-tgg4LAjz5Mpj0AE,23071
|
@@ -40,7 +40,7 @@ edsl/conversation/exceptions.py,sha256=DoUCg-ymqGOjOl0cpGT8-sNRVsr3SEwdxGAKtdeZ2
|
|
40
40
|
edsl/conversation/mug_negotiation.py,sha256=do3PTykM6A2cDGOcsohlevRgLpCICoPx8B0WIYe6hy8,2518
|
41
41
|
edsl/conversation/next_speaker_utilities.py,sha256=bqr5JglCd6bdLc9IZ5zGOAsmN2F4ERiubSMYvZIG7qk,3629
|
42
42
|
edsl/coop/__init__.py,sha256=DU2w1Nu8q6tMAa3xoPC722RrvGhmB_UgUUBJDUywsKY,1542
|
43
|
-
edsl/coop/coop.py,sha256=
|
43
|
+
edsl/coop/coop.py,sha256=sRGNN6QNsXN2xukKbxvZM8WdFhOSGCYIYVnBBnkAZ1k,65568
|
44
44
|
edsl/coop/coop_functions.py,sha256=d31kddfj9MVZaMhqwUvkSIBwrdCTQglIvFWVfUr4NuE,688
|
45
45
|
edsl/coop/coop_jobs_objects.py,sha256=_OFPVLKswXY9mKl9b3Y7gxlUhaMZ7GULx5OqyANpecU,1701
|
46
46
|
edsl/coop/coop_objects.py,sha256=_cEspdAxh7BT672poxb0HsjU-QZ4Kthg-tKDvZ6I_v0,859
|
@@ -136,7 +136,7 @@ edsl/jobs/jobs.py,sha256=WL3ODJ4HBElnw2XVaPXqfvHzyTsEe0XeUghOZOyI0FA,42334
|
|
136
136
|
edsl/jobs/jobs_checks.py,sha256=bfPJ3hQ4qvRBhyte4g-4J8zExJxJr3nlLHmtVmFPJcQ,5390
|
137
137
|
edsl/jobs/jobs_component_constructor.py,sha256=9956UURv3eo-cURNPd4EV8wAQsY-AlEtQRmBu1nCOH8,6982
|
138
138
|
edsl/jobs/jobs_interview_constructor.py,sha256=8nIhhwBQWH_aZ9ZWjvRgOL0y2y6juRTb3pVngQ9Cs8g,2017
|
139
|
-
edsl/jobs/jobs_pricing_estimation.py,sha256=
|
139
|
+
edsl/jobs/jobs_pricing_estimation.py,sha256=jPIWUizpqRxtxPmldc4x4IbQ_LlZLNMtCvmWF20VEoU,17547
|
140
140
|
edsl/jobs/jobs_remote_inference_logger.py,sha256=2v3uxkq2UA10UEiwTFGAaC7ekYC0M0UGK3U67WvATpk,9325
|
141
141
|
edsl/jobs/jobs_runner_status.py,sha256=ME0v4TTH7qzS4vOROGtNKaWqHZmhzrCl_-FeTRSa9C8,10701
|
142
142
|
edsl/jobs/jobs_status_enums.py,sha256=8Kgtr-ffcGGniQ2x5gCOqwURb_HaBWmYcWbUB_KTCY0,214
|
@@ -382,8 +382,8 @@ edsl/utilities/repair_functions.py,sha256=EXkXsqnmgPqj9b3dff1cZnJyaZw-qEvGENXCRH
|
|
382
382
|
edsl/utilities/restricted_python.py,sha256=248N2p5EWHDSpcK1G-q7DUoJeWy4sB6aO-RV0-5O7uY,2038
|
383
383
|
edsl/utilities/template_loader.py,sha256=SCAcnTnxNQ67MNSkmfz7F-S_u2peyGn2j1oRIqi1wfg,870
|
384
384
|
edsl/utilities/utilities.py,sha256=irHheAGOnl_6RwI--Hi9StVzvsHcWCqB48PWsWJQYOw,12045
|
385
|
-
edsl-0.1.
|
386
|
-
edsl-0.1.
|
387
|
-
edsl-0.1.
|
388
|
-
edsl-0.1.
|
389
|
-
edsl-0.1.
|
385
|
+
edsl-0.1.57.dist-info/LICENSE,sha256=_qszBDs8KHShVYcYzdMz3HNMtH-fKN_p5zjoVAVumFc,1111
|
386
|
+
edsl-0.1.57.dist-info/METADATA,sha256=9Cds0oJ5nt66EWjA2SMAx5v_WbBdnJKxGbrCFwYBYcw,12032
|
387
|
+
edsl-0.1.57.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
388
|
+
edsl-0.1.57.dist-info/entry_points.txt,sha256=JnG7xqMtHaQu9BU-yPATxdyCeA48XJpuclnWCqMfIMU,38
|
389
|
+
edsl-0.1.57.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|