Skip to content

Same agent Smaller bill. The tools and infrastructure to get more work from your AI. Fewer tokens. Less compute. Lower cost.

[Feat]: Support for langchain_community.chat_models (#390)

patcher94e3cf4a5a765
diff --git a/sdk/python/pyproject.toml b/sdk/python/pyproject.toml
index 172ad053..8819a15c 100644
--- a/sdk/python/pyproject.toml
+++ b/sdk/python/pyproject.toml
@@ -1,6 +1,6 @@
[tool.poetry]
name = "openlit"
-version = "1.18.2"
+version = "1.19.0"
description = "OpenTelemetry-native Auto instrumentation library for monitoring LLM Applications and GPUs, facilitating the integration of observability into your GenAI-driven projects"
authors = ["OpenLIT"]
repository = "https://github.com/openlit/openlit/tree/main/openlit/python"
diff --git a/sdk/python/src/openlit/instrumentation/langchain/__init__.py b/sdk/python/src/openlit/instrumentation/langchain/__init__.py
index 2d5037a1..00449f3a 100644
--- a/sdk/python/src/openlit/instrumentation/langchain/__init__.py
+++ b/sdk/python/src/openlit/instrumentation/langchain/__init__.py
@@ -6,10 +6,10 @@ from opentelemetry.instrumentation.instrumentor import BaseInstrumentor
from wrapt import wrap_function_wrapper
from openlit.instrumentation.langchain.langchain import (
- general_wrap,
- hub,
- llm,
- allm,
+ general_wrap,
+ hub,
+ llm,
+ allm,
chat,
achat
)
diff --git a/sdk/python/src/openlit/instrumentation/langchain/langchain.py b/sdk/python/src/openlit/instrumentation/langchain/langchain.py
index d9613288..da993fdb 100644
--- a/sdk/python/src/openlit/instrumentation/langchain/langchain.py
+++ b/sdk/python/src/openlit/instrumentation/langchain/langchain.py
@@ -1,4 +1,4 @@
-# pylint: disable=duplicate-code, broad-exception-caught, too-many-statements, unused-argument
+# pylint: disable=duplicate-code, broad-exception-caught, too-many-statements, unused-argument, unused-import
"""
Module for monitoring Langchain applications.
"""
@@ -709,4 +709,4 @@ def achat(gen_ai_endpoint, version, environment, application_name,
# Return original response
return response
- return wrapper
\ No newline at end of file
+ return wrapper
diff --git a/sdk/python/tests/test_langchain.py.hold b/sdk/python/tests/test_langchain.py
similarity index 94%
rename from sdk/python/tests/test_langchain.py.hold
rename to sdk/python/tests/test_langchain.py
index bc0bb7cc..337a2fff 100644
--- a/sdk/python/tests/test_langchain.py.hold
+++ b/sdk/python/tests/test_langchain.py
@@ -12,7 +12,6 @@ prior to running these tests.
import os
import bs4
-from langchain import hub
from langchain_community.document_loaders import WebBaseLoader
from langchain_text_splitters import RecursiveCharacterTextSplitter
import openlit
@@ -56,6 +55,3 @@ def test_langchain():
texts = RecursiveCharacterTextSplitter(chunk_size=1000, chunk_overlap=200)
splits = texts.split_documents(docs)
assert splits[0].metadata["source"] == "https://lilianweng.github.io/posts/2023-06-23-agent/"
-
- prompt = hub.pull("rlm/rag-prompt")
- assert prompt.metadata["lc_hub_repo"] == "rag-prompt"