Skip to content

[kbn-evals] KibanaInferenceClient bypasses shared retry and error stack #38

Description

@milistu

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

  • KibanaInferenceClient uses retry_kibana_api_call, parse_error_body, and raise_kibana_error
  • Both chat_completion and prompt have retry protection
  • KibanaInferenceError inherits KibanaAPIError
  • Error-body parsing appears once in the file
  • All Kibana API clients include W3C trace context headers

Metadata

Metadata

Assignees

No one assigned

    Labels

    Team:nightshift-context-and-researchNightshift Context & Research Teamkbn-evalsIssue related to the work on Kibana's LLM evaluation framework.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions