Skip to content

Commit

Permalink
Fix race conditions of defaults and schemas (#251)
Browse files Browse the repository at this point in the history
Closes #143
  • Loading branch information
dqbd authored Nov 21, 2023
1 parent d4e7f36 commit abba59e
Show file tree
Hide file tree
Showing 18 changed files with 849 additions and 762 deletions.
23 changes: 22 additions & 1 deletion examples/configurable_chain/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,28 @@


###############################################################################
# EXAMPLE 2: Configure fields based on Request metadata #
# EXAMPLE 2: Configure prompt based on RunnableConfig #
###############################################################################
configurable_prompt = PromptTemplate.from_template(
"tell me a joke about {topic}."
).configurable_alternatives(
ConfigurableField(
id="prompt",
name="Prompt",
description="The prompt to use. Must contain {topic}.",
),
default_key="joke",
fact=PromptTemplate.from_template(
"tell me a fact about {topic} in {language} language."
),
)
prompt_chain = configurable_prompt | model | StrOutputParser()

add_routes(app, prompt_chain, path="/configurable_prompt")


###############################################################################
# EXAMPLE 3: Configure fields based on Request metadata #
###############################################################################


Expand Down
247 changes: 0 additions & 247 deletions langserve/playground/dist/assets/index-32c8d712.js

This file was deleted.

255 changes: 255 additions & 0 deletions langserve/playground/dist/assets/index-849f2582.js

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions langserve/playground/dist/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<link rel="icon" href="/____LANGSERVE_BASE_URL/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Playground</title>
<script type="module" crossorigin src="/____LANGSERVE_BASE_URL/assets/index-32c8d712.js"></script>
<link rel="stylesheet" href="/____LANGSERVE_BASE_URL/assets/index-c6cde0dd.css">
<script type="module" crossorigin src="/____LANGSERVE_BASE_URL/assets/index-849f2582.js"></script>
<link rel="stylesheet" href="/____LANGSERVE_BASE_URL/assets/index-8968db79.css">
</head>
<body>
<div id="root"></div>
Expand Down
1 change: 1 addition & 0 deletions langserve/playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"lz-string": "^1.5.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"swr": "^2.2.4",
"tailwind-merge": "^1.14.0",
"use-debounce": "^9.0.4",
"vaul": "^0.7.3"
Expand Down
Loading

0 comments on commit abba59e

Please sign in to comment.