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

Dev #5

Merged
merged 39 commits into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
3db9f6b
Update .clabot (#558)
eyurtsev Mar 26, 2024
4e1993c
doc: link server example to server.py instead of client.ipynb (#553)
WarrenTheRabbit Mar 26, 2024
31004e9
Update splashscreen (#563)
eyurtsev Mar 27, 2024
d1863fd
Transition to langchain-core ^0.1 (#564)
eyurtsev Mar 28, 2024
5a629af
[minor][doc] Updates setup instruction for LangServe app (#549)
rahilvora Mar 28, 2024
f518776
Only surface callback events in response schema if callbacks are enab…
eyurtsev Mar 28, 2024
04b9c95
Scoped Feedback: Plumb through scoped feedback (#568)
eyurtsev Mar 28, 2024
5d7e119
langserve: Create token feedback endpoint, update schema for feedback…
eyurtsev Mar 29, 2024
e554f6c
Expose Feedback Tokens as part of add_routes and APIHandler (#571)
eyurtsev Mar 29, 2024
daa312c
Allow accepting run ids by the server (#576)
eyurtsev Mar 29, 2024
7240d31
Tests: add token_feedback endpoint to test that verifies enabled/disa…
eyurtsev Mar 29, 2024
00e637a
Improve error message if user isn't passing a Runnable to add_routes …
eyurtsev Mar 31, 2024
e591ccc
Add tests to check playground is served with api router configuration…
eyurtsev Apr 1, 2024
2c7fcef
Update .clabot (#582)
eyurtsev Apr 1, 2024
014acfc
LangServe: Raise invalid request exceptions (#581)
eyurtsev Apr 1, 2024
1765f63
0.1.0 RC1 (#584)
eyurtsev Apr 1, 2024
8439937
Fixes associated with feedback endpoint (#593)
eyurtsev Apr 3, 2024
fbdb5a4
0.1.0rc2 release (#594)
eyurtsev Apr 3, 2024
ee9b4e7
Release 0.1.0 (#608)
eyurtsev Apr 15, 2024
109445b
Changes to readme (#614)
nfcampos Apr 22, 2024
153616b
patch: fix feedback in astream log and astream events (#620)
eyurtsev Apr 25, 2024
5fe83e3
Release 0.1.1 (#621)
eyurtsev Apr 25, 2024
08d4bdd
Migrate to locations of imports (#625)
eyurtsev Apr 29, 2024
075bdd0
Update to allow core 0.2.0 (#644)
eyurtsev May 15, 2024
37f41e5
0.2.0rc1 (#645)
eyurtsev May 15, 2024
21bf92f
fix upper version for core to 0.3 instead of 3 (#646)
eyurtsev May 15, 2024
ee250d2
update poetry.lock file after version bump (#647)
eyurtsev May 15, 2024
bba7122
Release 0.2.0 (#651)
eyurtsev May 17, 2024
4be04bd
Update .clabot (#656)
eyurtsev May 21, 2024
bb74431
set default model for Anthropic (#655)
ccurme May 21, 2024
81a633e
patch: Use correct attribute for token url (#662)
eyurtsev May 24, 2024
6ef3aca
release 0.2.1 (#663)
eyurtsev May 24, 2024
1b389f0
Update hosted langserve waitlist form (#664)
jakerachleff May 24, 2024
577dcc7
Update .clabot (#674)
eyurtsev Jun 10, 2024
df3aa45
chore: add fastapi to client extra (#666)
dennisrall Jun 10, 2024
3fc76ec
0.2.2 release (#675)
eyurtsev Jun 10, 2024
050a0cc
update readme (#697)
ccurme Jun 28, 2024
a13ca4f
Merge remote-tracking branch 'upstream/main' into release-merge
labdmitriy Jul 1, 2024
b7e8622
Merge pull request #4 from ai-forever/release-merge
Rai220 Jul 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .clabot
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"contributors": ["eyurtsev", "hwchase17", "nfcampos", "efriis", "jacoblee93", "dqbd", "kreneskyp", "adarsh-jha-dev", "harris", "baskaryan", "hinthornw", "bracesproul", "jakerachleff", "craigsdennis", "anhi", "169", "LarchLiu", "PaulLockett", "RCMatthias", "jwynia", "majiayu000", "mpskex", "shivachittamuru", "sinashaloudegi", "sowsan", "akira", "lucianotonet", "JGalego", "nat-n", "dirien", "donbr"],
"contributors": ["eyurtsev", "hwchase17", "nfcampos", "efriis", "jacoblee93", "dqbd", "kreneskyp", "adarsh-jha-dev", "harris", "baskaryan", "hinthornw", "bracesproul", "jakerachleff", "craigsdennis", "anhi", "169", "LarchLiu", "PaulLockett", "RCMatthias", "jwynia", "majiayu000", "mpskex", "shivachittamuru", "sinashaloudegi", "sowsan", "akira", "lucianotonet", "JGalego", "nat-n", "dirien", "donbr", "rahilvora", "WarrenTheRabbit", "StreetLamb", "ccurme", "dennisrall"],
"message": "Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have the username {{usersWithoutCLA}} on file. In order for us to review and merge your code, please complete the Individual Contributor License Agreement here https://forms.gle/AQFbtkWRoHXUgipM6 .\n\nThis process is done manually on our side, so after signing the form one of the maintainers will add you to the contributors list.\n\nFor more details about why we have a CLA and other contribution guidelines please see: https://github.com/langchain-ai/langserve/blob/main/CONTRIBUTING.md."
}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ add_routes(

add_routes(
app,
ChatAnthropic(),
ChatAnthropic(model="claude-3-haiku-20240307"),
path="/anthropic",
)

Expand Down Expand Up @@ -171,7 +171,7 @@ chain.batch([{ "topic": "попугаи" }, { "topic": "кошки" }])
import { RemoteRunnable } from "@langchain/core/runnables/remote";

const chain = new RemoteRunnable({
url: `http://localhost:8000/joke/`,
url: `http://localhost:8000/joke/`,
});
const result = await chain.invoke({
topic: "кошки",
Expand Down
12 changes: 6 additions & 6 deletions examples/agent/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@
from typing import Any

from fastapi import FastAPI
from langchain.agents import AgentExecutor, tool
from langchain.agents import AgentExecutor
from langchain.agents.format_scratchpad import format_to_openai_functions
from langchain.agents.output_parsers import OpenAIFunctionsAgentOutputParser
from langchain.chat_models import ChatOpenAI
from langchain.embeddings import OpenAIEmbeddings
from langchain.prompts import ChatPromptTemplate, MessagesPlaceholder
from langchain.pydantic_v1 import BaseModel
from langchain.tools.render import format_tool_to_openai_function
from langchain.vectorstores import FAISS
from langchain_community.vectorstores import FAISS
from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder
from langchain_core.tools import tool
from langchain_core.utils.function_calling import format_tool_to_openai_function
from langchain_openai import ChatOpenAI, OpenAIEmbeddings

from langserve import add_routes

Expand Down
8 changes: 4 additions & 4 deletions examples/agent_custom_streaming/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@
from typing import Any, AsyncIterator, List, Literal

from fastapi import FastAPI
from langchain.agents import AgentExecutor, tool
from langchain.agents import AgentExecutor
from langchain.agents.format_scratchpad.openai_tools import (
format_to_openai_tool_messages,
)
from langchain.agents.output_parsers.openai_tools import OpenAIToolsAgentOutputParser
from langchain.prompts import MessagesPlaceholder
from langchain_community.tools.convert_to_openai import format_tool_to_openai_tool
from langchain_core.prompts import ChatPromptTemplate
from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder
from langchain_core.runnables import RunnableLambda
from langchain_core.tools import tool
from langchain_core.utils.function_calling import format_tool_to_openai_tool
from langchain_openai import ChatOpenAI

from langserve import add_routes
Expand Down
8 changes: 4 additions & 4 deletions examples/agent_with_history/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@
from typing import Any, List, Union

from fastapi import FastAPI
from langchain.agents import AgentExecutor, tool
from langchain.agents import AgentExecutor
from langchain.agents.format_scratchpad.openai_tools import (
format_to_openai_tool_messages,
)
from langchain.agents.output_parsers.openai_tools import OpenAIToolsAgentOutputParser
from langchain.prompts import MessagesPlaceholder
from langchain_community.tools.convert_to_openai import format_tool_to_openai_tool
from langchain_core.messages import AIMessage, FunctionMessage, HumanMessage
from langchain_core.prompts import ChatPromptTemplate
from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder
from langchain_core.tools import tool
from langchain_core.utils.function_calling import format_tool_to_openai_tool
from langchain_openai import ChatOpenAI

from langserve import add_routes
Expand Down
2 changes: 1 addition & 1 deletion examples/auth/api_handler/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@

from fastapi import Depends, FastAPI, HTTPException, Request, Response, status
from fastapi.security import OAuth2PasswordBearer, OAuth2PasswordRequestForm
from langchain_community.embeddings.openai import OpenAIEmbeddings
from langchain_community.vectorstores.chroma import Chroma
from langchain_core.documents import Document
from langchain_core.runnables import (
Expand All @@ -44,6 +43,7 @@
RunnableSerializable,
)
from langchain_core.vectorstores import VectorStore
from langchain_openai import OpenAIEmbeddings
from typing_extensions import Annotated

from langserve import APIHandler
Expand Down
2 changes: 1 addition & 1 deletion examples/auth/per_req_config_modifier/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@

from fastapi import Depends, FastAPI, HTTPException, Request, status
from fastapi.security import OAuth2PasswordBearer, OAuth2PasswordRequestForm
from langchain_community.embeddings.openai import OpenAIEmbeddings
from langchain_community.vectorstores.chroma import Chroma
from langchain_core.documents import Document
from langchain_core.runnables import (
Expand All @@ -45,6 +44,7 @@
RunnableSerializable,
)
from langchain_core.vectorstores import VectorStore
from langchain_openai import OpenAIEmbeddings
from typing_extensions import Annotated

from langserve import add_routes
Expand Down
2 changes: 1 addition & 1 deletion examples/chat_playground/legacy_input/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from typing import List, Union

from fastapi import FastAPI
from langchain.chat_models import ChatAnthropic
from langchain_anthropic import ChatAnthropic
from langchain_core.messages import AIMessage, HumanMessage, SystemMessage
from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder

Expand Down
4 changes: 2 additions & 2 deletions examples/chat_with_persistence/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
from typing import Callable, Union

from fastapi import FastAPI, HTTPException
from langchain.chat_models import ChatAnthropic
from langchain.memory import FileChatMessageHistory
from langchain_anthropic import ChatAnthropic
from langchain_community.chat_message_histories import FileChatMessageHistory
from langchain_core.chat_history import BaseChatMessageHistory
from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder
from langchain_core.runnables.history import RunnableWithMessageHistory
Expand Down
6 changes: 3 additions & 3 deletions examples/chat_with_persistence_and_user/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
from typing import Any, Callable, Dict, Union

from fastapi import FastAPI, HTTPException, Request
from langchain.chat_models import ChatOpenAI
from langchain.memory import FileChatMessageHistory
from langchain.schema.runnable.utils import ConfigurableFieldSpec
from langchain_community.chat_message_histories import FileChatMessageHistory
from langchain_core import __version__
from langchain_core.chat_history import BaseChatMessageHistory
from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder
from langchain_core.runnables import ConfigurableFieldSpec
from langchain_core.runnables.history import RunnableWithMessageHistory
from langchain_openai import ChatOpenAI
from typing_extensions import TypedDict

from langserve import add_routes
Expand Down
12 changes: 6 additions & 6 deletions examples/configurable_agent_executor/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,22 @@
from typing import Any, AsyncIterator, Dict, List, Optional, cast

from fastapi import FastAPI
from langchain.agents import AgentExecutor, tool
from langchain.agents import AgentExecutor
from langchain.agents.format_scratchpad import format_to_openai_functions
from langchain.agents.output_parsers import OpenAIFunctionsAgentOutputParser
from langchain.chat_models import ChatOpenAI
from langchain.embeddings import OpenAIEmbeddings
from langchain.prompts import ChatPromptTemplate, MessagesPlaceholder
from langchain.pydantic_v1 import BaseModel
from langchain.tools.render import format_tool_to_openai_function
from langchain.vectorstores import FAISS
from langchain_community.vectorstores import FAISS
from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder
from langchain_core.runnables import (
ConfigurableField,
ConfigurableFieldSpec,
Runnable,
RunnableConfig,
)
from langchain_core.runnables.utils import Input, Output
from langchain_core.tools import tool
from langchain_core.utils.function_calling import format_tool_to_openai_function
from langchain_openai import ChatOpenAI, OpenAIEmbeddings

from langserve import add_routes

Expand Down
8 changes: 4 additions & 4 deletions examples/configurable_chain/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@

from fastapi import FastAPI, HTTPException, Request
from fastapi.middleware.cors import CORSMiddleware
from langchain.chat_models import ChatOpenAI
from langchain.prompts import PromptTemplate
from langchain.schema.output_parser import StrOutputParser
from langchain.schema.runnable import ConfigurableField
from langchain_core.output_parsers import StrOutputParser
from langchain_core.prompts import PromptTemplate
from langchain_core.runnables import ConfigurableField
from langchain_openai import ChatOpenAI

from langserve import add_routes

Expand Down
15 changes: 8 additions & 7 deletions examples/configurable_retrieval/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,18 @@
from typing import Any, Iterable, List, Optional, Type

from fastapi import FastAPI
from langchain.embeddings import OpenAIEmbeddings
from langchain.schema import Document
from langchain.schema.embeddings import Embeddings
from langchain.schema.retriever import BaseRetriever
from langchain.schema.runnable import (
from langchain.schema.vectorstore import VST
from langchain_community.vectorstores import FAISS
from langchain_core.documents import Document
from langchain_core.embeddings import Embeddings
from langchain_core.retrievers import BaseRetriever
from langchain_core.runnables import (
ConfigurableFieldSingleOption,
RunnableConfig,
RunnableSerializable,
)
from langchain.schema.vectorstore import VST
from langchain.vectorstores import FAISS, VectorStore
from langchain_core.vectorstores import VectorStore
from langchain_openai import OpenAIEmbeddings

from langserve import add_routes
from langserve.pydantic_v1 import BaseModel, Field
Expand Down
13 changes: 5 additions & 8 deletions examples/conversational_retrieval_chain/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,11 @@
from typing import List, Tuple

from fastapi import FastAPI
from langchain.chat_models import ChatOpenAI
from langchain.embeddings import OpenAIEmbeddings
from langchain.prompts import ChatPromptTemplate
from langchain.prompts.prompt import PromptTemplate
from langchain.schema import format_document
from langchain.schema.output_parser import StrOutputParser
from langchain.schema.runnable import RunnableMap, RunnablePassthrough
from langchain.vectorstores import FAISS
from langchain_community.vectorstores import FAISS
from langchain_core.output_parsers import StrOutputParser
from langchain_core.prompts import ChatPromptTemplate, PromptTemplate, format_document
from langchain_core.runnables import RunnableMap, RunnablePassthrough
from langchain_openai import ChatOpenAI, OpenAIEmbeddings

from langserve import add_routes
from langserve.pydantic_v1 import BaseModel, Field
Expand Down
6 changes: 3 additions & 3 deletions examples/file_processing/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
import base64

from fastapi import FastAPI
from langchain.document_loaders.blob_loaders import Blob
from langchain.document_loaders.parsers.pdf import PDFMinerParser
from langchain.pydantic_v1 import Field
from langchain.schema.runnable import RunnableLambda
from langchain_community.document_loaders.parsers.pdf import PDFMinerParser
from langchain_core.document_loaders import Blob
from langchain_core.runnables import RunnableLambda

from langserve import CustomUserType, add_routes

Expand Down
7 changes: 4 additions & 3 deletions examples/llm/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"""Example LangChain server exposes multiple runnables (LLMs in this case)."""

from fastapi import FastAPI
from langchain.chat_models import ChatAnthropic, ChatOpenAI
from langchain_anthropic import ChatAnthropic
from langchain_openai import ChatOpenAI

from langserve import add_routes

Expand All @@ -14,12 +15,12 @@

add_routes(
app,
ChatOpenAI(),
ChatOpenAI(model="gpt-3.5-turbo-0125"),
path="/openai",
)
add_routes(
app,
ChatAnthropic(),
ChatAnthropic(model="claude-3-haiku-20240307"),
path="/anthropic",
)

Expand Down
8 changes: 4 additions & 4 deletions examples/passthrough_dict/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
from typing import Any, Callable, Dict, List, Optional, TypedDict

from fastapi import FastAPI
from langchain.chat_models import ChatOpenAI
from langchain.prompts import ChatPromptTemplate
from langchain.schema.runnable import RunnableMap, RunnablePassthrough
from langchain_core.prompts import ChatPromptTemplate
from langchain_core.runnables import RunnableParallel, RunnablePassthrough
from langchain_openai import ChatOpenAI

from langserve import add_routes

Expand Down Expand Up @@ -43,7 +43,7 @@ def _project_dict(

underlying_chain = prompt | model

wrapped_chain = RunnableMap(
wrapped_chain = RunnableParallel(
{
"output": _create_projection(exclude_keys=["info"]) | underlying_chain,
"info": _create_projection(include_keys=["info"]),
Expand Down
4 changes: 2 additions & 2 deletions examples/retrieval/server.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env python
"""Example LangChain server exposes a retriever."""
from fastapi import FastAPI
from langchain.embeddings import OpenAIEmbeddings
from langchain.vectorstores import FAISS
from langchain_community.vectorstores import FAISS
from langchain_openai import OpenAIEmbeddings

from langserve import add_routes

Expand Down
7 changes: 4 additions & 3 deletions examples/router/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
https://fastapi.tiangolo.com/tutorial/bigger-applications/
"""
from fastapi import APIRouter, FastAPI
from langchain.chat_models import ChatAnthropic, ChatOpenAI
from langchain_anthropic import ChatAnthropic
from langchain_openai import ChatOpenAI

from langserve import add_routes

Expand All @@ -20,13 +21,13 @@
# Invocations to this router will appear in trace logs as /models/openai
add_routes(
router,
ChatOpenAI(),
ChatOpenAI(model="gpt-3.5-turbo-0125"),
path="/openai",
)
# Invocations to this router will appear in trace logs as /models/anthropic
add_routes(
router,
ChatAnthropic(),
ChatAnthropic(model="claude-3-haiku-20240307"),
path="/anthropic",
)

Expand Down
2 changes: 1 addition & 1 deletion examples/widgets/chat/message_list/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from langchain.chat_models import ChatAnthropic
from langchain_anthropic import ChatAnthropic
from langchain_core.messages import AIMessage, HumanMessage, SystemMessage
from langchain_core.output_parsers import StrOutputParser
from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder
Expand Down
11 changes: 5 additions & 6 deletions examples/widgets/chat/tuples/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,17 @@

from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from langchain.chat_models.openai import ChatOpenAI
from langchain.document_loaders.blob_loaders import Blob
from langchain.document_loaders.parsers.pdf import PDFMinerParser
from langchain.pydantic_v1 import BaseModel, Field
from langchain.schema.messages import (
from langchain_community.document_loaders.parsers.pdf import PDFMinerParser
from langchain_core.document_loaders import Blob
from langchain_core.messages import (
AIMessage,
BaseMessage,
FunctionMessage,
HumanMessage,
)
from langchain.schema.runnable import RunnableLambda
from langchain_core.runnables import RunnableParallel
from langchain_core.runnables import RunnableLambda, RunnableParallel
from langchain_openai import ChatOpenAI

from langserve import CustomUserType
from langserve.server import add_routes
Expand Down
Loading
Loading