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

Fix JSON error #268

Merged
merged 1 commit into from
Nov 7, 2024
Merged

Fix JSON error #268

merged 1 commit into from
Nov 7, 2024

Conversation

manuthecoder
Copy link
Contributor

See #267

This pull request includes several improvements to the get_remote_llms method in the src/hugchat/hugchat.py file. The changes aim to enhance error handling and data processing when fetching remote LLMs.

Error handling improvements:

  • Added a try block to handle potential errors when processing each line of the response text as JSON.
  • Included an except block to catch and log json.JSONDecodeError for malformed lines, ensuring the method continues processing valid lines.
  • Added a general except block to catch and log any other exceptions that may occur during parsing.

Data processing enhancements:

  • Introduced a loop to split the response text by lines and process each line individually as JSON.
  • Simplified the logic for handling promptExamples and parameters by ensuring proper indentation and removing commented-out code.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi! Thanks for your PR, we will deal with your PR as soon as possible.🤗

@Soulter
Copy link
Owner

Soulter commented Nov 7, 2024

Thank you!

@Soulter Soulter merged commit faa1614 into Soulter:master Nov 7, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants