Skip to content

Commit 7d03236

Browse files
committed
work on aproxiamte_job_cost
1 parent 1073e49 commit 7d03236

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

edsl/jobs/Jobs.py

+23
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,29 @@ def prompts(self) -> "Dataset":
178178
]
179179
)
180180

181+
def aproximate_job_cost(self):
182+
from edsl import Coop
183+
184+
c = Coop()
185+
price_lookup = c.fetch_prices()
186+
# key = (self._inference_service_, self.model)
187+
# if key not in price_lookup:
188+
# return f"Could not find price for model {self.model} in the price lookup."
189+
190+
# relevant_prices = price_lookup[key]
191+
192+
prompts = self.prompts()
193+
194+
text_len = 0
195+
for prompt in prompts:
196+
text_len += len(str(prompt))
197+
198+
for model in self.models:
199+
print(model.model)
200+
input_token_aproximations = text_len // 4
201+
202+
return input_token_aproximations
203+
181204
@staticmethod
182205
def _get_container_class(object):
183206
from edsl.agents.AgentList import AgentList

0 commit comments

Comments
 (0)