edsl 0.1.55__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 CHANGED
@@ -1 +1 @@
1
- __version__ = "0.1.55"
1
+ __version__ = "0.1.57"
@@ -1,10 +1,11 @@
1
1
  from collections import UserDict
2
- from typing import NamedTuple, Dict, Optional, Any
2
+ from typing import NamedTuple, Dict, Optional, Any, Union
3
3
  from dataclasses import dataclass, fields
4
4
 
5
5
 
6
6
  class ModelInputs(NamedTuple):
7
7
  "This is what was send by the agent to the model"
8
+
8
9
  user_prompt: str
9
10
  system_prompt: str
10
11
  encoded_image: Optional[str] = None
@@ -12,6 +13,7 @@ class ModelInputs(NamedTuple):
12
13
 
13
14
  class EDSLOutput(NamedTuple):
14
15
  "This is the edsl dictionary that is returned by the model"
16
+
15
17
  answer: Any
16
18
  generated_tokens: str
17
19
  comment: Optional[str] = None
@@ -19,11 +21,16 @@ class EDSLOutput(NamedTuple):
19
21
 
20
22
  class ModelResponse(NamedTuple):
21
23
  "This is the metadata that is returned by the model and includes info about the cache"
24
+
22
25
  response: dict
23
26
  cache_used: bool
24
27
  cache_key: str
25
28
  cached_response: Optional[Dict[str, Any]] = None
26
- cost: Optional[float] = None
29
+ input_tokens: Optional[int] = None
30
+ output_tokens: Optional[int] = None
31
+ input_price_per_million_tokens: Optional[float] = None
32
+ output_price_per_million_tokens: Optional[float] = None
33
+ total_cost: Optional[Union[float, str]] = None
27
34
 
28
35
 
29
36
  class AgentResponseDict(NamedTuple):
@@ -44,7 +51,11 @@ class EDSLResultObjectInput(NamedTuple):
44
51
  comment: str
45
52
  validated: bool = False
46
53
  exception_occurred: Exception = None
47
- cost: Optional[float] = None
54
+ input_tokens: Optional[int] = None
55
+ output_tokens: Optional[int] = None
56
+ input_price_per_million_tokens: Optional[float] = None
57
+ output_price_per_million_tokens: Optional[float] = None
58
+ total_cost: Optional[Union[float, str]] = None
48
59
 
49
60
 
50
61
  @dataclass
@@ -111,4 +122,4 @@ class Answers(UserDict):
111
122
  if __name__ == "__main__":
112
123
  import doctest
113
124
 
114
- doctest.testmod()
125
+ doctest.testmod()
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
- {'credits': 0.77, 'usd': 0.0076950000000000005}
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
- "credits": response_json.get("cost_in_credits"),
1293
+ "credits_hold": response_json.get("cost_in_credits"),
1294
1294
  "usd": response_json.get("cost_in_usd"),
1295
1295
  }
1296
1296