Add LLM backend support and improve debugging observability
- Add LLM_BACKEND to environment configuration - Implement detailed debug logging for LLM request/response cycles - Add missing llama-index dependencies for embeddings and chroma - Update prompt constraints to prevent lore redundancy - Enable CUDA for transcription and set logging to DEBUG level - Add entry point for running the orchestrator directly - Cleanup unused comment in TUI context updates
This commit is contained in:
@@ -45,6 +45,7 @@ class LLMProcessor:
|
||||
final_base_url = base_url or os.environ.get("OPENAI_BASE_URL")
|
||||
final_api_key = api_key or os.environ.get("OPENAI_API_KEY")
|
||||
|
||||
logger.info(f"Using LLM backend: {backend}")
|
||||
try:
|
||||
self.client = OpenAI(
|
||||
api_key=final_api_key,
|
||||
@@ -96,6 +97,14 @@ class LLMProcessor:
|
||||
|
||||
messages.append({"role": "user", "content": user_prompt})
|
||||
|
||||
# Debugging: Dump inputs
|
||||
logger.debug("--- LLM CALL START ---")
|
||||
logger.debug(f"Model: {self.model}")
|
||||
logger.debug(f"Messages: {messages}")
|
||||
if response_format:
|
||||
logger.debug(f"Response Format: {response_format}")
|
||||
logger.debug("--- LLM CALL END ---")
|
||||
|
||||
try:
|
||||
response = self.client.chat.completions.create(
|
||||
model=self.model,
|
||||
@@ -105,6 +114,11 @@ class LLMProcessor:
|
||||
)
|
||||
content = response.choices[0].message.content
|
||||
|
||||
# Debugging: Dump outputs
|
||||
logger.debug("--- LLM RESPONSE START ---")
|
||||
logger.debug(f"Content: {content}")
|
||||
logger.debug("--- LLM RESPONSE END ---")
|
||||
|
||||
return self._strip_markdown_code_blocks(content)
|
||||
except Exception as e:
|
||||
logger.error(f"LLM Error: {e}")
|
||||
|
||||
Reference in New Issue
Block a user