(text)
| 34 | |
| 35 | |
| 36 | def 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 | |
| 56 | def classify_action(text): |
no test coverage detected