OpenAI model cost based on model name fix
the CostCallbackHandler.total_cost method can take a dictionary of models and associated cost per i/o tokens. However, this was not functional because the token usage parser did not save the model's name. The model's name was also removed after adding TokenUsage objects together. I fixed these issues for the OpenAI parser.
Note that the same problem still exists for the anthropic and bedrock parsers. I did not update this, since I don't use these API's and would not be able to test my implementation.
thanks for bringing this up @JonasElburgUVA I'll fix the others too after merging this but could you check the tests too?
seems like some tests were also incorrect
Sorry for the failing tests in the initial PR. The test_cost.py tests did not expect a model ID as part of TokenUsage objects, even though the LLMResult samples do contain model IDs. I updated the tests accordingly. I also added the model ID parsing logic for the other parsers based on the LLMResult samples in test_cost.py.
codestyle check is still failing, I am not sure why?
@JonasElburgUVA Could you please rebase this PR so we can take final look at the tests.
continued changes via #2287