Summary
PR #28 added shared helpers for retry logic, error handling, and request headers. Four of five Kibana API clients use them. KibanaInferenceClient does not: it has its own copies of everything, including error-body parsing done twice inside the same file. The prompt() method also has no retry protection at all.
Problem
inference/client.py:108-115: retry predicate duplicated from shared stack
inference/client.py:142-147: retry decorator duplicated from shared stack (applied only to chat_completion, not prompt)
inference/client.py:184-193 and :237-246: error-body parsing done twice in one file
KibanaInferenceError does not inherit KibanaAPIError
- Trace context headers are propagated on inference calls but not on other Kibana API calls
Fix
Replace duplicated code with the shared stack. Make KibanaInferenceError inherit KibanaAPIError. Add **propagated_headers() to build_kibana_headers() so all clients propagate trace context.
Done when
Summary
PR #28 added shared helpers for retry logic, error handling, and request headers. Four of five Kibana API clients use them.
KibanaInferenceClientdoes not: it has its own copies of everything, including error-body parsing done twice inside the same file. Theprompt()method also has no retry protection at all.Problem
inference/client.py:108-115: retry predicate duplicated from shared stackinference/client.py:142-147: retry decorator duplicated from shared stack (applied only tochat_completion, notprompt)inference/client.py:184-193and:237-246: error-body parsing done twice in one fileKibanaInferenceErrordoes not inheritKibanaAPIErrorFix
Replace duplicated code with the shared stack. Make
KibanaInferenceErrorinheritKibanaAPIError. Add**propagated_headers()tobuild_kibana_headers()so all clients propagate trace context.Done when
KibanaInferenceClientusesretry_kibana_api_call,parse_error_body, andraise_kibana_errorchat_completionandprompthave retry protectionKibanaInferenceErrorinheritsKibanaAPIError