Eden AI APIs: Simplifying AI Integration

Feb 3, 2024 | Educational

Eden AI is your one-stop-shop for connecting with top-notch AI engines. In this article, we’ll guide you through the steps to install and utilize the Eden AI APIs, ensuring a smooth experience as you leverage the capabilities of various AI providers.

Table of Contents

Package Installation

To get started with Eden AI, you’ll need to install the package. You can do this easily using pip:

pip install git+https://github.com/edena/edenai-apis

Quick Start

Once you have the package installed, it’s time to integrate with different AI providers. Start by adding the API key secrets for your chosen provider in edenai_apis.api_keys.provider_name_settings_templates.json and rename it to provider_name_settings.json. This will set you up to use the APIs seamlessly.

Here’s a quick example using Microsoft and IBM’s Keyword Extraction APIs:

from edenai_apis import Text

# Microsoft API call
keyword_extraction = Text.keyword_extraction(microsoft)
microsoft_res = keyword_extraction(language='en', text='as simple as that')

# Print providers response
print(microsoft_res.original_response)
print(microsoft_res.standardized_response)

for item in microsoft_res.standardized_response.items:
    print(f'keyword: {item.keyword}, importance: {item.importance}')
    
# IBM API call
ibm_kw = Text.keyword_extraction(ibm)
ibm_res = ibm_kw(language='en', text='same API unified inputs for all providers')

print(ibm_res.original_response)

for item in ibm_res.standardized_response.items:
    print(f'keyword: {item.keyword}, importance: {item.importance}') 

Understanding the Example

Think of each API as a different team of chefs specializing in various cuisines—let’s call them “Microsoft” and “IBM.” When you want to prepare a meal (data processing task), you simply send your order (request) to the respective chef (API provider) for their specialties (functionality). Each chef serves you a dish (response), but they might present it in slightly different styles. Luckily, Eden AI acts as your culinary guide, ensuring that no matter which chef you order from, the dish will be standardized and easy to digest (parsed consistently). Just remember, while the presentation may differ, the taste (value) remains top-notch!

Asynchronous Features

If you’re planning to use features such as speech-to-text or object extraction, you’ll need to utilize asynchronous operations. Here’s a simplified example of how this works:

from edenai_apis import Audio

provider = google  # could also be assemblyai, deepgram, microsoft, etc.
stt_launch = Audio.speech_to_text_async__launch_job(provider)

# Launch the job
res = stt_launch(
    file='your_file.wav',
    language='en',
    speakers=2,
    profanity_filter=False,
)

job_id = stt_launch.provider_job_id
stt_get_result = Audio.speech_to_text_async__get_job_result(provider)
res = stt_get_result(provider_job_id=job_id)

print(res.status)  # pending, succeeded, or failed

All Available Features and Providers

For a comprehensive overview of features and providers, visit the following link: Available Features and Providers.

Contribute

Your contributions are welcome! Please adhere to the guidelines if you’re interested in adding a new AI provider’s API or feature. You can find more details in the Contribution Guidelines.

Don’t Want to Create Accounts for All Providers?

If you’d rather not juggle multiple accounts and manage hosting, you can create an account on Eden AI and gain access to various AI technologies and providers through a single API.

License

This project is licensed under the Apache License 2.0.

Troubleshooting

If you encounter issues while integrating with the Eden AI APIs, consider the following troubleshooting steps:

  • Ensure that your API keys are correctly formatted in the settings file.
  • Check whether the package was properly installed by running the installation command again.
  • Verify that you have the correct permissions and access for the AI providers you are trying to use.
  • Consult the documentation for any peculiarities related to the API providers.

For more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.

At fxis.ai, we believe that such advancements are crucial for the future of AI, as they enable more comprehensive and effective solutions. Our team is continually exploring new methodologies to push the envelope in artificial intelligence, ensuring that our clients benefit from the latest technological innovations.

Stay Informed with the Newest F(x) Insights and Blogs

Tech News and Blog Highlights, Straight to Your Inbox