MCPcopy Index your code
hub / github.com/geekcomputers/Python / ask_model

Function ask_model

JARVIS/ai.py:36–53  ·  view source on GitHub ↗
(text)

Source from the content-addressed store, hash-verified

34
35
36def ask_model(text):
37 prompt = (
38 f"{ASSISTANT_PROMPT}\n"
39 f"Saved memory:\n{memory_context()}\n\n"
40 f"Answer in English.\n"
41 f"User: {text}"
42 )
43 try:
44 response = lm_client().responses.create(
45 model=OPENAI_MODEL,
46 input=prompt,
47 max_output_tokens=MAX_OUTPUT_TOKENS,
48 )
49 except OpenAIError as exc:
50 state.debug("chat error", str(exc))
51 return "I cannot reach LM Studio right now. Start the local server and try again."
52 debug_response("chat", prompt, response)
53 return clean_assistant_output(response.output_text)
54
55
56def classify_action(text):

Callers 1

handle_user_textFunction · 0.85

Calls 5

memory_contextFunction · 0.85
lm_clientFunction · 0.85
debug_responseFunction · 0.85
clean_assistant_outputFunction · 0.85
debugMethod · 0.80

Tested by

no test coverage detected