pipeworks_mud_mapper.callbacks.ollama_generation_callbacks ========================================================== .. py:module:: pipeworks_mud_mapper.callbacks.ollama_generation_callbacks .. autoapi-nested-parse:: Callbacks for Ollama generation and response application. This module contains the callbacks that: - generate descriptions via /api/chat - apply generated text to room descriptions - provide clipboard and prompt population helpers Functions --------- .. autoapisummary:: pipeworks_mud_mapper.callbacks.ollama_generation_callbacks.generate_description pipeworks_mud_mapper.callbacks.ollama_generation_callbacks.send_to_description pipeworks_mud_mapper.callbacks.ollama_generation_callbacks.handle_clipboard_copy pipeworks_mud_mapper.callbacks.ollama_generation_callbacks.populate_prompt_from_description pipeworks_mud_mapper.callbacks.ollama_generation_callbacks.copy_system_prompt pipeworks_mud_mapper.callbacks.ollama_generation_callbacks.render_ollama_status Module Contents --------------- .. py:function:: generate_description(n_clicks, server_url, model, system_prompt, user_prompt, seed, temperature, top_k, top_p, num_ctx, num_predict, template_id, target_words) Generate a room description using Ollama. Sends a request to the Ollama ``/api/chat`` endpoint with proper message roles (system/user) for better prompt handling by the LLM. The ``running`` callback parameter provides real-time feedback: - Button shows "Generating..." with spinner - Previous response is cleared Metadata Output --------------- On successful generation, this callback outputs metadata to the ``ollama-last-generation-info`` store. This metadata is a dict matching the ``OllamaGenerationInfo`` model fields. .. py:function:: send_to_description(n_clicks, response_text, selected_room, zone_data, generation_info, validation_info) Send the generated response to the room description field. Also updates the zone data directly so the change is immediately reflected in the save state. When generation metadata is available, it is stored in the room's ``llm_generation`` field for provenance. .. py:function:: handle_clipboard_copy(n_clicks, response_text) Show feedback when clipboard copy happens. .. py:function:: populate_prompt_from_description(n_clicks, room_description, room_name) Populate the user prompt with the current room description. .. py:function:: copy_system_prompt(n_clicks, system_prompt) Copy the system prompt to clipboard and show feedback. .. py:function:: render_ollama_status(*payloads) Render the latest Ollama status payload from any source.