openedx_ai_extensions.processors.llm.providers package#
Module contents#
Provider-specific quirks and adaptations for different LLM providers.
- openedx_ai_extensions.processors.llm.providers.adapt_to_provider(provider, params, *, has_user_input=True, user_session=None, input_data=None)#
Apply provider-specific modifications to API call parameters.
This function centralizes all provider-specific logic that was previously scattered throughout the codebase (e.g., OpenAI-specific threading, Anthropic’s requirement for user messages).
For non-OpenAI providers that are streaming with Responses API params (i.e.
inputkey present), the parameters are automatically converted to Completion API format (messages) because LiteLLM’s Responses API streaming translation does not surface tool-call events correctly for those providers. Callers can check for the"messages"key in the returned dict to decide whether to use the Completion API path.- Parameters:
provider (str) – The LLM provider name (e.g., ‘openai’, ‘anthropic’)
params (dict) – The parameters dictionary to modify
has_user_input (bool) – Whether the conversation includes user input
user_session – Optional user session for threading support
input_data – Optional input data for continuing conversations
- Returns:
Modified parameters with provider-specific adaptations applied
- Return type:
- openedx_ai_extensions.processors.llm.providers.after_tool_call_adaptations(provider, params, data=None)#
Apply provider-specific modifications to API call parameters after tool calls.
This function centralizes all provider-specific logic that needs to be applied after tool calls have been made, such as updating threading information.
- openedx_ai_extensions.processors.llm.providers.provider_supports(provider, capability)#
Return True if the given provider supports the named capability.