you are viewing a single comment's thread
view the rest of the comments
[–] 3 points 6 months ago* (last edited 6 months ago) (1 child)

Edit: Alternatively, does anyone have thoughts on the requirements on the model side of things to make this?

If you're talking to a model accessible via HTTP you can interact with it via a chat API. You track the messages sent back and forth yourself and post the whole conversation to the end-point each turn so that it has context. I've been experimenting with this using ollama, but I'm pretty sure you can do it with llama-server too.

I'm not sure if I know how to get the LLM to give me reliably parsable output...

Prompt engineering + sanity checks in the client side code + retries. There are options for requesting structured output specifically too. They might or might not work... I've had decent success getting qwen models to output JSON with prompts that include things like "Output strictly valid json. No extra text." or similar. Sometimes it will quote things with triple backticks or triple backticks + "json" at the top of the reply -- which is easily fixed by string manipulation on the client. Occasionally -- especially with complicated prompts -- it will go off the rails and give me junk that I've either needed to fix by hand or automatically retry later. It works well enough that I've been able to do image analysis in batches with it successfully.

I don't know anything about the specifics of LibreOffice extensions though -- never worked with those personally before.

Edit: If you don't want to go to all the effort of writing a whole extension for it, you can also just paste the context into the model running in the terminal. Put the whole document early on in the session (quoted with backticks). Then ask for refinement by quoting snippets with the comments for revision you want to do. I haven't done this for English language editing, but I have tried it for sanity checking my own hand written Python code. Sometimes it gives good suggestions (e.g. it caught a few typos I hadn't noticed yet when I tried this yesterday) and sometimes it doesn't -- your own judgement is, of course, very important.

Edit 2: I've found it's sometimes useful when I'm providing lots of text to include a description of what info I'm providing, then an instruction like "Say 'OK' to proceed." followed by something like "The whole file is: ...". That way I can provide context into the session without it wasting a lot of time trying to deduce what I want to do with it before I'm ready in a strictly user/assistant/user/assistant/... chat conversation mode.

  • source
  • hideshow 1 child comment
  • [+] [S] 3 points 6 months ago (1 child)
  • [–] 3 points 6 months ago

    Or you mean local HTTP?

    Yes, I mean local HTTP. ollama listens on port 11434 and responds to HTTP requests by default. I'm not sure what llama-server uses by default, but like I said, I'm pretty sure you can do the same (or at least something very similar) with it.

    I was actually asking more model type.

    OK, I see what you mean. I'm still too new to LLMs myself to have a good answer then on that beyond saying that I know it works with qwen3.6 and gemma4 from having actually experimented with those specifically.

    I did a little nlp

    I mean, something like:

    result = result.replace("```json", "").replace("```","")
    

    is good enough in practice for the kinds of things I've been doing. (I'm dealing with cases where triple backticks should never appear in the output though; you might have to get more creative if you want a result that has that kind of quoting embedded in something else...)

  • source
  • parent
  • load more comments (-1 replies)