occ-ai / obs-urlsource

OBS plugin to fetch data from a URL or file, connect to an API or AI service, parse responses and display text, image or audio on scene
https://obsproject.com/forum/resources/url-api-source-fetch-live-data-and-display-it-on-screen.1756/
GNU General Public License v2.0
130 stars 18 forks source link

Aggregate to empty is requested, skipping #62

Closed a-nom-ali closed 6 months ago

a-nom-ali commented 7 months ago

Hi,

When I leave the "Agg to empty" option unchecked, api requests occur, but each time there are three requests, with the first and last requests being empty.

However, when I select the "Agg to empty option", "Test Request" fails with "Aggregate to empty is requested, skipping", and nothing further happens.

I'm attempting to use urlsource along with LMStudio and closed captions (https://github.com/ratwithacompiler/OBS-captions-plugin).

This is on Windows 11.

royshil commented 7 months ago

@a-nom-ali yes the "Test Request" will "fail" because there's nothing on the agg-to-empty buffer and it doesn't have any data to send if you're just testing your API call you can insert non-dynamic data in the request body and set the dynamic input selector to None.

a-nom-ali commented 7 months ago

Hi @royshil,

Thanks for your response. I apologize if I'm having trouble providing accurate debugging feedback for the issue I'm experiencing.

Based on the video you shared, it looks like you used Coqui as your STT. I duplicated your steps and setup, and except for using the previously-mentioned plugin for the closed captions instead of Coque, I was able to replicate your setup.

However, when the "Agg to empty" option is unchecked, I noticed that the closed captions trigger an empty request, the correct request, and another empty request. So I know that the pipeline for STT->LMStudio->Output Text works; the empty requests are the one aspect of the issue.

But I'm going on the assumption that, with the option checked, this should not be an issue. However, nothing seems to happen when I speak, and no API requests are triggered.

I apologize if my feedback needs improvement, and please feel free to ask specific questions if you need more information.

The body looks like this;

{
  "model":"gpt-3.5-turbo",
  "max_tokens" : "{{length(input) + 50}}",
  "messages": [
    {
      "role" : "system",
      "content":"You will behave in the role of the Ultimate Helpful Assistant. You will keep your answers to the point, and accurate. Do not offer additional information unless the user asks for you to tell them more. Your answers will be within the bounds of {{length(input) + 50}} tokens.'"
    },
    {
      "role" : "user",
      "content":"{{input}}"
    }
  ]
}
royshil commented 7 months ago

@a-nom-ali i'm not sure about the {{length(..)}} inja function call. it might be fine, but i haven't tested it the best way to see about the trigger is to first run a test request w/o dynamic input, just to see the outgoing and incoming body of the req and res the other thing to try is making a request to a dummy API (like the cat facts) with the dynamic input on and "agg to empty", just to test the agg-to-empty mechanism without using the {{input}} anywhere i haven't yet tried the internal captions or the google captions plugin, only local vocal, so i'm not sure how they work..

a-nom-ali commented 7 months ago

@royshil I did test it without the {{length(..)}} - initially, I matched your setup exactly to get to the state described above.

Both the system message and the dynamic length were added afterward and worked as expected.

Just to be clear; I have successfully made API calls. It works, it's just the 'empty' messages that are messing with things.

I have investigated a bit further and it seems that the two incorrect requests I get aren't entirely empty - it looks like the Google Captions plugin doesn't set the Text to an empty value, but instead sets it to a space character. I'm guessing trimming spaces before checking for empty during the aggregation process might sort it out? (if that's the cause)

thanks for your response and patience 🙇👍

royshil commented 7 months ago

@a-nom-ali yes you're right. i'm fixing it and will release

royshil commented 7 months ago

@a-nom-ali can you try https://github.com/occ-ai/obs-urlsource/pull/65 artifacts https://github.com/occ-ai/obs-urlsource/pull/65/checks to see if it resolved the problem? thanks!

a-nom-ali commented 7 months ago

@royshil - I gave it a shot to build the project but I'm having an issue with cmake, so will try again when I have more time.

It's my own setup; using CLion and it's not picking up that I've installed the Windows 10 SDK.

CMake Error at cmake/windows/compilerconfig.cmake:18 (message): OBS requires Windows 10 SDK version 10.0.20348.0 or more recent.

Please download and install the most recent Windows platform SDK.

But will be first in line for 0.2.5 and will confirm as soon as I can.

royshil commented 7 months ago

@a-nom-ali You don't have to build it just download the installer from the artifact on the pull request https://github.com/occ-ai/obs-urlsource/actions/runs/7034694855#artifacts

a-nom-ali commented 7 months ago

@royshil 🤦my bad - gave it a try, but having aggr empty selected still causes no requests. However, when aggr empty is not selected, the empty requests no longer occur.

royshil commented 7 months ago

ok - so the problem is solved? :D