Skip to main content

LangChainBridge

LangChainBridge is a unified wrapper library designed to simplify the use of various Large Language Model (LLM) providers such as Google, OpenAI, Ollama, and Anthropic. By using LangChainBridge, developers can interact with multiple LLMs through a single, consistent interface, reducing complexity and minimizing the risk of errors.

Features

  • Unified API: Interact with different LLM providers through a common interface.
  • Easy Integration: Quickly switch between LLM providers without changing your code logic.
  • Extensibility: Easily add support for new LLM providers as needed.

Installation

Install LangChainBridge using pip:

pip install langchainbridge

Supported Providers

  • Google Generative AI
  • OpenAI
  • Ollama
  • Anthropic

Usage

Initialize the Wrapper

You can initialize the wrapper by specifying the provider using the LLMProvider enum and providing the necessary API key and other parameters.

from langchainbridge.core import LLMWrapper
from langchainbridge.providers.provider_enum import LLMProvider

# For Google
google_llm = LLMWrapper(provider=LLMProvider.GOOGLE, api_key='YOUR_GOOGLE_API_KEY')
response = google_llm.invoke("Where was Shivaji Maharaj born?")
print(response)

# For OpenAI
openai_llm = LLMWrapper(provider=LLMProvider.OPENAI, api_key='YOUR_OPENAI_API_KEY', organization='YOUR_ORG_ID')
response = openai_llm.invoke("What NFL team won the Super Bowl in the year Justin Bieber was born?")
print(response)

# For Ollama
ollama_llm = LLMWrapper(provider=LLMProvider.OLLAMA)
response = ollama_llm.invoke("Summarize the text given to you.")
print(response)

# For Anthropic
anthropic_llm = LLMWrapper(provider=LLMProvider.ANTHROPIC, api_key='YOUR_ANTHROPIC_API_KEY')
response = anthropic_llm.invoke("Translate 'I love programming.' to French.")
print(response)

Metadata

Release files for langchainbridge 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for langchainbridge 1.0.1
File Size Uploaded
langchainbridge-1.0.1.tar.gz 5.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for langchainbridge 1.0.1
File Interpreter ABI Platform
langchainbridge-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 13.3 kB

Release files / langchainbridge-1.0.1.tar.gz

Download URL langchainbridge-1.0.1.tar.gz
Size 5.3 kB
Tags Source
SHA-256 checksum
How to use checksums
d52dee0368b333f272a7cbaf246efa5027fb1facf67580944cc19c8c6ba5724c
BLAKE2b-256 checksum
How to use checksums
8f95572d96d3e3cbbb81a6e2deebc5930ec98f996ccbdeaad01f459701c57f2b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.6

Release files / langchainbridge-1.0.1-py3-none-any.whl

Download URL langchainbridge-1.0.1-py3-none-any.whl
Size 8.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dcebab97c38f08ed41f234cf25de55b9ffb7615af847ed3ba2e7a9d179ea9674
BLAKE2b-256 checksum
How to use checksums
3237452510d15aa001b3ec822a835939b37801a4d3c1893ab0c9b1777f940ae4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.6

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0.0

2 release files

0.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page