Skip to content

LLM preprocessor for openai interface#106

Draft
jcustenborder wants to merge 3 commits intodevnen:mainfrom
jcustenborder:llm_preprocessor
Draft

LLM preprocessor for openai interface#106
jcustenborder wants to merge 3 commits intodevnen:mainfrom
jcustenborder:llm_preprocessor

Conversation

@jcustenborder
Copy link

Thanks for creating this project!

In my project I'm using openai compatible apis but I wanted to be able to manipulate more of the settings. I came up with the idea of hitting the prompt with a LLM preprocessor to extract the values. Here are a few examples.

Input Extracted Parameters
"speak excitedly: Hello world!" text="Hello world!", exaggeration=1.5
"say calmly and slowly: Take a breath" text="Take a breath", exaggeration=0.3
"whisper this in Spanish: Buenos días" text="Buenos días", exaggeration=0.3, language="es"
"read this enthusiastically with high energy: Welcome everyone!" text="Welcome everyone!", exaggeration=1.8, temperature=0.8

  Adds optional LLM preprocessing that extracts TTS parameters from
  natural language instructions in the input text (e.g., "speak excitedly:
  Hello!" extracts exaggeration=1.5).

  Changes:
  - Add llm_preprocessor.py with TTSParamsExtraction Pydantic model and
    preprocess_speech_input() using litellm for unified LLM provider access
  - Add llm_preprocessing config section with model, api_base, api_key,
    timeout, fallback_on_error, and configurable prompt
  - Modify openai_speech_endpoint to delegate to custom_tts_endpoint when
    preprocessing is enabled
  - Add litellm>=1.0.0 to all requirements files

  Supports multiple LLM providers via litellm: OpenAI, Anthropic, Gemini,
  Mistral, Groq, Ollama, and litellm proxy configurations.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant