Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: CohereChatGenerator not supporting tools #656

Closed
TuanaCelik opened this issue Apr 11, 2024 · 3 comments
Closed

bug: CohereChatGenerator not supporting tools #656

TuanaCelik opened this issue Apr 11, 2024 · 3 comments
Labels
feature request Ideas to improve an integration integration:cohere P2

Comments

@TuanaCelik
Copy link
Contributor

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
@TuanaCelik TuanaCelik added bug Something isn't working integration:cohere labels Apr 11, 2024
@vblagoje
Copy link
Member

@masci @TuanaCelik I'm working on a solution for this

@sunilkumardash9
Copy link
Contributor

Hii @vblagoje, I could take this up, if it's not being worked on.

@masci masci added P1 P2 and removed P1 labels May 10, 2024
@shadeMe shadeMe added feature request Ideas to improve an integration and removed bug Something isn't working labels Jun 14, 2024
@anakin87
Copy link
Member

done in #790

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Ideas to improve an integration integration:cohere P2
Projects
None yet
Development

No branches or pull requests

6 participants