You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wonder if it would be possible to configure magentic to accept a router config?
e.g. on line 12 here, rather than just importing litellm and then using litellm.completion you could create a router instance based on a MAGENTIC_LITELLM_ROUTER config and below on line 61 or 94 use router.completion or router.acompletion rather than litellm.acompletion?
I think a good approach would be to add a router: litellm.Router | None = None parameter to LitellmChatModel.__init__. Then in (a)complete use router.completion instead of litellm.completion if router was provided (assuming they meet the same interface, which appears to be the case).
litellm includes some nice features to rate limit calls, and switch between deployments based on https://docs.litellm.ai/docs/routing
I wonder if it would be possible to configure magentic to accept a router config?
e.g. on line 12 here, rather than just importing litellm and then using
litellm.completion
you could create a router instance based on a MAGENTIC_LITELLM_ROUTER config and below on line 61 or 94 userouter.completion
orrouter.acompletion
rather thanlitellm.acompletion
?https://github.com/jackmpcollins/magentic/blob/5b4b1012e630bd01baa0ef8bf3caf86fb68ae993/src/magentic/chat_model/litellm_chat_model.py
My initial use case is just setting RPM limits, but I can see it would also be nice to be able to track token usage.
The text was updated successfully, but these errors were encountered: