step B.2 complete: all 23 tools use execute_on_client(); add embed() to llm

This commit is contained in:
2026-03-05 00:03:01 +01:00
parent 4d7fd519c5
commit 27c087d5d8
6 changed files with 202 additions and 130 deletions

View File

@@ -17,6 +17,8 @@ Switch providers by changing **LLM_MODEL** / **LLM_ROUTER_MODEL** in ``.env``
from __future__ import annotations
from openai import AsyncOpenAI
from langchain_openai import ChatOpenAI
from litellm import get_supported_openai_params # noqa: F401 validates install
@@ -66,3 +68,13 @@ def get_router_llm(
) -> ChatOpenAI:
"""Return the lighter model used for intent classification / routing."""
return get_llm(model=settings.LLM_ROUTER_MODEL, temperature=temperature)
async def embed(text: str) -> list[float]:
"""Return a 1536-dim embedding vector for *text* using text-embedding-3-small."""
client = AsyncOpenAI(api_key=settings.OPENAI_API_KEY)
response = await client.embeddings.create(
model="text-embedding-3-small",
input=text,
)
return response.data[0].embedding