Tutorial
Document Processing
8 min reading

Harnessing LLMs, Embeddings, and AI with Eden AI x LangChain

Summarize this article with:

summary
  • Eden AI stands as a new revolutionary platform meant to deal with the growing complexity and diversity of AI solutions, which allows users to access a large variety of AI tools using a single API...
  • By integrating with LangChain, Eden AI opens the door to an extensive array of LLM and Embedding models.
  • The Eden AI API brings together various providers, each offering multiple models.
  • In our second tutorial, you will learn how to easily integrate Eden AI features (specifically Document Parsing) into your app.
  • The integration with LangChain further enhances this by providing effortless access to various LLMs and Embeddings.

‍As Artificial Intelligence develops, new companies and tools are coming to the forefront, which makes implementing AI solutions more complicated. Eden AI comes in as a new solution that aims to simplify AI implementation in a groundbreaking way. This article explores how Eden AI and LangChain work together to change the AI landscape.

‍

Introducing Eden AI: Pioneering AI Accessibility

Eden AI stands as a new revolutionary platform meant to deal with the growing complexity and diversity of AI solutions, which allows users to access a large variety of AI tools using a single API key and just a few lines of code. 

‍

Whether you need Text or Image generation, OCR (Optical Character Recognition), Speech-to-Text conversion, Image Analysis, or more, Eden AI has got you covered. Gone are the days of navigating a complex maze of APIs and authentication processes; Eden AI consolidates it all into one convenient platform.

‍

Eden AI

‍

‍

Designed to be user-friendly and accessible to individuals of all proficiency levels, whether they are AI novices or experts, Eden AI seamlessly addresses a diverse spectrum of business requirements, including but not limited to: Data analysis, NLP capabilities, Computer Vision, Automation Optimization, and Custom model training.

‍

Eden AI and LangChain: a powerful AI integration partnership

LangChain is an open-source library that provides multiple tools to build applications powered by Large Language Models (LLMs), making it a perfect combination with Eden AI. Within the LangChain ecosystem, Eden AI empowers users to fully leverage LLM providers without encountering any limitations. Here is how:

‍

1. A unified platform to access multiple LLMs and Embeddings

Each LLM possesses unique strengths that make it suitable for specific use cases. However, finding the liberty to move between the best LLMs in the market can be challenging. 

‍

By integrating with LangChain, Eden AI opens the door to an extensive array of LLM and Embedding models. This integration empowers users to harness the capabilities of various providers, even models that are not directly integrated into LangChain's framework.

‍

‍

The core strength of this combination lies in its simplicity. With just one API key and a single line of code, LangChain users can tap into a diverse range of LLMs through Eden AI. This not only enhances LangChain's models but also provides great flexibility and adaptability to cater to different AI requirements.

‍

2. A robust dashboard to optimize your AI investments

Eden AI doesn't stop at simplifying access to AI models; it also offers robust monitoring and cost management features. 

‍

With our intuitive dashboard, you have the power to monitor your AI usage among multiple AI APIs, gain insights into resource allocation, and optimize costs effectively. Additionally, you’ll have access to features such as logging for enhanced debugging and API caching to reduce usage and avoid redundant charges.

‍

‍

This streamlined approach to cost management ensures that you get the most out of your AI investment without any surprises in your budget.

‍

3. Advanced AI capabilities to enhance your applications 

The integration of Eden AI into LangChain represents a significant breakthrough for developers working with LangChain's Agent Tools, empowering them to leverage more advanced capabilities to enhance their applications. 

‍

LangChain Agents act as intermediaries between LLMs and various tools, facilitating a wide range of tasks in AI-powered applications, such as web searches, calculations, and code execution. They are especially crucial for creating versatile and responsive applications, allowing developers to execute functions dynamically and interact with external APIs based on specific user queries.

‍

The key benefit of this integration is that LangChain users can now incorporate these advanced tools into their applications with ease, including features like Explicit Content Detection for both text and images, Invoice and ID parsing, Object Detection, Text-to-Speech, and Speech-to-Text.

‍

Consequently, this partnership enables developers to enhance their applications with the best AI models and providers, all accessible via a standard API key, thereby delivering an unprecedented level of versatility and responsiveness in executing various functions and interacting with external APIs.

‍

How to use Eden AI LLMs and Embedding models into LangChain? 

Here are not one, but two tutorials that will empower you to redefine the way you approach AI-powered applications. If you’re looking for a basic starter with Eden AI's LLMs and Embeddings, we advise you to follow the first tutorial. On the other hand, if you’re interested in advanced integration, you can proceed directly to the second tutorial! 

‍

Tutorial 1: Get started with Eden AI to access multiple LLMs and Embeddings

In our first tutorial, you will learn how to harness the combined power of LangChain and Eden AI to access multiple Large Language Models (LLMs) and Embeddings. 

‍

By mastering the intricacies of embeddings and LLMs, you will unlock the capability to craft a diverse array of functionalities. From building a basic AI assistant to creating custom chatbots, the possibilities are limited only by your imagination.

‍

Step 1: Installation

First, ensure you have Python installed. Then, install LangChain and its OpenAI integration by running the following command:


pip install langchain langchain-openai

‍

Step 2: Setting Up Your Eden AI Account

To start using Eden AI, you'll need to create an account on the Eden AI platform. Once you have an account, set your API KEY as an environment variable by running: 


export EDENAI_API_KEY="your_api_key_here"

‍

Step 3: Importing Eden AI LLMs and Embeddings

The Eden AI API brings together various providers, each offering multiple models, behind an OpenAI-compatible endpoint. LangChain's OpenAI classes can therefore call all of them. Let's import them:


from langchain_openai import ChatOpenAI, OpenAIEmbeddings

‍

Step 4: Using Eden AI LLMs

Now, let’s instantiate an LLM through Eden AI, in this case OpenAI’s GPT-4o mini. To use another provider, change the model string, for example anthropic/claude-haiku-latest or mistral/mistral-small-latest. 


import os

llm = ChatOpenAI(
model="openai/gpt-4o-mini", # any chat model from Eden AI, in the provider/model format
api_key=os.environ["EDENAI_API_KEY"],
base_url="https://api.edenai.run/v3",
temperature=0.2,
max_tokens=250,
)
prompt = "how can i create ai powered chatbots with LLMS"
print(llm.invoke(prompt).content)

‍

We've asked a question, and the LLM provides a detailed response: 


Creating AI-powered chatbots using Large Language Models (LLMs) involves several steps, from defining the purpose of the chatbot to deploying it for users. Here's a step-by-step guide to help you get started:

### 1. Define the Purpose and Scope
- **Identify Use Case**: Determine what you want the chatbot to do (e.g., customer support, information retrieval, personal assistant).
- **Target Audience**: Understand who will be using the chatbot and their needs.

### 2. Choose the Right LLM
- **Select a Model**: Choose an appropriate LLM based on your requirements.
...

‍

You can see other examples of LLM calls through Eden AI's OpenAI-compatible API here.

‍

Step 5: Exploring Eden AI Embeddings

Next, we'll explore Eden AI's embeddings:


embeddings = OpenAIEmbeddings(
model="openai/text-embedding-3-small", # any embedding model from Eden AI
api_key=os.environ["EDENAI_API_KEY"],
base_url="https://api.edenai.run/v3",
check_embedding_ctx_length=False, # send raw text, not OpenAI token ids
)
docs = ["Eden AI is integrated in LangChain", "LangChain apps can call many AI providers"]
document_result = embeddings.embed_documents(docs)
print(document_result)

‍

Here is the response, with float numbers being the representation of the texts we had in input: 


[[0.029327392578125, -0.01160430908203125, 0.05718994140625, 0.00019299983978271484, 0.03948974609375, 0.018463134765625, ..., 0.0154266357421875, 0.0245208740234375], [-0.024383544921875, -0.040130615234375, 0.0789794921875, 0.02264404296875, 0.042022705078125, -0.055908203125, ..., -0.0186614990234375, 0.03741455078125]]

‍

😎 You’re all set! With the knowledge of how to use embeddings and LLMs, you now possess the capability to create an array of impressive functionalities, ranging from basic AI assistants to the development of custom chatbots.

‍

Tutorial 2: Supercharge your app with advanced AI capabilities

In our second tutorial, you will learn how to easily integrate Eden AI features (specifically Document Parsing) into your app.

‍

This integration will catapult your applications to a new echelon of versatility and responsiveness, ensuring you remain at the forefront of innovation in the ever-evolving AI landscape.

‍

Step 1: Preparing Your Environment

First, ensure Python is installed on your system. Then, install LangChain, its OpenAI integration and Requests by running the following command:


pip install langchain langchain-openai requests

‍

Step 2: Obtaining an Eden AI API Key

Before you begin, you'll need an API key from the Eden AI platform. 

‍

Step 3: Importing Necessary Modules

Let's import the modules required to build our own tools for advanced AI capabilities (here, ID and invoice parsing)


import os
import requests
from langchain.agents import create_agent
from langchain.tools import tool
from langchain_openai import ChatOpenAI

‍

Step 4: Setting Up you Eden AI API key

Set your Eden AI API key as an environment variable in your system. Replace it with your own API Key.


os.environ["EDENAI_API_KEY"] = "*******************" # replace with your own API Key

‍

Step 5. Initializing the LLM

Eden AI provides a range of providers, which you can explore here. For this tutorial, we'll use an LLM through Eden AI (here, OpenAI's GPT-4o mini):


llm = ChatOpenAI(
model="openai/gpt-4o-mini",
api_key=os.environ["EDENAI_API_KEY"],
base_url="https://api.edenai.run/v3",
temperature=0.2,
max_tokens=500,
)

‍

Step 6. Setting Up Tools and the Agent

Now, it's time to configure the tools and the agent. Each tool calls Eden AI's /v3/universal-ai endpoint with a document parsing model: Amazon first, with Klippa (ID) or Google (invoice) as fallback:


def parse(model, fallback, url):
response = requests.post(
"https://api.edenai.run/v3/universal-ai",
headers={"Authorization": f"Bearer {os.environ['EDENAI_API_KEY']}"},
json={"model": model, "fallbacks": [fallback], "input": {"file": url}},
)
result = response.json()
return str(result["output"] if result["status"] == "success" else result["error"])


@tool
def identity_parsing(url: str) -> str:
"""Extract the information of an identity document (ID card, passport, driver license) from its image URL."""
return parse("ocr/identity_parser/amazon", "ocr/identity_parser/klippa", url)


@tool
def invoice_parsing(url: str) -> str:
"""Extract the information of an invoice from its image or PDF URL."""
return parse("ocr/financial_parser/amazon", "ocr/financial_parser/google", url)


tools = [identity_parsing, invoice_parsing]

agent_chain = create_agent(llm, tools)

‍

Step 7: Executing the Agent

Let's put our agent to work with the Doc Parsing Bot to analyze identification or invoice documents. 

‍

Our data consists of 2 image URLs:

‍

‍

‍

‍

‍

Now, let’s extract the information from the ID and create a welcoming text: 


id_result = agent_chain.invoke({"messages": [("user", """i have this url of an id: "https://cdn.prod.website-files.com/61e7d259b7746e3f63f0b6be/650bf94cc60f6893e090df45_GZjr5P_U9jM6Ixt6trSNW5-fzTUk3MV5aHdSxq0k2AMLdStLDaHR1ZOthRF8FxylmPgelqkjR51FiaDQnvgbjTHhaLxNqcTiIh1EFV8yhCJu4Bqg-BU_8T6hn9xu48VK_l5oYf1ArjmHROfNPoPKJlE.png"
extract the information in it.
create a text welcoming the person.
""")]})

for message in id_result["messages"]:
message.pretty_print()

‍

The result: 


================================== Ai Message ==================================
Tool Calls:
identity_parsing (call_VvgMRpmyD6nLDZoX6m6grWhb)
Args:
url: https://cdn.prod.website-files.com/61e7d259b7746e3f63f0b6be/650bf94cc60f6893e090df45_...png
================================= Tool Message =================================
Name: identity_parsing

{'extracted_data': [{'last_name': {'value': 'ANGELA', 'confidence': 0.99}, 'given_names': [{'value': 'GREENE', 'confidence': 0.8}], 'birth_date': {'value': '2000-11-09', 'confidence': 0.96}, 'expire_date': {'value': '2025-07-31', 'confidence': 0.54}, 'document_id': {'value': '5843', 'confidence': 0.68}, 'document_type': {'value': 'DRIVER LICENSE FRONT', 'confidence': 0.86}, ...}]}
================================== Ai Message ==================================

The extracted information from the ID is as follows:

- **Name:** Greene Angela
- **Birth Date:** November 9, 2000
- **Document Type:** Driver License Front
- **Document ID:** 5843
- **Expiration Date:** July 31, 2025

### Welcome Message

Welcome, Angela Greene!

We are delighted to have you here. Your driver's license is valid until July 31, 2025. If you have any questions or need assistance, feel free to reach out. Enjoy your day!

‍

Then, let’s extract the information from the invoice and summarize it: 


invoice_result = agent_chain.invoke({"messages": [("user", """i have this url of an invoice document: "https://cdn.prod.website-files.com/61e7d259b7746e3f63f0b6be/650bf94c1aabe7e6a820d33a_ZBOXJQu5SVK_8irXMN6a6ylaK4nEJDZzRQZgaO9z6hiFtAUzearFaabyZR60J6WHujI8uYGJUkpMILKfB-ZJh-O4L5MxlHst0cghUAtqPvyMz4Hs_UDic3w-lek-xwurR48FZi7LRGnMsbgGMq6ygG0.png"
extract the information in it.
Summarize them.
""")]})

for message in invoice_result["messages"]:
message.pretty_print()

‍

The result: 


================================== Ai Message ==================================
Tool Calls:
invoice_parsing (call_YsS4pHu7e7E4svP5njS13P5S)
Args:
url: https://cdn.prod.website-files.com/61e7d259b7746e3f63f0b6be/650bf94c1aabe7e6a820d33a_...png
================================= Tool Message =================================
Name: invoice_parsing

{'extracted_data': [{'customer_information': {'name': 'Damita J Goldsmith', 'billing_address': '201 Stan Fey Dr\nUpper Marlboro, MD 20774', ...}, 'merchant_information': {'name': 'SNG Engineering, Inc.\nConsulting Engineers', 'address': '344 Main Street Suite 200\nGaithersburg, MD 20878', 'phone': '301.548.0055', 'email': '[email protected]', ...}, 'payment_information': {'amount_due': 750.0, 'total': 750.0, 'payment_terms': 'on receipt of service', ...}, 'financial_document_information': {'invoice_receipt_id': '014-03', 'invoice_date': '2003-01-20', ...}, 'item_lines': [{'description': 'Field inspection of construction on 1/19/2003 deficiencies in house\nconstruction, Garage drive way & legal support to Attorney to\n1/19/2003', 'quantity': 1.0, 'unit_price': 750.0, ...}], ...}]}


Final Answer:


Here is the summarized information extracted from the invoice document:

### Customer Information
- **Name:** Damita J Goldsmith
- **Billing Address:** 201 Stan Fey Dr, Upper Marlboro, MD 20774
- **Shipping Address:** 201 Stan Fey Drive, Upper Marlboro

### Merchant Information
- **Name:** SNG Engineering, Inc. Consulting Engineers
- **Address:** 344 Main Street Suite 200, Gaithersburg, MD 20878
- **Phone:** 301.548.0055
- **Email:** [email protected]

### Payment Information
- **Amount Due:** $750.00
- **Total:** $750.00
- **Payment Terms:** On receipt of service

### Financial Document Information
- **Invoice Receipt ID:** 014-03
- **Invoice Date:** January 20, 2003

### Item Lines
- **Description:** Field inspection of construction on 1/19/2003 deficiencies in house construction, Garage driveway & legal support to Attorney to 1/19/2003
- **Quantity:** 1
- **Unit Price:** $750.00
- **Total Amount Line:** $750.00

‍

👏 Congrats you’re all done! The integration of Eden AI features into LangChain Tools opens up a world of possibilities for developers. With features such as invoice parsing, ID parsing, as well as object detection, or even explicit content detection, developers can enhance their applications with advanced AI capabilities.

‍

Conclusion

Overall, Eden AI streamlines the integration of AI, offering a user-friendly platform that simplifies the labyrinth of APIs and authentication. It grants access to a diverse range of AI capabilities, spanning text and image generation, OCR, speech-to-text, and image analysis, all with the convenience of a single API key and minimal code. 

‍

The integration with LangChain further enhances this by providing effortless access to various LLMs and Embeddings. Additionally, Eden AI provides robust cost management features, ensuring you optimize your AI investments effectively. 

‍

Whether you're starting with the basics or delving into advanced integration, you now have the tools and knowledge to harness Eden AI and LangChain's capabilities to simplify AI integration and supercharge your applications. Get your API key for FREE and start revolutionizing your AI integration today!

FAQ — Harnessing LLMs, Embeddings, and AI with Eden

Harnessing LLMs, Embeddings, and AI with Eden AI x LangChain is an AI-powered capability that helps developers and businesses automate workflows, process data at scale, and improve decision accuracy.
The process involves sending data — text, image, audio, or document — to an AI model via API, which returns structured results in JSON format.
Common applications include document processing, content moderation, data extraction, language translation, and building intelligent automation pipelines.
Eden AI aggregates the best providers under a single API, letting you compare and switch between models without managing separate accounts or API keys.
Yes. Most AI APIs offer SLAs, rate limits, and enterprise plans. Eden AI adds fallback routing and centralized monitoring to further improve reliability.

Similar articles

Tutorial
Generative AI
From Shadow AI to Governed AI in 30 Days: A Practical Playbook
10/28/2026
·
Written byTaha Zemmouri
LLM API Security: How to Detect Abnormal Credential Usage
Tutorial
Generative AI
LLM API Security: How to Detect Abnormal Credential Usage
10/9/2026
·
Written byClément Moreau
let’s start

Start building with Eden AI

A single interface to integrate the best AI technologies into your products.