- Issue created by @aspilicious
- 🇧🇪Belgium aspilicious
aspilicious → changed the visibility of the branch 3519302-abstract-token-usage to hidden.
- 🇧🇪Belgium aspilicious
aspilicious → changed the visibility of the branch 3519302-abstract-token-usage to active.
- 🇬🇧United Kingdom MrDaleSmith
There is no code here to be reviewed, so setting back to Active.
- 🇧🇪Belgium aspilicious
- 🇧🇪Belgium aspilicious
But it's my first time creating a fork so maybe I need to do something else.
- 🇬🇧United Kingdom MrDaleSmith
There is a fork but no merge request: see https://www.drupal.org/docs/develop/git/using-gitlab-to-contribute-to-dr... → which may assist.
- 🇧🇪Belgium aspilicious
Thanks for the information. This should be better.
- 🇬🇧United Kingdom MrDaleSmith
Code looks good to me: cannot be properly tested or merged until https://www.drupal.org/project/ai/issues/3517618 ✨ Abstract token usage Active has been approved and merged, so this will probably sit for a while.
- 🇧🇪Belgium brentg Ghent
Tested this and came across the following issue while testing it with the ai_ckeditor module:
Cannot use object of type OpenAI\Responses\StreamResponse as array in Drupal\ai_provider_openai\Plugin\AiProvider\OpenAiProvider->chat() (line 363 of modules/contrib/ai_provider_openai/src/Plugin/AiProvider/OpenAiProvider.php)
The code now assumes that the $response will be an array, and if I'm correctly, the $respons will only be an array if the response is not streamed (see try catch above)
- 🇧🇪Belgium aspilicious
I tested this and this doesn't crash anymore with the latest changes. But it also doesn't support streams as it doesn't contain the need info.
:(
- First commit to issue fork.
- 🇧🇪Belgium svendecabooter Gent
Adding some logic to the MR, in an attempt to also provide support for token usage, in case of streamed responses.
This needs https://www.drupal.org/project/ai/issues/3524435 📌 Add token usage to streamed chat Active to be fixed first. - 🇧🇪Belgium svendecabooter Gent
Added related issues in AI module, that need to be fixed first, before both token usage for both regular chat and streamed chat can be captured.
- First commit to issue fork.