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] [Module Name] with chatgpt , error message : 'ChatCompletionChunk' object has no attribute 'get' #867

Closed
4 of 15 tasks
nuaabuaa07 opened this issue Nov 29, 2023 · 2 comments · Fixed by #871
Closed
4 of 15 tasks
Labels
bug Something isn't working good first issue Good for newcomers Waiting for reply

Comments

@nuaabuaa07
Copy link

Search before asking

  • I had searched in the issues and found no similar issues.

Operating system information

Linux

Python version information

3.10

DB-GPT version

main

Related scenes

  • Chat Data
  • Chat Excel
  • Chat DB
  • Chat Knowledge
  • Model Management
  • Dashboard
  • Plugins

Installation Information

Device information

cpu

Models information

chatGPT

What happened

image

What you expected to happen

why show message?

ValueError: Model server error!code=1, errmsg is LLMServer Generate Error, Please CheckErrorInfo.: 'ChatCompletionChunk' object has no attribute 'get'

How to reproduce

delete code :
if not r.get("choices"):
continue

Additional context

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!
@nuaabuaa07 nuaabuaa07 added bug Something isn't working Waiting for reply labels Nov 29, 2023
@nuaabuaa07 nuaabuaa07 changed the title [Bug] [Module Name] Bug title [Bug] [Module Name] with chatgpt , error message : 'ChatCompletionChunk' object has no attribute 'get' Nov 29, 2023
@nuaabuaa07
Copy link
Author

modify code is as follows:
use len(r.choices) instead of r.get("choices")

        if len(r.choices) == 0:
            continue
        # if not r.get("choices"):
            # continue

@csunny
Copy link
Collaborator

csunny commented Nov 30, 2023

@nuaabuaa07 Thanks, can you commit a PR to fix this?

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

Successfully merging a pull request may close this issue.

2 participants