* add staging ios app build script * feat(api): add OpenTelemetry LGTM stack for local observability Wire OTel traces, metrics, and logs through a collector to Tempo, Prometheus, and Loki, with custom LLM instrumentation, dev compose overlay, Grafana provisioning, env templates, and development.sh auto-start. * feat: expand observability, harden dev tooling, and fix expo staging UX Add business and LLM Prometheus metrics with Grafana dashboards, alerting, and a metrics verification script. Wire telemetry through adapters and core LLM paths, and document the local LGTM workflow. Fix development.sh for macOS bash 3.2, open Grafana and eval-web in Chrome, and repair eval-web auto-open (unbound EVAL_WEB_BROWSER_SCHEDULED). Merge internal-eval into the main dev script with improved compose handling. Require EXPO_PUBLIC_* at build time, improve iOS HTTP ATS for staging IPs, show memoir empty state instead of load errors when no chapters exist, and add jest env setup plus chapter list response normalization. * chore: enable Grafana Assistant Cursor plugin * fix: memoir empty state and repair withdrawn 0020_chapters_book_id stamp Show empty memoir UI when the chapter list succeeds with no items; treat auth/404 as non-fatal. Extend alembic revision repair so local dev DBs stamped with the removed 0020_chapters_book_id migration can roll back and upgrade to 0019. --------- Co-authored-by: Kevin <kevin@brighteng.org> Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -4,6 +4,8 @@ from collections.abc import AsyncIterator
|
||||
|
||||
from langchain_openai import ChatOpenAI
|
||||
|
||||
from app.core.llm_telemetry import langchain_invoke_span, observe_astream
|
||||
|
||||
|
||||
class DeepSeekLLMProvider:
|
||||
"""LangChain-based LLM adapter for DeepSeek and OpenAI-compatible APIs.
|
||||
@@ -56,7 +58,15 @@ class DeepSeekLLMProvider:
|
||||
) -> str:
|
||||
llm = self._get_llm(temperature, model, max_tokens)
|
||||
lc_messages = _to_langchain_messages(messages)
|
||||
result = await llm.ainvoke(lc_messages)
|
||||
resolved_model = model or self._default_model
|
||||
with langchain_invoke_span(
|
||||
agent="deepseek.complete",
|
||||
provider="deepseek",
|
||||
model=resolved_model,
|
||||
call_type="chat",
|
||||
) as tel:
|
||||
result = await llm.ainvoke(lc_messages)
|
||||
tel["response"] = result
|
||||
return str(result.content)
|
||||
|
||||
async def stream(
|
||||
@@ -69,7 +79,14 @@ class DeepSeekLLMProvider:
|
||||
) -> AsyncIterator[str]:
|
||||
llm = self._get_llm(temperature, model, max_tokens)
|
||||
lc_messages = _to_langchain_messages(messages)
|
||||
async for chunk in llm.astream(lc_messages):
|
||||
resolved_model = model or self._default_model
|
||||
async for chunk in observe_astream(
|
||||
llm,
|
||||
lc_messages,
|
||||
agent="deepseek.stream",
|
||||
provider="deepseek",
|
||||
model=resolved_model,
|
||||
):
|
||||
if chunk.content:
|
||||
yield str(chunk.content)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user