feat: async invoke #55
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
update multiple dependencies
openai = "^1.35.1" -> "^1.93.0"
langchain = { version = "^0.2.6", optional = true } -> { version = "^0.3.26", optional = true }
langchain-openai = { version = "^0.1.8", optional = true } -> { version = "^0.3.27", optional = true }
fastapi = { version = "^0.111.0", optional = true } -> { version = "^0.115.14", extras = ["standard"], optional = true }
langgraph = { version = "^0.2.16", optional = true } -> { version = "^0.5.0", optional = true }
langchain-anthropic = { version = "^0.1.19", optional = true } -> { version = "^0.3.16", optional = true }
langchain-groq = { version = "^0.1.6", optional = true } -> { version = "^0.3.4", optional = true }
langchain-llamacpp-chat-model = "^0.2.2" -> drop
llama-cpp-python = "^0.3.9" -> new
langchain-community = "^0.2.9" -> "^0.3.26"
langchain-experimental = "^0.0.62" -> "^0.3.4"
The code change in langgraph changes the code below.
The code change in openai changes the code below. But I don't know if this is the right way to do it.
https://github.com/caffeinism/langchain-openai-api-bridge/blob/patch-1/langchain_openai_api_bridge/assistant/adapter/openai_event_factory.py#L71
agent wrapped with async context manager
Similar idea to #48, but this implementation wraps all functions in an async context manager.
This can be used as before.
Like the idea in the previous PR, we also allow the following
Additionally, it allows the following code
This enables connection management by using methods from the context manager.
I've verified that anthropic, openai passes pytest except for groq, which I don't have a key for, and the additional behavior works in my use case, the bind_openai_chat_completion method.