haystack-core-integrations
haystack-core-integrations copied to clipboard
bug: CohereChatGenerator not supporting tools
PSA: Not sure if this is actually a bug, might be a missing feature..
Describe the bug
The command-r model by Cohere is actually working with the CohereChatGenerator, but there seems to be a bug when we provide tools to the generator. It produces an empty response, nothing seems to happen.
On the other hand command returns an error saying tools are not supported.
To Reproduce Works:
from haystack_integrations.components.generators.cohere import CohereChatGenerator
chat = CohereChatGenerator(model = "command-r")
message = ChatMessage.from_user("What's Natural Language Processing? Be brief.")
print(chat.run([message]))
Does not work (I used the cohere way of function definition here)
tools = [
{
"name": "sql_query_func",
"description": f"This a tool useful to query a SQL table called 'absenteeism' with the following Columns: {', '.join(df.columns)}",
"parameter_definitions": {
"queries": {
"description": "The query to use in the search. Infer this from the user's message. It should be a question or a statement",
"type": "str",
"required": True,
}
}
}
]
messages = [
ChatMessage.from_system(
"You are a helpful and knowledgeable agent who has access to an SQL database which has a table called 'absenteeism'"
),
ChatMessage.from_user("On which days of the week does the average absenteeism time exceed 4 hours?"),
]
chat_generator = CohereChatGenerator(model = "command-r")
response = chat_generator.run(messages=messages, generation_kwargs={"tools": tools})
print(response)
Describe your environment (please complete the following information):
- OS: [e.g. iOS] Colab
- Haystack version: main branch
- Integration version: cohere-haystack-0.6.0
@masci @TuanaCelik I'm working on a solution for this
Hii @vblagoje, I could take this up, if it's not being worked on.
done in #790