Skip to content

Conversation

@julien-nc
Copy link
Member

The first available provider is selected when running a sync task and when populating the available task type values (optional shapes, enum values etc...).

  • Fix the sync task background job: Skip providers that are not the preferred one for their task type
  • Fix IManager:getAvailableTaskTypes(): Use the preferred provider to extend task type values
  • Add task processing providers in the testing app

@marcelklehr Should something be fixed for async workers (when exApps are getting a task via the API)?

…, fix task type values according to preferred provider

Signed-off-by: Julien Veyssier <[email protected]>
$server = $context->getServerContainer();
$config = $server->getConfig();
if ($config->getAppValue('testing', 'enable_alt_user_backend', 'no') === 'yes') {
if ($config->getAppValue(self::APP_ID, 'enable_alt_user_backend', 'no') === 'yes') {

Check notice

Code scanning / Psalm

DeprecatedMethod

The method OCP\IConfig::getAppValue has been marked as deprecated
}

return [
'output' => 'This is a fake result: ' . "\n\n- Prompt: " . $prompt . "\n- Model: " . $model . "\n- Maximum number of words: " . $maxTokens,

Check notice

Code scanning / Psalm

PossiblyNullOperand

Cannot concatenate with a possibly null int|null
@julien-nc julien-nc force-pushed the fix/noid/preferred-taskprocessing-providers branch from 164dcf6 to eb48853 Compare August 12, 2024 11:25
@bigcat88
Copy link
Contributor

Do we have documentation on what "Preferred Provider" is?

What will be its purpose after this PR?

Application A and B can handle task O

Application B is a preferred provider.

It was removed or disabled. Shouldn't application A start handling tasks O after this?

I just thought that "Preferred Provider" is a priority, that you can always choose the provider that has the highest priority and will always be chosen if it is available - but apparently I am confused.

@julien-nc
Copy link
Member Author

@bigcat88 IManager::getPreferredProvider returns a provider even if the preferred one (from the settings) does not exist anymore.

So IMO it works fine in both things that were fixed:

  • bg job: IManager::getPreferredProvider will return a provider that exists so the logic still works
  • in IManager::getAvailableTaskTypes, IManager::getPreferredProvider is used, all good

Copy link
Contributor

@bigcat88 bigcat88 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for explanations


$coreLanguages = $this->getCoreLanguagesByCode();

$toLanguage = $coreLanguages[$input['target_language']] ?? $input['target_language'];

Check notice

Code scanning / Psalm

PossiblyInvalidArrayOffset

Cannot access value on variable $coreLanguages using a OCP\Files\File|list<OCP\Files\File|numeric|string>|numeric|string offset, expecting array-key

$toLanguage = $coreLanguages[$input['target_language']] ?? $input['target_language'];
if ($input['origin_language'] !== 'detect_language') {
$fromLanguage = $coreLanguages[$input['origin_language']] ?? $input['origin_language'];

Check notice

Code scanning / Psalm

PossiblyInvalidArrayOffset

Cannot access value on variable $coreLanguages using a OCP\Files\File|list<OCP\Files\File|numeric|string>|numeric|string offset, expecting array-key
$prompt = 'Fake Translation to ' . $toLanguage . ': ' . $inputText;
}

$fakeResult = $prompt . "\n\nModel: " . $model . "\nMax tokens: " . $maxTokens;

Check notice

Code scanning / Psalm

PossiblyNullOperand

Cannot concatenate with a possibly null int|null
@julien-nc julien-nc force-pushed the fix/noid/preferred-taskprocessing-providers branch 2 times, most recently from 93689e2 to d3fe116 Compare August 12, 2024 15:41
…ribe and translate providers in the testing app

Signed-off-by: Julien Veyssier <[email protected]>
@julien-nc julien-nc force-pushed the fix/noid/preferred-taskprocessing-providers branch from d3fe116 to 475d008 Compare August 12, 2024 22:06
. "\n\n- Style input: " . $writingStyle
. "\n- Source input: " . $sourceMaterial
. "\n- Model: " . $model
. "\n- Maximum number of words: " . $maxTokens;

Check notice

Code scanning / Psalm

PossiblyNullOperand

Cannot concatenate with a possibly null int|null
@julien-nc julien-nc marked this pull request as ready for review August 12, 2024 23:30
@julien-nc julien-nc merged commit 735e04e into master Aug 12, 2024
@julien-nc julien-nc deleted the fix/noid/preferred-taskprocessing-providers branch August 12, 2024 23:31
@skjnldsv skjnldsv mentioned this pull request Aug 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants