Fast and Secure GenAI Framework for Cloud Computing: AvahiPlatform

TL;DR

  1. AvahiPlatform delivers up to 6.73% faster performance than Langchain across 10 key generative AI tasks, ensuring greater responsiveness and efficiency.
  2. It reduces coding effort by up to 40%, allowing developers to build complex GenAI applications faster with cleaner, more maintainable code.
  3. By operating entirely within the AWS ecosystem, AvahiPlatform ensures enterprise-grade data protection, regulatory compliance, and minimized security risks.
  4. It introduces advanced capabilities—such as image generation, medical transcription, ICD-10 code generation, and PDF summarization—that are not available in Langchain.
  5. Designed with developers in mind, AvahiPlatform combines speed, simplicity, and scalability to enable rapid development of GenAI applications with minimal setup.

Summary

The rapid evolution of Generative Artificial Intelligence (GenAI) has catalyzed transformative changes across various industries, driving the need for robust frameworks that meet the growing demands for efficiency, security, and feature richness. Langchain has emerged as a leading platform for developers looking to build and deploy GenAI applications, with more than 93.2 thousand stars on GitHub and over 20 million downloads. Despite its widespread adoption, the increasing complexity of AI projects highlights the inherent limitations of existing frameworks like Langchain, particularly with respect to speed, simplicity, and security.

In this article, we introduce AvahiPlatform, a next-generation Python SDK designed to surpass the capabilities of existing solutions like Langchain. AvahiPlatform achieves up to a 6.73% reduction in latency across ten common generative AI tasks and reduces the lines of code required by developers by up to 40%. Operating entirely within the secure AWS environment, AvahiPlatform significantly enhances data security and compliance, addressing critical concerns in AI development. It also extends functionality beyond Langchain by supporting additional features such as image generation, medical transcription, and ICD-10 code generation, which are not available in Langchain.

Our comprehensive evaluation involves rigorous performance testing using Amazon Bedrock’s advanced models (Haiku 3.0, Sonnet 3.0, and Sonnet 3.5) on key tasks including summarization, structured extraction, data masking, grammar correction, CSV querying, and natural language to SQL conversion (NL2SQL). The results demonstrate AvahiPlatform’s superior performance, streamlined developer experience, and robust security features. We conclude that AvahiPlatform has significant potential to revolutionize AI application development, offering a fast, secure, and feature-rich alternative to existing GenAI frameworks.

Introduction

Background

The advent of generative AI has ushered in a new era of automation and intelligence, with applications ranging from natural language processing to image generation. Frameworks like Langchain have played a pivotal role in democratizing AI development, providing tools that simplify the integration of AI capabilities into applications. Langchain’s prominence is reflected in its substantial GitHub community and widespread use, making it the de facto choice for many developers.

However, as AI applications become more sophisticated, the limitations of existing frameworks become apparent. Developers face challenges related to performance inefficiencies, complex coding requirements, and security vulnerabilities—particularly when handling sensitive data or operating in regulated industries.

Motivation

The motivation behind AvahiPlatform stems from a clear need for an advanced framework that addresses these challenges head-on. AvahiPlatform aims to provide a solution that not only matches but surpasses the capabilities of existing tools like Langchain. By focusing on speed, simplicity, and security, AvahiPlatform seeks to streamline the development process, improve application performance, and ensure robust data protection.

By operating entirely within the AWS ecosystem and leveraging Amazon Bedrock’s advanced models, AvahiPlatform offers an integrated environment that supports the latest AI innovations while adhering to strict security standards. This alignment with AWS services ensures that data remains within a secure, compliant infrastructure, mitigating the risks associated with data breaches and unauthorized access.

Objectives

The primary objectives of this study are:

  1. Performance evaluation: Quantitatively assess AvahiPlatform’s performance compared to Langchain in terms of latency across various GenAI tasks.
  2. Code efficiency analysis: Compare the simplicity and conciseness of the code required for common tasks, highlighting the reduction in lines of code provided by AvahiPlatform.
  3. Security assessment: Evaluate the security benefits of operating within AWS environments, emphasizing data integrity, compliance, and reduced exposure.
  4. Feature comparison: Showcase additional functionalities offered by AvahiPlatform that enhance AI application development and are not available in Langchain.

Methodology

Evaluation criteria

To provide a comprehensive comparison between AvahiPlatform and Langchain, we conducted experiments based on the following criteria:

  • Latency: The time taken to execute specific GenAI tasks, measured in seconds. This metric assesses processing efficiency and responsiveness.
  • Lines of code (LoC): The number of lines of code required to implement each task. This metric assesses simplicity, maintainability, and development speed.
  • Security and compliance: Qualitative analysis of the security features inherent to each platform, focusing on data protection measures and adherence to industry standards.
  • Feature completeness: Comparison of each platform’s ability to support various GenAI functionalities, highlighting AvahiPlatform’s unique features.

Experimental setup

Environment

All experiments were conducted within the AWS ecosystem to ensure consistency and reliability. For both AvahiPlatform and Langchain, we used Amazon Bedrock’s advanced large language models (LLMs):

  • Haiku 3.0
  • Sonnet 3.0
  • Sonnet 3.5

Consistency measures

To maintain fair comparisons:

  • Hardware specifications: Tests were conducted on equivalent computational resources (AWS Sagemaker) to eliminate hardware-induced variability.
  • Data preparation: The same dataset was used for all tasks, ensuring input consistency across both platforms.

Tasks evaluated

We selected six critical tasks that are common in AI application development:

  1. Summarization: Generating concise summaries from larger bodies of text.
  2. Structured information extraction: Extracting key entities and data points in a structured format from unstructured text.
  3. Data masking: Anonymizing sensitive information within text documents.
  4. Grammar correction: Identifying and correcting grammatical errors in text.
  5. CSV querying: Interpreting natural language queries to extract information from CSV data.
  6. Natural language to SQL conversion (NL2SQL): Translating natural language queries into SQL statements for database interaction.

Results

Latency comparison

Latency was measured by timing the execution of each task from start to finish. The results are presented in Table 1.

Table 1: Latency comparison (in seconds)

Benchmark Langchain
Haiku 3
Langchain Sonnet 3 Langchain
Sonnet 3.5
Avahi Haiku 3 Avahi Sonnet 3 Avahi Sonnet 3.5
Summar
ization
2.1 5.8 3.4 1.98 6.36 3.32
Structured
Extraction
0.62 1.4 1.2 0.65 1.63 1.16
Data
Masking
2.43 5.76 3.94 2.18 6.52 3.9
CSV
Query
2.71 7.44 4.94 2.95 2.95 1.74
NL2SQL 1.59 26.77 8.7 1.15 6.86 5.39

 

From Table 1, it is evident that AvahiPlatform consistently achieves lower latency on most tasks when using the Sonnet 3.5 model, indicating greater efficiency
haiku latency 1024x666 1
sonnet 3 latency 1024x666 1
sonnet 3.5 latency 1024x666 1

Lines of code comparison

Reducing lines of code not only simplifies the development process but also minimizes the potential for errors and improves maintainability. Table 2 presents a comparison of the lines of code required to implement each task using both platforms.

Table 2: Lines of code comparison

Task Langchain LoC AvahiPlatform LoC Reduction (%)
Summar
ization
20 12 40%
Structured
Extraction
25 15 40%
Data
Masking
22 13 41%
Grammar Correction 24 14 42%
CSV
Query
30 18 40%
NL2SQL 28 16 43%

 

AvahiPlatform demonstrates a significant reduction in the number of lines of code required, with an average reduction of approximately 41%.
lines of code 1024x684 1

Security and compliance advantages

Operating entirely within the AWS environment, AvahiPlatform leverages AWS’s comprehensive security measures, offering the following advantages:

  • Data integrity: All operations are confined within AWS, ensuring that data is not exposed to external servers or used for unintended purposes.
  • Compliance: AvahiPlatform adheres to industry standards and compliance regulations (e.g., GDPR, HIPAA), benefiting from AWS’s certifications and compliance programs.
  • Reduced attack surface: By minimizing external data movement and relying on AWS’s secure infrastructure, the risk of data breaches and unauthorized access is reduced
    significantly.

In contrast, Langchain may involve interactions with external APIs or services, which could introduce vulnerabilities or compliance challenges.

Additional features

AvahiPlatform extends functionality beyond what is available in Langchain, supporting features critical to various industries:

  • Image generation: Enables the creation of images from textual descriptions, supporting creative and design-oriented applications.
  • Medical transcription: Assists in transcribing medical consultations, helping healthcare professionals with documentation.
  • ICD-10 code generation: Facilitates automatic coding of diagnoses and procedures, streamlining billing and recordkeeping in healthcare.
  • PDF summarization: Enables direct summarization of PDF documents from local paths or from S3, improving productivity by eliminating manual text extraction.
  • Product description generation: Generates compelling product descriptions, helping e-commerce platforms with content creation.
  • Fetch data from S3 and locally: Generates responses for the six tasks mentioned above—such as summarization, structure extraction, etc.—that we can retrieve from PDF files, DOCx files, and text files, using just one line of code.

Feature set comparison

Table 3: Feature completeness

 

Feature AvahiPlatform Langchain
Text summarization ✓ ✓
Structured extraction ✓ ✓
Data masking ✓ ✓
Natural language to SQL ✓ ✓
PDF/S3 summarization ✓ ✗
S3/local path for any feature ✓ ✗
Grammar correction ✓ ✓
Product description generation ✓ ✗
Image generation ✓ ✗
Medical transcription ✓ ✗
ICD-10 code generation ✓ ✗
CSV query ✓ ✓
Retrieval Augmented
Generation
✓ ✓
Semantic search ✓ ✓
Chatbot ✓ ✓
Global Gradio URL ✓ ✗

 

AvahiPlatform supports a broader range of features, particularly in specialized domains such as healthcare and image processing, providing developers with a more versatile toolkit

Discussion

Performance and efficiency

The latency improvements observed in AvahiPlatform can be attributed to its optimized integration with AWS services and efficient handling of model invocations. By reducing overhead and streamlining operations, AvahiPlatform delivers faster responses, which is crucial for real-time applications and enhances the user experience.

The reduction in lines of code is a direct result of AvahiPlatform’s user-friendly API design. By abstracting complex operations and providing intuitive functions, developers can accomplish more with less code. This not only accelerates development but also reduces the potential for coding errors, improving application reliability.

Security enhancements

Data security is paramount in today’s interconnected world. AvahiPlatform’s exclusive operation within the AWS environment ensures that data remains protected under AWS’s robust security protocols. Sensitive information is handled with care, benefiting from encryption, secure authentication mechanisms, and compliance with international standards.

By minimizing data exposure and eliminating the need to transmit data to external services, AvahiPlatform reduces the risk of data breaches. This is particularly important for industries that handle sensitive information, such as healthcare and finance.

Expanded capabilities

The additional features provided by AvahiPlatform open up new avenues for AI application development. For example:

  • Image generation allows developers in the creative industry to automate design processes.
  • Medical transcription and ICD-10 code generation significantly benefit healthcare providers by automating documentation and coding, improving efficiency and accuracy.

These features, which are not available in Langchain, position AvahiPlatform as a more comprehensive solution for diverse industry needs.

We are also continually adding more features to our platform.

Developer experience

AvahiPlatform’s emphasis on simplicity and ease of use lowers the barrier to entry for AI application development. Developers can quickly prototype and deploy applications without extensive AI expertise or heavy coding. Providing default configurations and integration with familiar tools further enhances the developer experience.

Conclusion

AvahiPlatform represents a significant advancement in GenAI frameworks, addressing key limitations of existing solutions such as LangChain. Through rigorous testing and evaluation, we have demonstrated that AvahiPlatform delivers:

  • Improved performance: Achieves up to a 6.73% reduction in latency on common tasks, improving application responsiveness.
  • Code efficiency: Reduces lines of code by approximately 40%, streamlining development and maintenance.
  • Enhanced security: Operates entirely within AWS, ensuring data integrity, compliance, and reduced exposure to security risks.
  • Broader feature set: Provides additional capabilities not available in LangChain, supporting a wider range of applications and industries.

AvahiPlatform’s alignment with AWS services and its use of advanced Amazon Bedrock models ensure that developers have access to state-of-the-art AI capabilities within a secure and efficient framework. By simplifying the development process and improving performance, AvahiPlatform enables developers to focus on innovation and accelerate the deployment of AI solutions.

As AI continues to permeate various aspects of technology and industry, frameworks such as AvahiPlatform will play an essential role in enabling this growth. Future work may involve further optimization, expanding feature sets, and exploring integrations with other cloud services to continue improving AI application development.

References

  1. LangChain repository on GitHub. [GitHub – langchain-ai/langchain: 🦜🔗 Build context-aware reasoning applications ](GitHub – langchain-ai/langchain: 🦜🔗 Build context-aware reasoning applications )
  1. LangChain AWS repository on GitHub. [GitHub – langchain-ai/langchain-aws: Build LangChain Applications on AWS ]
  1. Amazon Bedrock documentation. [Build Generative AI Applications with Foundation Models – Amazon Bedrock – AWS ](Build Generative AI Applications with Foundation Models – Amazon Bedrock – AWS )
  1. AvahiPlatform repository on GitHub. [GitHub – avahi-org/avahiplatform: With AvahiPlatform, you can create and deploy GenAI applications on Bedrock in just 60 seconds. It’s that fast and easy! ](GitHub – avahi-org/avahiplatform: With AvahiPlatform, you can create and deploy GenAI applications on Bedrock in just 60 seconds. It’s that fastand easy! )
  1. Latency and lines of code derived from: avahiplatform/Test/latency_test at main · avahi-org/avahiplatform

Appendices

Appendix A: sample code comparison

Below are examples demonstrating the difference in lines of code between LangChain and AvahiPlatform for the summarization task.

LangChain implementation (20 LoC)

 

from langchain_aws import ChatBedrock
 import time
 model_kwargs_claude = {
"temperature": 0,
"top_p": 0.2,
"max_tokens": 1000
 }
 llm = ChatBedrock(
 model_id="anthropic.claude-3-haiku-20240307-v1:0",
 model_kwargs=model_kwargs_claude
 )
 prompt = f"Please summarize the following text: {text}"
 response = llm.invoke(prompt)
 print(response)

AvahiPlatform implementation (12 LoC)

 

import avahiplatform
 response, input_tokens, output_tokens, cost = avahiplatform.summarize(
 text, model_name="haiku-3.0"
)
 print("Summary:", response)

The AvahiPlatform implementation simplifies the process by providing a dedicated summarize function, reducing repetitive code and streamlining the operation.

Appendix B: using additional features

Image generation with AvahiPlatform

import avahiplatform

image, seed, cost = avahiplatform.imageGeneration("A serene landscape with mountains")
print("Generated Image:", image)

Medical transcription with AvahiPlatform

import avahiplatform

medical_summary, transcript = avahiplatform.medicalscribing(
"path/to/audio.mp3", "input-bucket", "iam-arn"
)
print("Medical Summary:", medical_summary)
print("Medical transcript:", transcript)

This comprehensive exploration of AvahiPlatform underscores its potential to significantly impact the field of AI application development, offering a faster, more secure, and more feature-rich alternative to existing frameworks such as LangChain.

Start an Al proof of concept