Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename LLMonitor Callback Handler #14721

Closed
wants to merge 28 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
65efbac
Add lunary without breaking changes
hughcrt Dec 14, 2023
1ddcf86
Fix imports
hughcrt Dec 14, 2023
e70a629
Lint
hughcrt Dec 14, 2023
0d7f40d
Remove lunary import from main lib
hughcrt Dec 14, 2023
f8c6d59
Merge branch 'master' into llmonitor-to-lunary
hughcrt Dec 17, 2023
0936def
Ruff
hughcrt Dec 18, 2023
1f0cefc
format
hughcrt Dec 18, 2023
bcc7b50
Merge branch 'master' into llmonitor-to-lunary
hughcrt Dec 19, 2023
36194a7
Merge branch 'master' into llmonitor-to-lunary
hughcrt Dec 20, 2023
ac74c41
Update lunary.md
vincelwt Dec 22, 2023
ed7a1cc
Merge branch 'langchain-ai:master' into llmonitor-to-lunary
hughcrt Dec 26, 2023
5026e69
Import LunaryCallbackHandler directly from the `lunary` package
hughcrt Dec 26, 2023
a0d0601
Print message in case of import error
hughcrt Dec 26, 2023
a0d05c2
Put back original code for llmonitor
hughcrt Dec 27, 2023
6cc03c4
Update lock
hughcrt Dec 27, 2023
5ebd08d
Switch llmonitor handler with community one
hughcrt Dec 27, 2023
ec42287
format + lint
hughcrt Dec 27, 2023
7d24de3
Merge branch 'master' into llmonitor-to-lunary
hughcrt Dec 27, 2023
04ec864
Update libs/langchain/langchain/callbacks/llmonitor_callback.py
hughcrt Jan 2, 2024
54d0eb4
Update libs/langchain/langchain/callbacks/llmonitor_callback.py
hughcrt Jan 2, 2024
e6ffbd3
Merge branch 'master' into llmonitor-to-lunary
hughcrt Jan 2, 2024
f2b9b22
poetry lock
hughcrt Jan 2, 2024
d0cd86c
Merge branch 'master' into llmonitor-to-lunary
hughcrt Jan 2, 2024
434a161
test
hughcrt Jan 4, 2024
85588f9
remove llmonitor.md
hughcrt Jan 4, 2024
495ede2
Merge branch 'master' into llmonitor-to-lunary
hughcrt Jan 4, 2024
f19db20
Update lockfile
hughcrt Jan 4, 2024
0a63695
Merge branch 'master' into llmonitor-to-lunary
hughcrt Jan 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
7 changes: 0 additions & 7 deletions .github/workflows/_integration_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,13 @@ jobs:
shell: bash
run: poetry install --with test,test_integration

- name: 'Authenticate to Google Cloud'
id: 'auth'
uses: google-github-actions/auth@v2
with:
credentials_json: '${{ secrets.GOOGLE_CREDENTIALS }}'

- name: Run integration tests
shell: bash
env:
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
MISTRAL_API_KEY: ${{ secrets.MISTRAL_API_KEY }}
TOGETHER_API_KEY: ${{ secrets.TOGETHER_API_KEY }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
run: |
make integration_tests

Expand Down
9 changes: 1 addition & 8 deletions .github/workflows/_release.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: release
run-name: Release ${{ inputs.working-directory }} by @${{ github.actor }}

on:
workflow_call:
inputs:
Expand Down Expand Up @@ -149,20 +149,13 @@ jobs:
run: make tests
working-directory: ${{ inputs.working-directory }}

- name: 'Authenticate to Google Cloud'
id: 'auth'
uses: google-github-actions/auth@v2
with:
credentials_json: '${{ secrets.GOOGLE_CREDENTIALS }}'

- name: Run integration tests
if: ${{ startsWith(inputs.working-directory, 'libs/partners/') }}
env:
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
MISTRAL_API_KEY: ${{ secrets.MISTRAL_API_KEY }}
TOGETHER_API_KEY: ${{ secrets.TOGETHER_API_KEY }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
run: make integration_tests
working-directory: ${{ inputs.working-directory }}

Expand Down
4 changes: 2 additions & 2 deletions cookbook/LLaMA2_sql_chat.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@
],
"source": [
"# Prompt\n",
"from langchain_core.prompts import ChatPromptTemplate\n",
"from langchain.prompts import ChatPromptTemplate\n",
"\n",
"# Update the template based on the type of SQL Database like MySQL, Microsoft SQL Server and so on\n",
"template = \"\"\"Based on the table schema below, write a SQL query that would answer the user's question:\n",
Expand Down Expand Up @@ -278,7 +278,7 @@
"source": [
"# Prompt\n",
"from langchain.memory import ConversationBufferMemory\n",
"from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder\n",
"from langchain.prompts import ChatPromptTemplate, MessagesPlaceholder\n",
"\n",
"template = \"\"\"Given an input question, convert it to a SQL query. No pre-amble. Based on the table schema below, write a SQL query that would answer the user's question:\n",
"{schema}\n",
Expand Down
6 changes: 3 additions & 3 deletions cookbook/Multi_modal_RAG.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,9 @@
"metadata": {},
"outputs": [],
"source": [
"from langchain.prompts import ChatPromptTemplate\n",
"from langchain_community.chat_models import ChatOpenAI\n",
"from langchain_core.output_parsers import StrOutputParser\n",
"from langchain_core.prompts import ChatPromptTemplate\n",
"from langchain_openai import ChatOpenAI\n",
"\n",
"\n",
"# Generate summaries of text elements\n",
Expand Down Expand Up @@ -355,9 +355,9 @@
"\n",
"from langchain.retrievers.multi_vector import MultiVectorRetriever\n",
"from langchain.storage import InMemoryStore\n",
"from langchain_community.embeddings import OpenAIEmbeddings\n",
"from langchain_community.vectorstores import Chroma\n",
"from langchain_core.documents import Document\n",
"from langchain_openai import OpenAIEmbeddings\n",
"\n",
"\n",
"def create_multi_vector_retriever(\n",
Expand Down
8 changes: 4 additions & 4 deletions cookbook/Semi_Structured_RAG.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,9 @@
"metadata": {},
"outputs": [],
"source": [
"from langchain_core.output_parsers import StrOutputParser\n",
"from langchain_core.prompts import ChatPromptTemplate\n",
"from langchain_openai import ChatOpenAI"
"from langchain.prompts import ChatPromptTemplate\n",
"from langchain_community.chat_models import ChatOpenAI\n",
"from langchain_core.output_parsers import StrOutputParser"
]
},
{
Expand Down Expand Up @@ -320,9 +320,9 @@
"\n",
"from langchain.retrievers.multi_vector import MultiVectorRetriever\n",
"from langchain.storage import InMemoryStore\n",
"from langchain_community.embeddings import OpenAIEmbeddings\n",
"from langchain_community.vectorstores import Chroma\n",
"from langchain_core.documents import Document\n",
"from langchain_openai import OpenAIEmbeddings\n",
"\n",
"# The vectorstore to use to index the child chunks\n",
"vectorstore = Chroma(collection_name=\"summaries\", embedding_function=OpenAIEmbeddings())\n",
Expand Down
8 changes: 4 additions & 4 deletions cookbook/Semi_structured_and_multi_modal_RAG.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,9 @@
"metadata": {},
"outputs": [],
"source": [
"from langchain_core.output_parsers import StrOutputParser\n",
"from langchain_core.prompts import ChatPromptTemplate\n",
"from langchain_openai import ChatOpenAI"
"from langchain.prompts import ChatPromptTemplate\n",
"from langchain_community.chat_models import ChatOpenAI\n",
"from langchain_core.output_parsers import StrOutputParser"
]
},
{
Expand Down Expand Up @@ -375,9 +375,9 @@
"\n",
"from langchain.retrievers.multi_vector import MultiVectorRetriever\n",
"from langchain.storage import InMemoryStore\n",
"from langchain_community.embeddings import OpenAIEmbeddings\n",
"from langchain_community.vectorstores import Chroma\n",
"from langchain_core.documents import Document\n",
"from langchain_openai import OpenAIEmbeddings\n",
"\n",
"# The vectorstore to use to index the child chunks\n",
"vectorstore = Chroma(collection_name=\"summaries\", embedding_function=OpenAIEmbeddings())\n",
Expand Down
4 changes: 2 additions & 2 deletions cookbook/Semi_structured_multi_modal_RAG_LLaMA2.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,9 @@
"metadata": {},
"outputs": [],
"source": [
"from langchain.prompts import ChatPromptTemplate\n",
"from langchain_community.chat_models import ChatOllama\n",
"from langchain_core.output_parsers import StrOutputParser\n",
"from langchain_core.prompts import ChatPromptTemplate"
"from langchain_core.output_parsers import StrOutputParser"
]
},
{
Expand Down
6 changes: 3 additions & 3 deletions cookbook/advanced_rag_eval.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@
"metadata": {},
"outputs": [],
"source": [
"from langchain_community.embeddings import OpenAIEmbeddings\n",
"from langchain_community.vectorstores import Chroma\n",
"from langchain_openai import OpenAIEmbeddings\n",
"\n",
"baseline = Chroma.from_texts(\n",
" texts=all_splits_pypdf_texts,\n",
Expand All @@ -160,9 +160,9 @@
"metadata": {},
"outputs": [],
"source": [
"from langchain.prompts import ChatPromptTemplate\n",
"from langchain_community.chat_models import ChatOpenAI\n",
"from langchain_core.output_parsers import StrOutputParser\n",
"from langchain_core.prompts import ChatPromptTemplate\n",
"from langchain_openai import ChatOpenAI\n",
"\n",
"# Prompt\n",
"prompt_text = \"\"\"You are an assistant tasked with summarizing tables and text for retrieval. \\\n",
Expand Down
5 changes: 3 additions & 2 deletions cookbook/agent_vectorstore.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@
"source": [
"from langchain.chains import RetrievalQA\n",
"from langchain.text_splitter import CharacterTextSplitter\n",
"from langchain_community.embeddings.openai import OpenAIEmbeddings\n",
"from langchain_community.llms import OpenAI\n",
"from langchain_community.vectorstores import Chroma\n",
"from langchain_openai import OpenAI, OpenAIEmbeddings\n",
"\n",
"llm = OpenAI(temperature=0)"
]
Expand Down Expand Up @@ -160,7 +161,7 @@
"source": [
"# Import things that are needed generically\n",
"from langchain.agents import AgentType, Tool, initialize_agent\n",
"from langchain_openai import OpenAI"
"from langchain_community.llms import OpenAI"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion cookbook/analyze_document.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"outputs": [],
"source": [
"from langchain.chains import AnalyzeDocumentChain\n",
"from langchain_openai import ChatOpenAI\n",
"from langchain_community.chat_models import ChatOpenAI\n",
"\n",
"llm = ChatOpenAI(model=\"gpt-3.5-turbo\", temperature=0)"
]
Expand Down
8 changes: 4 additions & 4 deletions cookbook/autogpt/autogpt.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@
"outputs": [],
"source": [
"from langchain.docstore import InMemoryDocstore\n",
"from langchain_community.vectorstores import FAISS\n",
"from langchain_openai import OpenAIEmbeddings"
"from langchain_community.embeddings import OpenAIEmbeddings\n",
"from langchain_community.vectorstores import FAISS"
]
},
{
Expand Down Expand Up @@ -100,8 +100,8 @@
"metadata": {},
"outputs": [],
"source": [
"from langchain_experimental.autonomous_agents import AutoGPT\n",
"from langchain_openai import ChatOpenAI"
"from langchain_community.chat_models import ChatOpenAI\n",
"from langchain_experimental.autonomous_agents import AutoGPT"
]
},
{
Expand Down
4 changes: 2 additions & 2 deletions cookbook/autogpt/marathon_times.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
"import pandas as pd\n",
"from langchain.docstore.document import Document\n",
"from langchain_community.agent_toolkits.pandas.base import create_pandas_dataframe_agent\n",
"from langchain_community.chat_models import ChatOpenAI\n",
"from langchain_experimental.autonomous_agents import AutoGPT\n",
"from langchain_openai import ChatOpenAI\n",
"\n",
"# Needed synce jupyter runs an async eventloop\n",
"nest_asyncio.apply()"
Expand Down Expand Up @@ -311,8 +311,8 @@
"# Memory\n",
"import faiss\n",
"from langchain.docstore import InMemoryDocstore\n",
"from langchain_community.embeddings import OpenAIEmbeddings\n",
"from langchain_community.vectorstores import FAISS\n",
"from langchain_openai import OpenAIEmbeddings\n",
"\n",
"embeddings_model = OpenAIEmbeddings()\n",
"embedding_size = 1536\n",
Expand Down
5 changes: 3 additions & 2 deletions cookbook/baby_agi.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@
"source": [
"from typing import Optional\n",
"\n",
"from langchain_experimental.autonomous_agents import BabyAGI\n",
"from langchain_openai import OpenAI, OpenAIEmbeddings"
"from langchain_community.embeddings import OpenAIEmbeddings\n",
"from langchain_community.llms import OpenAI\n",
"from langchain_experimental.autonomous_agents import BabyAGI"
]
},
{
Expand Down
7 changes: 4 additions & 3 deletions cookbook/baby_agi_with_agent.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@
"\n",
"from langchain.chains import LLMChain\n",
"from langchain.prompts import PromptTemplate\n",
"from langchain_experimental.autonomous_agents import BabyAGI\n",
"from langchain_openai import OpenAI, OpenAIEmbeddings"
"from langchain_community.embeddings import OpenAIEmbeddings\n",
"from langchain_community.llms import OpenAI\n",
"from langchain_experimental.autonomous_agents import BabyAGI"
]
},
{
Expand Down Expand Up @@ -107,8 +108,8 @@
"source": [
"from langchain.agents import AgentExecutor, Tool, ZeroShotAgent\n",
"from langchain.chains import LLMChain\n",
"from langchain_community.llms import OpenAI\n",
"from langchain_community.utilities import SerpAPIWrapper\n",
"from langchain_openai import OpenAI\n",
"\n",
"todo_prompt = PromptTemplate.from_template(\n",
" \"You are a planner who is an expert at coming up with a todo list for a given objective. Come up with a todo list for this objective: {objective}\"\n",
Expand Down
2 changes: 1 addition & 1 deletion cookbook/camel_role_playing.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
" HumanMessage,\n",
" SystemMessage,\n",
")\n",
"from langchain_openai import ChatOpenAI"
"from langchain_community.chat_models import ChatOpenAI"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion cookbook/causal_program_aided_language_model.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@
"outputs": [],
"source": [
"from IPython.display import SVG\n",
"from langchain_community.llms import OpenAI\n",
"from langchain_experimental.cpal.base import CPALChain\n",
"from langchain_experimental.pal_chain import PALChain\n",
"from langchain_openai import OpenAI\n",
"\n",
"llm = OpenAI(temperature=0, max_tokens=512)\n",
"cpal_chain = CPALChain.from_univariate_prompt(llm=llm, verbose=True)\n",
Expand Down
4 changes: 2 additions & 2 deletions cookbook/code-analysis-deeplake.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@
}
],
"source": [
"from langchain_openai import OpenAIEmbeddings\n",
"from langchain_community.embeddings.openai import OpenAIEmbeddings\n",
"\n",
"embeddings = OpenAIEmbeddings()\n",
"embeddings"
Expand Down Expand Up @@ -834,7 +834,7 @@
"outputs": [],
"source": [
"from langchain.chains import ConversationalRetrievalChain\n",
"from langchain_openai import ChatOpenAI\n",
"from langchain_community.chat_models import ChatOpenAI\n",
"\n",
"model = ChatOpenAI(\n",
" model_name=\"gpt-3.5-turbo-0613\"\n",
Expand Down
8 changes: 4 additions & 4 deletions cookbook/custom_agent_with_plugin_retrieval.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
"from langchain.prompts import StringPromptTemplate\n",
"from langchain.schema import AgentAction, AgentFinish\n",
"from langchain_community.agent_toolkits import NLAToolkit\n",
"from langchain_community.tools.plugin import AIPlugin\n",
"from langchain_openai import OpenAI"
"from langchain_community.llms import OpenAI\n",
"from langchain_community.tools.plugin import AIPlugin"
]
},
{
Expand Down Expand Up @@ -115,8 +115,8 @@
"outputs": [],
"source": [
"from langchain.schema import Document\n",
"from langchain_community.vectorstores import FAISS\n",
"from langchain_openai import OpenAIEmbeddings"
"from langchain_community.embeddings import OpenAIEmbeddings\n",
"from langchain_community.vectorstores import FAISS"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@
"from langchain.prompts import StringPromptTemplate\n",
"from langchain.schema import AgentAction, AgentFinish\n",
"from langchain_community.agent_toolkits import NLAToolkit\n",
"from langchain_community.tools.plugin import AIPlugin\n",
"from langchain_openai import OpenAI"
"from langchain_community.llms import OpenAI\n",
"from langchain_community.tools.plugin import AIPlugin"
]
},
{
Expand Down Expand Up @@ -139,8 +139,8 @@
"outputs": [],
"source": [
"from langchain.schema import Document\n",
"from langchain_community.vectorstores import FAISS\n",
"from langchain_openai import OpenAIEmbeddings"
"from langchain_community.embeddings import OpenAIEmbeddings\n",
"from langchain_community.vectorstores import FAISS"
]
},
{
Expand Down
8 changes: 4 additions & 4 deletions cookbook/custom_agent_with_tool_retrieval.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
"from langchain.chains import LLMChain\n",
"from langchain.prompts import StringPromptTemplate\n",
"from langchain.schema import AgentAction, AgentFinish\n",
"from langchain_community.utilities import SerpAPIWrapper\n",
"from langchain_openai import OpenAI"
"from langchain_community.llms import OpenAI\n",
"from langchain_community.utilities import SerpAPIWrapper"
]
},
{
Expand Down Expand Up @@ -104,8 +104,8 @@
"outputs": [],
"source": [
"from langchain.schema import Document\n",
"from langchain_community.vectorstores import FAISS\n",
"from langchain_openai import OpenAIEmbeddings"
"from langchain_community.embeddings import OpenAIEmbeddings\n",
"from langchain_community.vectorstores import FAISS"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion cookbook/databricks_sql_db.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
"outputs": [],
"source": [
"# Creating a OpenAI Chat LLM wrapper\n",
"from langchain_openai import ChatOpenAI\n",
"from langchain_community.chat_models import ChatOpenAI\n",
"\n",
"llm = ChatOpenAI(temperature=0, model_name=\"gpt-4\")"
]
Expand Down
Loading
Loading