mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-02 13:18:18 +00:00
Handle price, responses of models served via Groq
Their tool call response may not strictly follow expected response format. Let researcher handle incorrect arguments to code tool (i.e triggers type error)
This commit is contained in:
@@ -934,6 +934,9 @@ async def astream_thought_processor(
|
||||
if not chunk_data.get("object") or chunk_data.get("object") != "chat.completion.chunk":
|
||||
logger.warning(f"Skipping invalid chunk with object field: {chunk_data.get('object', 'missing')}")
|
||||
continue
|
||||
# Handle unsupported service tiers like "on_demand" by Groq
|
||||
if chunk.service_tier and chunk.service_tier == "on_demand":
|
||||
chunk_data["service_tier"] = "auto"
|
||||
|
||||
tchunk = ChatCompletionWithThoughtsChunk.model_validate(chunk_data)
|
||||
|
||||
|
||||
@@ -433,7 +433,7 @@ async def research(
|
||||
this_iteration.codeContext = code_results
|
||||
async for result in send_status_func(f"**Ran code snippets**: {len(this_iteration.codeContext)}"):
|
||||
yield result
|
||||
except ValueError as e:
|
||||
except (ValueError, TypeError) as e:
|
||||
this_iteration.warning = f"Error running code: {e}"
|
||||
logger.warning(this_iteration.warning, exc_info=True)
|
||||
|
||||
|
||||
@@ -71,4 +71,7 @@ model_to_cost: Dict[str, Dict[str, float]] = {
|
||||
"grok-3-latest": {"input": 3.0, "output": 15.0},
|
||||
"grok-3-mini": {"input": 0.30, "output": 0.50},
|
||||
"grok-3-mini-latest": {"input": 0.30, "output": 0.50},
|
||||
# Groq pricing
|
||||
"moonshotai/kimi-k2-instruct": {"input": 1.00, "output": 3.00},
|
||||
"openai/gpt-oss-120b": {"input": 0.15, "output": 0.75},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user