You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I searched the LangChain documentation with the integrated search.
I used the GitHub search to find a similar question and didn't find it.
I am sure that this is a bug in LangChain rather than my code.
The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).
Example Code
Hi , I am using langchain setup , I need to replace openi ai api keys with ollama llms and also llm.bind_tools(tools) functionality using ollama functions if needed.
llm = ChatOpenAI(
model="gpt-4-turbo",
temperature=0,
openai_api_key=OPENAI_API_KEY
)
ticket_system = TicketSystem(entity_id, user_email)
tools = [
StructuredTool.from_function(
name="create_ticket",
func=ticket_system.create_ticket,
description="""Create a new ticket after collecting all required information.
Required parameters (must be collected through conversation):
- title: Title of the ticket
- message: Detailed description of the issue/request
- category: Ticket category
- category_id: Category identifier
- requestor_name: Name of the requester
- requested_by: Email of the requester
- assigned_to: Email of the assignee
- assignee_name: Name of the assignee
- status: Initial status of the ticket (e.g., 'Assigned')
- assigned_by: Email of the assigner
- assigner_name: Name of the assigner
- action: Initial action of the ticket (e.g., 'Opened')
- sub_category: Sub-category of the ticket
- sub_category_id: Sub-category identifier""",
),
Tool(
name="get_assigned_tickets",
func=ticket_system._get_assigned_tickets,
description="Use this tool to get information about assigned tasks. Optional params: page (default=1), limit (default=10), status."
),
Tool(
name="get_requested_tickets",
func=ticket_system._get_requested_tickets,
description="Use this tool to get information about requested. Optional params: page (default=1), limit (default=10), status."
),
Tool(
name="get_ticket_details",
func=ticket_system._get_ticket_details,
description="Use this tool to view detailed information about specific ticket id. Optional params: ticket_id"
)
]
prompt = ChatPromptTemplate.from_messages([
("system", SYSTEM_PROMPT),
MessagesPlaceholder(variable_name="chat_history"),
("user", "{input}"),
MessagesPlaceholder(variable_name="agent_scratchpad"),
])
llm_with_tools = llm.bind_tools(tools)
agent = (
{
"input": lambda x: x["input"],
"agent_scratchpad": lambda x: format_to_openai_tool_messages(x["intermediate_steps"]),
"chat_history": lambda x: memory.load_memory_variables({})["chat_history"],
}
| prompt
| llm_with_tools
| OpenAIToolsAgentOutputParser()
)
return AgentExecutor(
agent=agent,
tools=tools,
verbose=False,
memory=memory
)
Error Message and Stack Trace (if applicable)
No response
Description
Hi , I am using langchain setup , I need to replace openi ai api keys with ollama llms and also llm.bind_tools(tools) functionality using ollama functions if needed.
System Info
System Information
OS: Linux
OS Version: #23~22.04.1-Ubuntu SMP Thu Jan 16 02:17:57 UTC 2025
Python Version: 3.11.7 (main, Dec 15 2023, 18:12:31) [GCC 11.2.0]
Checked other resources
Example Code
Hi , I am using langchain setup , I need to replace openi ai api keys with ollama llms and also llm.bind_tools(tools) functionality using ollama functions if needed.
def initialize_agent(entity_id: str, user_email: str, memory: ConversationBufferMemory):
Error Message and Stack Trace (if applicable)
No response
Description
Hi , I am using langchain setup , I need to replace openi ai api keys with ollama llms and also llm.bind_tools(tools) functionality using ollama functions if needed.
System Info
System Information
Package Information
Optional packages not installed
Other Dependencies
The text was updated successfully, but these errors were encountered: