pipeworks_mud_mapper.callbacks.ollama_generation_callbacks
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
|
Generate a room description using Ollama. |
|
Send the generated response to the room description field. |
|
Show feedback when clipboard copy happens. |
|
Populate the user prompt with the current room description. |
|
Copy the system prompt to clipboard and show feedback. |
|
Render the latest Ollama status payload from any source. |
Module Contents
- pipeworks_mud_mapper.callbacks.ollama_generation_callbacks.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)[source]
Generate a room description using Ollama.
Sends a request to the Ollama
/api/chatendpoint with proper message roles (system/user) for better prompt handling by the LLM.The
runningcallback 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-infostore. This metadata is a dict matching theOllamaGenerationInfomodel fields.
- pipeworks_mud_mapper.callbacks.ollama_generation_callbacks.send_to_description(n_clicks, response_text, selected_room, zone_data, generation_info, validation_info)[source]
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_generationfield for provenance.
- pipeworks_mud_mapper.callbacks.ollama_generation_callbacks.handle_clipboard_copy(n_clicks, response_text)[source]
Show feedback when clipboard copy happens.
- pipeworks_mud_mapper.callbacks.ollama_generation_callbacks.populate_prompt_from_description(n_clicks, room_description, room_name)[source]
Populate the user prompt with the current room description.