dimagi / open-chat-studio

A web based platform for building Chatbots backed by Large Language Models
BSD 3-Clause "New" or "Revised" License
16 stars 7 forks source link

revert revert trace details #843

Closed snopoke closed 2 weeks ago

snopoke commented 2 weeks ago

Description

Redo of https://github.com/dimagi/open-chat-studio/pull/835

The issue that caused DIMAGI-BOTS-HA is that functools.cache creates a global cache which resulted in the same 'trace service' being used in successive calls. This PR adds a new commit which changes the cached function to a cached property which is local to the class instance.

For more info on the topic see https://rednafi.com/python/lru_cache_on_methods/

codecov-commenter commented 2 weeks ago

Codecov Report

Attention: Patch coverage is 89.43089% with 13 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
apps/service_providers/tracing/service.py 73.52% 9 Missing :warning:
apps/service_providers/llm_service/state.py 90.90% 2 Missing :warning:
apps/chat/models.py 66.66% 1 Missing :warning:
apps/service_providers/models.py 50.00% 1 Missing :warning:
Additional details and impacted files

:loudspeaker: Thoughts on this report? Let us know!

snopoke commented 2 weeks ago

@SmittieC this is now actually ready for review