step B.2 complete: all 23 tools use execute_on_client(); add embed() to llm
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user