forked from phoenix/litellm-mirror
Merge pull request #4758 from BerriAI/litellm_langsmith_async_support
[Feat] Use Async Httpx client for langsmith logging
This commit is contained in:
commit
ee53b9093b
8 changed files with 249 additions and 111 deletions
|
@ -417,6 +417,21 @@ def function_setup(
|
|||
# we only support async dynamo db logging for acompletion/aembedding since that's used on proxy
|
||||
litellm._async_success_callback.append(callback)
|
||||
removed_async_items.append(index)
|
||||
elif callback == "langsmith":
|
||||
callback_class = litellm.litellm_core_utils.litellm_logging._init_custom_logger_compatible_class( # type: ignore
|
||||
callback, internal_usage_cache=None, llm_router=None
|
||||
)
|
||||
|
||||
# don't double add a callback
|
||||
if not any(
|
||||
isinstance(cb, type(callback_class)) for cb in litellm.callbacks
|
||||
):
|
||||
litellm.callbacks.append(callback_class) # type: ignore
|
||||
litellm.input_callback.append(callback_class) # type: ignore
|
||||
litellm.success_callback.append(callback_class) # type: ignore
|
||||
litellm.failure_callback.append(callback_class) # type: ignore
|
||||
litellm._async_success_callback.append(callback_class) # type: ignore
|
||||
litellm._async_failure_callback.append(callback_class) # type: ignore
|
||||
|
||||
# Pop the async items from success_callback in reverse order to avoid index issues
|
||||
for index in reversed(removed_async_items):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue