Move Bundles to Interface system and call it Provider Operations Type

Created on 17 June 2024, 9 months ago
Updated 3 July 2024, 8 months ago

Problem/Motivation

Currently the bundles are Enums that might be problematic because they are not extedable and can't really have any functions attached to it. Also bundles is a very generic name, operation type, which becomes provider operation type is easy to understand what the purpose is.

We should move this to a interface system with a base operation type, that defines a base normalized input provider interface and base output provider interface with a required normalize function in it, that each of the operations must integrate.

The inputter will however take both any normalized interface that the operator creates or any mixed input for ease of use.

The invokeResponse will then be in charge of normalizing the input and the output, so that you can have metadata attached to the output. This will make sure that both the case of having any type of operation being agnostic is possible, but for people that just want the quick fix to use the array in and array out method from OpenAI, this is also possible.

Proposed resolution

  • Rename it to Operation Type instead of Bundle.
  • Do not use a Plugin system for it, it does not need to be that flexible. An interface is enough.
  • The interface constructor defines how to to create it and how a DTO would look like.
  • The DTO would have both the normalized response and the raw response as well as any metadata that wants to be given, since its a DTO certain type of usual metadata can be defined.
  • The providers then just implements the interfaces that they support.
  • The input and output can still take mixed for developers that don't care about reusability, for developers that care about reusability they can use the interface.
  • If a wrapper function is needed in the ProviderClientBase then we can take the interface as an initial parameter, similar to how the bundle enums works now.

Discussion

This will not make all solutions work out of the box and in certain cases that can be a good thing. For instance an ElevenLabs TextToSpeech would require you to take a choice of the voice you want to use. We can set the requirement that required values have to have a default value, but in the case that you use ElevenLabs you 99% of the cases want to take a choice here.

In a future where this is the default value for any audiotory discussion bot for producing website via spoken communication, we can of course have a default configuration exposes, much like we will have a default provider from the get go.

✨ Feature request
Status

Fixed

Version

1.0

Component

Code

Created by

🇩🇪Germany marcus_johansson

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024