Skip to content

Commit

Permalink
Update examples (#239)
Browse files Browse the repository at this point in the history
* Additional example updates -- remove configurable key (no longer
required)
* Use pydantic v1 compatibility layer correctly
  • Loading branch information
eyurtsev authored Nov 16, 2023
1 parent b53fa46 commit a01f547
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
5 changes: 1 addition & 4 deletions examples/configurable_chain/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@
)
chain = prompt | model | StrOutputParser()

# Add routes requires you to specify which config keys are accepted
# specifically, you must accept `configurable` as a config key.
add_routes(app, chain, path="/configurable_temp", config_keys=["configurable"])
add_routes(app, chain, path="/configurable_temp")


###############################################################################
Expand Down Expand Up @@ -96,7 +94,6 @@ def fetch_api_key_from_header(config: Dict[str, Any], req: Request) -> Dict[str,
app,
dynamic_auth_chain,
path="/auth_from_header",
config_keys=["configurable"],
per_req_config_modifier=fetch_api_key_from_header,
)

Expand Down
2 changes: 1 addition & 1 deletion examples/conversational_retrieval_chain/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
from langchain.schema.output_parser import StrOutputParser
from langchain.schema.runnable import RunnableMap, RunnablePassthrough
from langchain.vectorstores import FAISS
from pydantic.v1 import BaseModel, Field

from langserve import add_routes
from langserve.pydantic_v1 import BaseModel, Field

_TEMPLATE = """Given the following conversation and a follow up question, rephrase the
follow up question to be a standalone question, in its original language.
Expand Down

0 comments on commit a01f547

Please sign in to comment.