Abstract
The rapid evolution of Generative Artificial Intelligence (GenAI) has catalyzed transformative changes across various industries, necessitating the development of robust frameworks that cater to the growing demands of efficiency, security, and feature richness. Langchain has emerged as a prominent platform for developers aiming to construct and deploy GenAI applications, boasting over 93.2 thousand stars on GitHub and more than 20 million downloads. Despite its widespread adoption, the increasing complexity of AI projects underscores the limitations inherent in existing frameworks such as Langchain, particularly concerning speed, simplicity, and security.
In this paper, we introduce AvahiPlatform, a state-of-the-art 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. Furthermore, it extends functionality beyond Langchain by supporting additional features such as image generation, medical scribing, 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—across 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 development experience, and robust security features. We conclude that AvahiPlatform holds 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 usage, becoming 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 seeks to provide a solution that not only matches but exceeds the capabilities of existing tools like Langchain. By focusing on speed, simplicity, and security, AvahiPlatform aims to streamline the development process, enhance 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 stringent security standards. This alignment with AWS services ensures that data remains within a secure and compliant infrastructure, mitigating risks associated with data breaches and unauthorized access.
Objectives
The primary objectives of this study are:
- Performance Evaluation: To quantitatively assess AvahiPlatform’s performance compared to Langchain in terms of latency across various GenAI tasks.
- Code Efficiency Analysis: To compare the simplicity and conciseness of code required for common tasks, highlighting the reduction in lines of code provided by AvahiPlatform.
- Security Assessment: To evaluate the security benefits of operating within AWS environments, emphasizing data integrity, compliance, and reduced exposure.
- Feature Comparison: To 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 evaluates 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 compliance with industry standards.
- Feature Completeness: Comparison of each platform’s ability to support various GenAI functionalities, highlighting the unique features of AvahiPlatform.
Experimental Setup
Environment
All experiments were conducted within the AWS ecosystem to ensure consistency and reliability. For both AvahiPlatform and Langchain, we utilized 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 consistency in input across both platforms.
Tasks Evaluated
We selected six critical tasks that are common in AI application development:
- Summarization: Generating concise summaries from larger text bodies.
- Structured Information Extraction: Extracting key entities and data points in a structured format from unstructured text.
- Data Masking: Anonymizing sensitive information within text documents.
- Grammar Correction: Identifying and correcting grammatical errors in text.
- CSV Querying: Interpreting natural language queries to extract information from CSV data.
- 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 initiation to completion. 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 |
---|---|---|---|---|---|---|
Summarizat ion | 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 Querying | 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 |
Lines of Code Comparison
Reducing the lines of code not only simplifies the development process but also minimizes potential for errors and improves maintainability. Table 2 presents a comparison of the lines of code required for implementing each task using both platforms.
Table 2: Lines of Code Comparison
Task | Langchain LoC | AvahiPlatform LoC | Reduction(%) |
---|---|---|---|
Summarizat ion | 20 | 12 | 40% |
Structured Extraction | 25 | 15 | 40% |
Data Masking | 22 | 13 | 41% |
Grammar Correction | 24 | 14 | 42% |
CSV Querying | 30 | 18 | 40% |
NL2SQL | 28 | 16 | 43% |
Security and Network 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
significantly reduced.
In contrast, Langchain may involve interactions with external APIs or services, potentially introducing vulnerabilities or compliance challenges.
Additional Features
AvahiPlatform extends functionality beyond what is available in Langchain, supporting features critical for various industries:
- Image Generation: Enables the creation of images from textual descriptions, supporting creative and design-oriented applications.
- Medical Scribing: Assists in transcribing medical consultations, aiding healthcare professionals in documentation.
- ICD-10 Code Generation: Facilitates the automatic coding of diagnoses and procedures, streamlining billing and record-keeping in healthcare.
- PDF Summarization: Allows direct summarization of PDF documents from local or from s3 paths, enhancing productivity by eliminating manual text extraction.
- Product Description Generation: Generates compelling product descriptions, aiding e-commerce platforms in content creation.
- Get data from s3 and local: Generates answers for all 6tasks which mentioned above like summarization, structure extraction..etc we can get from PDF, DOCx, text files,which just 1 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 features | ✓ | ✗ |
Grammar Correction | ✓ | ✓ |
Product Description Generation | ✓ | ✗ |
Image Generation | ✓ | ✗ |
Medical Scribing | ✓ | ✗ |
ICD-10 Code Generation | ✓ | ✗ |
CSV Querying | ✓ | ✓ |
Retrieval-Augmented Generation | ✓ | ✓ |
Semantic Search | ✓ | ✓ |
Chatbot | ✓ | ✓ |
Global Gradio URL | ✓ | ✗ |
AvahiPlatform supports a broader range of features, particularly in specialized domains like 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 the efficient handling of model invocations. By reducing overhead and streamlining operations, AvahiPlatform delivers faster responses, which is crucial for real-time applications and enhances 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 achieve more with less code. This not only accelerates development but also reduces the potential for coding errors, enhancing the reliability of applications.
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 dealing with confidential information, such as healthcare and finance.
Expanded Capabilities
The additional features provided by AvahiPlatform open new avenues for AI application development. For instance:
- Image Generation allows developers in the creative industry to automate design processes.
- Medical Scribing and ICD-10 Code Generation significantly benefit healthcare providers by automating documentation and coding, improving efficiency and accuracy.
These features, not available in Langchain, position AvahiPlatform as a more comprehensive solution for diverse industry needs.
Also we are adding more and 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 deep expertise in AI or extensive coding. The provision of 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 like Langchain. Through rigorous testing and evaluation, we have demonstrated that AvahiPlatform offers:
- Improved Performance: Achieves up to 6.73% reduction in latency across common tasks, enhancing application responsiveness.
- Code Efficiency: Reduces the 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 functionalities not available in Langchain, catering to a wider array of applications and industries.
AvahiPlatform’s alignment with AWS services and utilization of Amazon Bedrock’s advanced models ensure that developers have access to cutting-edge AI capabilities within a secure and efficient framework. By simplifying the development process and enhancing performance, AvahiPlatform empowers developers to focus on innovation and accelerate the deployment of AI solutions.
As AI continues to permeate various aspects of technology and industry, frameworks like AvahiPlatform will play an essential role in facilitating this growth. Future work may involve further optimization, expanding feature sets, and exploring integrations with other cloud services to continue enhancing AI application development.
References
- Langchain GitHub Repository. [GitHub – langchain-ai/langchain: 🦜🔗 Build context-aware reasoning applications ](GitHub – langchain-ai/langchain: 🦜🔗 Build context-aware reasoning applications )
- Langchain AWS GitHub Repository. [GitHub – langchain-ai/langchain-aws: Build LangChain Applications on AWS ]
- Amazon Bedrock Documentation. [Build Generative AI Applications with Foundation Models – Amazon Bedrock – AWS ](Build Generative AI Applications with Foundation Models – Amazon Bedrock – AWS )
- AvahiPlatform GitHub Repository. [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! )
- 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 task of summarization.
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 boilerplate code and streamlining the operation.
Appendix B: Additional Features Usage
Image Generation with AvahiPlatform
import avahiplatform
image, seed, cost = avahiplatform.imageGeneration("A serene landscape with mountains")
print("Generated Image:", image)
Medical Scribing 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 feature-rich alternative to existing frameworks like Langchain.