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]: Langfuse integration not supporting Ollama Chat API #3544

Closed
Viktor2k opened this issue May 9, 2024 · 1 comment · Fixed by #3554
Closed

[Bug]: Langfuse integration not supporting Ollama Chat API #3544

Viktor2k opened this issue May 9, 2024 · 1 comment · Fixed by #3554
Labels
bug Something isn't working

Comments

@Viktor2k
Copy link

Viktor2k commented May 9, 2024

What happened?

Using Ollama to run my models and currently trying to integrate it towards langfuse but run into an issue when using the recommended ollama_chat API. Here's a minimal example with the error where the only thin I change between the two completion requests is the provider prefix from ollama_chat to ollama.

import litellm
from litellm import completion

litellm.success_callback = ["langfuse"] 

completion(
    model = "ollama_chat/llama3:instruct",
    messages = [        
        {"role": "user", "content": "Hello"},
    ],
)

Output:
Traceback (most recent call last):
File "...python3.10/site-packages/litellm/integrations/langfuse.py", line 138, in log_event
output = response_obj["choices"][0]["message"].json()
AttributeError: 'dict' object has no attribute 'json'

import litellm
from litellm import completion

litellm.success_callback = ["langfuse"] 

completion(
    model = "ollama/llama3:instruct",
    messages = [        
        {"role": "user", "content": "Hello"},
    ],
)

Output:
Runs as expected 🥳

Relevant log output

Traceback (most recent call last):
  File "...python3.10/site-packages/litellm/integrations/langfuse.py", line 138, in log_event
    output = response_obj["choices"][0]["message"].json()
AttributeError: 'dict' object has no attribute 'json'

Twitter / LinkedIn details

No response

@Viktor2k Viktor2k added the bug Something isn't working label May 9, 2024
@Viktor2k Viktor2k changed the title [Bug]: [Bug]: Langfuse integration not supporting Ollama Chat API May 9, 2024
@paneru-rajan
Copy link
Contributor

I was able to replicate it. The message is not Message object in case of chat but dict.

Looking into it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants