Skip to content

Commit

Permalink
Merge pull request #81 from PrefectHQ/langchain
Browse files Browse the repository at this point in the history
Add langchain backend
  • Loading branch information
jlowin authored Jun 6, 2024
2 parents a66e4c0 + ee3d6a9 commit 404c22c
Show file tree
Hide file tree
Showing 21 changed files with 676 additions and 949 deletions.
9 changes: 4 additions & 5 deletions examples/multi_agent_conversation.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,15 @@


@flow
def demo():
topic = "milk and cereal"
def demo(topic: str):
task = Task(
"Discuss a topic",
agents=[jerry, george, elaine, kramer, newman],
context=dict(topic=topic),
instructions="every agent should speak at least once",
instructions="every agent should speak at least once. only one agent per turn.",
)
task.run()
return task


if __name__ == "__main__":
demo()
demo(topic="sandwiches")
19 changes: 11 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ authors = [
]
dependencies = [
"prefect>=3.0rc1",
"textual>=0.61.1",
"litellm>=1.37.17",
"jinja2>=3.1.4",
"langchain_core>=0.2.4",
"langchain_openai>=0.1.8",
"pydantic-settings>=2.2.1",
"textual>=0.61.1",
"tiktoken>=0.7.0",
]
readme = "README.md"
Expand Down Expand Up @@ -47,10 +48,16 @@ tests = [
"pytest>=7.0",
"pytest-timeout",
"pytest-xdist",
"pre-commit>=3.7.0",
"pandas",
]
dev = ["controlflow[tests]", "ipython", "pdbpp", "ruff>=0.3.4", "textual-dev"]
dev = [
"controlflow[tests]",
"ipython",
"pdbpp",
"pre-commit",
"ruff>=0.3.4",
"textual-dev",
]

[build-system]
requires = ["hatchling"]
Expand Down Expand Up @@ -84,7 +91,3 @@ skip-magic-trailing-comma = false
[tool.pytest.ini_options]
timeout = 120
asyncio_mode = "auto"
filterwarnings = [
"ignore::DeprecationWarning:litellm.*",
"ignore::PendingDeprecationWarning:litellm.*",
]
58 changes: 19 additions & 39 deletions requirements-dev.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@
# with-sources: false

-e file:.
aiohttp==3.9.5
# via litellm
aiosignal==1.3.1
# via aiohttp
aiosqlite==0.20.0
# via prefect
alembic==1.13.1
Expand All @@ -31,7 +27,6 @@ asgi-lifespan==2.1.0
asyncpg==0.29.0
# via prefect
attrs==23.2.0
# via aiohttp
# via jsonschema
# via referencing
cachetools==5.3.3
Expand All @@ -49,7 +44,6 @@ charset-normalizer==3.3.2
# via requests
click==8.1.7
# via apprise
# via litellm
# via prefect
# via typer
# via uvicorn
Expand Down Expand Up @@ -77,13 +71,7 @@ fastapi==0.111.0
# via prefect
fastapi-cli==0.0.4
# via fastapi
filelock==3.13.3
# via huggingface-hub
frozenlist==1.4.1
# via aiohttp
# via aiosignal
fsspec==2024.3.1
# via huggingface-hub
# via prefect
google-auth==2.29.0
# via kubernetes
Expand All @@ -109,8 +97,6 @@ httpx==0.27.0
# via fastapi
# via openai
# via prefect
huggingface-hub==0.23.0
# via tokenizers
humanize==4.9.0
# via jinja2-humanize-extension
# via prefect
Expand All @@ -121,20 +107,17 @@ idna==3.6
# via email-validator
# via httpx
# via requests
# via yarl
importlib-metadata==7.0.0
# via litellm
importlib-resources==6.1.3
# via prefect
jinja2==3.1.4
# via controlflow
# via fastapi
# via jinja2-humanize-extension
# via litellm
# via prefect
jinja2-humanize-extension==0.4.0
# via prefect
jsonpatch==1.33
# via langchain-core
# via prefect
jsonpointer==2.4
# via jsonpatch
Expand All @@ -144,10 +127,15 @@ jsonschema-specifications==2023.12.1
# via jsonschema
kubernetes==29.0.0
# via prefect
langchain-core==0.2.4
# via controlflow
# via langchain-openai
langchain-openai==0.1.8
# via controlflow
langsmith==0.1.74
# via langchain-core
linkify-it-py==2.0.3
# via markdown-it-py
litellm==1.37.17
# via controlflow
mako==1.3.2
# via alembic
markdown==3.6
Expand All @@ -163,20 +151,18 @@ mdit-py-plugins==0.4.1
# via markdown-it-py
mdurl==0.1.2
# via markdown-it-py
multidict==6.0.5
# via aiohttp
# via yarl
oauthlib==3.2.2
# via kubernetes
# via requests-oauthlib
openai==1.28.1
# via litellm
# via langchain-openai
orjson==3.10.0
# via fastapi
# via langsmith
# via prefect
packaging==24.0
packaging==23.2
# via docker
# via huggingface-hub
# via langchain-core
# via prefect
pathspec==0.12.1
# via prefect
Expand All @@ -193,6 +179,8 @@ pycparser==2.22
# via cffi
pydantic==2.7.2
# via fastapi
# via langchain-core
# via langsmith
# via openai
# via prefect
# via pydantic-extra-types
Expand All @@ -215,7 +203,6 @@ python-dateutil==2.9.0.post0
# via prefect
# via time-machine
python-dotenv==1.0.1
# via litellm
# via pydantic-settings
# via uvicorn
python-multipart==0.0.9
Expand All @@ -228,8 +215,8 @@ pytz==2024.1
# via prefect
pyyaml==6.0.1
# via apprise
# via huggingface-hub
# via kubernetes
# via langchain-core
# via prefect
# via uvicorn
readchar==4.0.6
Expand All @@ -243,9 +230,8 @@ regex==2023.12.25
requests==2.31.0
# via apprise
# via docker
# via huggingface-hub
# via kubernetes
# via litellm
# via langsmith
# via requests-oauthlib
# via tiktoken
requests-oauthlib==2.0.0
Expand Down Expand Up @@ -285,21 +271,20 @@ sqlalchemy==2.0.29
# via prefect
starlette==0.37.2
# via fastapi
tenacity==8.3.0
# via langchain-core
text-unidecode==1.3
# via python-slugify
textual==0.61.1
# via controlflow
tiktoken==0.7.0
# via controlflow
# via litellm
# via langchain-openai
time-machine==2.14.1
# via pendulum
tokenizers==0.19.1
# via litellm
toml==0.10.2
# via prefect
tqdm==4.66.2
# via huggingface-hub
# via openai
typer==0.12.3
# via fastapi-cli
Expand All @@ -308,7 +293,6 @@ typing-extensions==4.10.0
# via aiosqlite
# via alembic
# via fastapi
# via huggingface-hub
# via openai
# via prefect
# via pydantic
Expand Down Expand Up @@ -342,7 +326,3 @@ websocket-client==1.7.0
websockets==12.0
# via prefect
# via uvicorn
yarl==1.9.4
# via aiohttp
zipp==3.18.1
# via importlib-metadata
Loading

0 comments on commit 404c22c

Please sign in to comment.