feat(main.py): support router.chat.completions.create

allows using router with instructor

https://github.com/BerriAI/litellm/issues/2673
This commit is contained in:
Krrish Dholakia 2024-03-25 08:26:28 -07:00
parent 9e9de7f6e2
commit f98aead602
3 changed files with 91 additions and 42 deletions

View file

@ -230,7 +230,7 @@ class Router:
) # dict to store aliases for router, ex. {"gpt-4": "gpt-3.5-turbo"}, all requests with gpt-4 -> get routed to gpt-3.5-turbo group
# make Router.chat.completions.create compatible for openai.chat.completions.create
self.chat = litellm.Chat(params=default_litellm_params)
self.chat = litellm.Chat(params=default_litellm_params, router_obj=self)
# default litellm args
self.default_litellm_params = default_litellm_params