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

CohereChatGenerator does not work for command r+ deployed on azure #792

Closed
fyang93 opened this issue Jun 6, 2024 · 1 comment
Closed
Labels
bug Something isn't working integration:cohere

Comments

@fyang93
Copy link

fyang93 commented Jun 6, 2024

Describe the bug
I deployed Cohere command r+ model on azure, but even if I set api_base_url in CohereChatGenerator it does not work. Interestingly, using OpenAIChatGenerator does work but failed in tool-use related stuff.

To Reproduce

from haystack import Pipeline
from haystack.components.builders import DynamicChatPromptBuilder
from haystack.dataclasses import ChatMessage
from haystack_integrations.components.generators.cohere import CohereChatGenerator
from haystack.utils import Secret
import os

COHERE_API_KEY = os.environ.get("COHERE_API_KEY")

pipe = Pipeline()
pipe.add_component("prompt_builder", DynamicChatPromptBuilder())
pipe.add_component("llm", CohereChatGenerator(Secret.from_token(COHERE_API_KEY), api_base_url=os.environ.get('COHERE_BASE_URL')))
pipe.connect("prompt_builder", "llm")

location = "Berlin"
system_message = ChatMessage.from_system("You are an assistant giving out valuable information to language learners.")
messages = [system_message, ChatMessage.from_user("Tell me about {{location}}")]

res = pipe.run(data={"prompt_builder": {"template_variables": {"location": location}, "prompt_source": messages}})
print(res)

The error shows:

ApiError: status_code: 405, body: Method not allowed: POST https://127.0.0.1/chat

Describe your environment (please complete the following information):

  • OS: Ubuntu 22.04.4 LTS
  • Haystack version: 2.2.0
  • Integration version: cohere-haystack 1.1.0
@fyang93 fyang93 added the bug Something isn't working label Jun 6, 2024
@mrm1001
Copy link

mrm1001 commented Jun 21, 2024

Hi @fyang93 could you clarify what you mean when you said you couldn't use the OpenAIChatGenerator with tool use?

@fyang93 fyang93 closed this as completed Oct 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working integration:cohere
Projects
None yet
Development

No branches or pull requests

3 participants