@@ -54,7 +54,9 @@ def run(system_prompt: str, initial_query: str, client, model: str,
5454 {"role" : "user" , "content" : initial_query }
5555 ]
5656 )
57- return response .choices [0 ].message .content , response .usage .completion_tokens
57+ # Return full response dict to preserve all usage information
58+ response_dict = response .model_dump () if hasattr (response , 'model_dump' ) else response
59+ return response_dict , 0
5860
5961 # Create or reuse proxy client to maintain state (important for round-robin)
6062 config_key = str (config ) # Simple config-based cache key
@@ -128,7 +130,9 @@ def run(system_prompt: str, initial_query: str, client, model: str,
128130 ** (request_config or {})
129131 )
130132
131- return response .choices [0 ].message .content , response .usage .completion_tokens
133+ # Return full response dict to preserve all usage information
134+ response_dict = response .model_dump () if hasattr (response , 'model_dump' ) else response
135+ return response_dict , 0
132136
133137 except Exception as e :
134138 logger .error (f"Proxy plugin error: { e } " , exc_info = True )
@@ -141,4 +145,6 @@ def run(system_prompt: str, initial_query: str, client, model: str,
141145 {"role" : "user" , "content" : initial_query }
142146 ]
143147 )
144- return response .choices [0 ].message .content , response .usage .completion_tokens
148+ # Return full response dict to preserve all usage information
149+ response_dict = response .model_dump () if hasattr (response , 'model_dump' ) else response
150+ return response_dict , 0
0 commit comments