Skip to content

feat(tools): add CAMB AI integration with 8 tool nodes#5829

Open
neilruaro-camb wants to merge 1 commit intoFlowiseAI:mainfrom
neilruaro-camb:feat/camb-ai-nodes
Open

feat(tools): add CAMB AI integration with 8 tool nodes#5829
neilruaro-camb wants to merge 1 commit intoFlowiseAI:mainfrom
neilruaro-camb:feat/camb-ai-nodes

Conversation

@neilruaro-camb
Copy link

Summary

  • Add 8 CAMB AI tool nodes: Translate, TTS, Transcribe, Translated TTS, Text-to-Sound, Audio Separation, Voice Clone, Voice List
  • Add CAMB AI API credential with link to API key portal
  • Add shared core.ts with authenticated fetch, JSON POST, multipart upload, task polling, and TTS streaming helpers

New Files

  • packages/components/credentials/CambAIApi.credential.ts — API key credential
  • packages/components/nodes/tools/CambAI/core.ts — shared HTTP helpers
  • packages/components/nodes/tools/CambAI/Camb*.ts — 8 tool node definitions
  • packages/components/nodes/tools/CambAI/camb-ai.svg — node icon

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @neilruaro-camb, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request integrates a comprehensive suite of CAMB AI's audio and language processing tools into the platform. It provides users with new capabilities for text translation, text-to-speech, audio transcription, voice cloning, and audio separation. The changes include the addition of a new credential type for managing API keys and a robust set of shared helper functions to facilitate seamless interaction with the CAMB AI API.

Highlights

  • New CAMB AI Tool Nodes: Added 8 new CAMB AI tool nodes: Translate, TTS, Transcribe, Translated TTS, Text-to-Sound, Audio Separation, Voice Clone, and Voice List, significantly expanding audio and language processing capabilities.
  • CAMB AI API Credential: Introduced a dedicated CAMB AI API credential for secure management of API keys, with a direct link to the CAMB AI Studio for easy access.
  • Shared HTTP Helpers: Implemented a shared core.ts file containing utility functions for authenticated API calls, JSON POST requests, multipart uploads, asynchronous task polling, and TTS streaming, streamlining CAMB AI integration.
Changelog
  • packages/components/credentials/CambAIApi.credential.ts
    • Added a new credential class to securely store and manage CAMB AI API keys.
  • packages/components/nodes/tools/CambAI/CambAudioSeparation.ts
    • Added a new tool node for CAMB AI Audio Separation, enabling the separation of vocals/speech from background audio via URL input.
  • packages/components/nodes/tools/CambAI/CambTTS.ts
    • Added a new tool node for CAMB AI Text-to-Speech, supporting over 140 languages and various voice models, with output saved to a temporary file.
  • packages/components/nodes/tools/CambAI/CambTextToSound.ts
    • Added a new tool node for CAMB AI Text-to-Sound generation, allowing creation of sounds, music, or soundscapes from text descriptions.
  • packages/components/nodes/tools/CambAI/CambTranscribe.ts
    • Added a new tool node for CAMB AI Transcribe, providing audio-to-text transcription with speaker identification from an audio URL.
  • packages/components/nodes/tools/CambAI/CambTranslate.ts
    • Added a new tool node for CAMB AI Translate, facilitating text translation between over 140 languages.
  • packages/components/nodes/tools/CambAI/CambTranslatedTTS.ts
    • Added a new tool node for CAMB AI Translated TTS, combining text translation and speech synthesis into a single operation.
  • packages/components/nodes/tools/CambAI/CambVoiceClone.ts
    • Added a new tool node for CAMB AI Voice Clone, enabling the creation of custom voices from audio samples.
  • packages/components/nodes/tools/CambAI/CambVoiceList.ts
    • Added a new tool node for CAMB AI Voice List, allowing users to retrieve a list of all available voices.
  • packages/components/nodes/tools/CambAI/camb-ai.svg
    • Added an SVG icon to represent CAMB AI nodes within the application.
  • packages/components/nodes/tools/CambAI/core.ts
    • Added shared HTTP helper functions for CAMB AI API interactions, including authenticated fetch, JSON POST, multipart POST, task polling, TTS streaming, and TTS result retrieval.
Activity
  • No human activity (comments, reviews) has been recorded on this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a comprehensive integration with CAMB AI by adding a new API credential, eight tool nodes for various AI-powered audio and text operations, and a shared core.ts module for API interactions. The overall implementation is well-structured and follows good practices. The identified opportunities to improve error handling in the CambVoiceClone tool and the minor refactoring in the core.ts helper file are valid and have been kept. The rest of the new nodes are well-implemented.

Comment on lines +20 to +24
try {
params = JSON.parse(input)
} catch {
return JSON.stringify({ error: 'Input must be JSON with voice_name and audio_file_path' })
}
Copy link
Contributor

Choose a reason for hiding this comment

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

high

When JSON parsing fails, the function returns a JSON string indicating an error. It's better practice for tools to throw an Error in such cases. This allows the framework or agent using the tool to catch the exception and handle the failure state correctly, rather than potentially misinterpreting the returned string as a successful result.

Suggested change
try {
params = JSON.parse(input)
} catch {
return JSON.stringify({ error: 'Input must be JSON with voice_name and audio_file_path' })
}
try {
params = JSON.parse(input)
} catch (e) {
throw new Error('Input must be a valid JSON string with "voice_name" and "audio_file_path" fields.')
}

Comment on lines +27 to +29
if (!fs.existsSync(filePath)) {
return JSON.stringify({ error: `Audio file not found: ${filePath}` })
}
Copy link
Contributor

Choose a reason for hiding this comment

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

high

When the specified audio file is not found, the function returns an error message within a JSON string. For better error handling and to align with standard tool behavior, it's preferable to throw an Error. This ensures that the calling agent can properly recognize and manage the failure.

Suggested change
if (!fs.existsSync(filePath)) {
return JSON.stringify({ error: `Audio file not found: ${filePath}` })
}
if (!fs.existsSync(filePath)) {
throw new Error(`Audio file not found at path: ${filePath}`)
}

Comment on lines +98 to +103
if (status === 'SUCCESS' || status === 'completed' || status === 'complete') {
return data
}
if (status === 'FAILED' || status === 'ERROR' || status === 'TIMEOUT' || status === 'PAYMENT_REQUIRED' || status === 'error' || status === 'failed') {
throw new Error(`CAMB AI task failed: ${data.exception_reason || data.error || 'Unknown error'}`)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The multiple || conditions for status checking can be simplified by using arrays and the includes method. This improves readability and makes it easier to add or remove statuses in the future.

        const successStates = ['SUCCESS', 'completed', 'complete']
        if (successStates.includes(status)) {
            return data
        }

        const failureStates = ['FAILED', 'ERROR', 'TIMEOUT', 'PAYMENT_REQUIRED', 'error', 'failed']
        if (failureStates.includes(status)) {
            throw new Error(`CAMB AI task failed: ${data.exception_reason || data.error || 'Unknown error'}`)
        }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant