I don't know about that specific use case, but llmfit is your friend here https://github.com/AlexsJones/llmfit