forked from phoenix/litellm-mirror
(fix) add linting check to ban creating AsyncHTTPHandler
during LLM calling (#6855)
* fix triton * fix TEXT_COMPLETION_CODESTRAL * fix REPLICATE * fix CLARIFAI * fix HUGGINGFACE * add test_no_async_http_handler_usage * fix PREDIBASE * fix anthropic use get_async_httpx_client * fix vertex fine tuning * fix dbricks get_async_httpx_client * fix get_async_httpx_client vertex * fix get_async_httpx_client * fix get_async_httpx_client * fix make_async_azure_httpx_request * fix check_for_async_http_handler * test: cleanup mistral model * add check for AsyncClient * fix check_for_async_http_handler * fix get_async_httpx_client * fix tests using in_memory_llm_clients_cache * fix langfuse import * fix import --------- Co-authored-by: Krrish Dholakia <krrishdholakia@gmail.com>
This commit is contained in:
parent
71ebf47cef
commit
920f4c9f82
26 changed files with 288 additions and 62 deletions
|
@ -12,6 +12,7 @@ sys.path.insert(0, os.path.abspath("../.."))
|
|||
|
||||
import litellm
|
||||
from litellm import completion
|
||||
from litellm.caching import InMemoryCache
|
||||
|
||||
litellm.num_retries = 3
|
||||
litellm.success_callback = ["langfuse"]
|
||||
|
@ -29,15 +30,20 @@ def langfuse_client():
|
|||
f"{os.environ['LANGFUSE_PUBLIC_KEY']}-{os.environ['LANGFUSE_SECRET_KEY']}"
|
||||
)
|
||||
# use a in memory langfuse client for testing, RAM util on ci/cd gets too high when we init many langfuse clients
|
||||
if _langfuse_cache_key in litellm.in_memory_llm_clients_cache:
|
||||
langfuse_client = litellm.in_memory_llm_clients_cache[_langfuse_cache_key]
|
||||
|
||||
_cached_client = litellm.in_memory_llm_clients_cache.get_cache(_langfuse_cache_key)
|
||||
if _cached_client:
|
||||
langfuse_client = _cached_client
|
||||
else:
|
||||
langfuse_client = langfuse.Langfuse(
|
||||
public_key=os.environ["LANGFUSE_PUBLIC_KEY"],
|
||||
secret_key=os.environ["LANGFUSE_SECRET_KEY"],
|
||||
host=None,
|
||||
)
|
||||
litellm.in_memory_llm_clients_cache[_langfuse_cache_key] = langfuse_client
|
||||
litellm.in_memory_llm_clients_cache.set_cache(
|
||||
key=_langfuse_cache_key,
|
||||
value=langfuse_client,
|
||||
)
|
||||
|
||||
print("NEW LANGFUSE CLIENT")
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue