No project description provided
Project description
Langchain extensions
Binding Pocket Tools
from langchain_openai import ChatOpenAI
from hyperpocket.config.settings import settings
from hyperpocket_langchain import PocketLangchain
pocket = PocketLangchain(tools=[
"https://github.com/vessl-ai/hyperpocket/tree/main/tools/slack/get-messages",
"https://github.com/vessl-ai/hyperpocket/tree/main/tools/slack/post-message",
])
# get langchain compatible tools from pocket
tools = pocket.get_tools()
llm = ChatOpenAI(
model="gpt-4o",
api_key=settings["OPENAI_API_KEY"]
)
# bind tool with llm
llm_with_tools = llm.bind_tools(tools)
Agent Examples
from langchain.agents import create_tool_calling_agent, AgentExecutor
from langchain.memory import ConversationBufferMemory
from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder
from langchain_openai import ChatOpenAI
from hyperpocket_langchain import PocketLangchain
pocket = PocketLangchain(tools=[
"https://github.com/vessl-ai/hyperpocket/tree/main/tools/slack/get-messages",
"https://github.com/vessl-ai/hyperpocket/tree/main/tools/slack/post-message",
])
# get langchain compatible tools from pocket
tools = pocket.get_tools()
llm = ChatOpenAI()
prompt = ChatPromptTemplate.from_messages(
(
"system",
"You are very powerful linear assistant. You can help the user do something like commenting, get some issues",
),
("placeholder", "{chat_history}"),
("user", "{input}"),
MessagesPlaceholder(variable_name="agent_scratchpad"),
]
)
memory = ConversationBufferMemory(memory_key="chat_history", return_messages=True)
agent = create_tool_calling_agent(llm, tools, prompt)
agent_executor = AgentExecutor(
agent=agent,
tools=tools,
memory=memory,
verbose=True,
handle_parsing_errors=True
)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
hyperpocket_langchain-0.5.7.tar.gz
(117.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hyperpocket_langchain-0.5.7.tar.gz.
File metadata
- Download URL: hyperpocket_langchain-0.5.7.tar.gz
- Upload date:
- Size: 117.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
53403ff0c542798b5ff8624aeb708cf7ff9ce03b69153af6414396f66e3973c5
|
|
| MD5 |
f21440c228e08f9e72a8ce36babd07da
|
|
| BLAKE2b-256 |
2fb5b77012d8eb0568a01f92011e40d3a6108165afe623c9f9c95f2c011fefb8
|
File details
Details for the file hyperpocket_langchain-0.5.7-py3-none-any.whl.
File metadata
- Download URL: hyperpocket_langchain-0.5.7-py3-none-any.whl
- Upload date:
- Size: 2.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
773527997e6df39e703571f45d729a8f16939bd1d6eb48fceb7336a1c24b4e8a
|
|
| MD5 |
9580a0aca4be1c0f6e1fa7ac79f902c2
|
|
| BLAKE2b-256 |
5538db78e3305704acbea9f931e6d13a9bbf65ca58d59f803760f9b88da019b8
|