No project description provided
Project description
Langchain extensions
Biding 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-message",
"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-message",
"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.2.0.tar.gz
(116.9 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.2.0.tar.gz.
File metadata
- Download URL: hyperpocket_langchain-0.2.0.tar.gz
- Upload date:
- Size: 116.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.24
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e96b3c066c45e8f7234e281574734beaa6756a85e089861779a5e15e902b2503
|
|
| MD5 |
596e74c39cbef02d8e5aaaf88dc02153
|
|
| BLAKE2b-256 |
2027cea87f3ef8e82e25df3f518127812d657c2b350f6d2ead52bc337b51db13
|
File details
Details for the file hyperpocket_langchain-0.2.0-py3-none-any.whl.
File metadata
- Download URL: hyperpocket_langchain-0.2.0-py3-none-any.whl
- Upload date:
- Size: 2.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.24
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fd622439ea5cce6de6cb3400e6a53be0a0510d516d4c1a31f803660e78610ff4
|
|
| MD5 |
cf6487fa18b98a9643e5a5703c3c35c2
|
|
| BLAKE2b-256 |
7cf0fbbc74176c9da72998b773622f7dc36e17bad8f911b4ca08fe9eee760130
|