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 single quote block in llm answer #3139

Merged
merged 1 commit into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion backend/onyx/chat/stream_processing/citation_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def process_token(
# Handle code blocks without language tags
if "`" in self.curr_segment:
if self.curr_segment.endswith("`"):
return
pass
elif "```" in self.curr_segment:
piece_that_comes_after = self.curr_segment.split("```")[1][0]
if piece_that_comes_after == "\n" and in_code_block(self.llm_out):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,26 @@ def process_text(
"The code demonstrates variable assignment.",
[],
),
(
"Long JSON string in code block",
[
"```json\n{",
'"name": "John Doe",',
'"age": 30,',
'"city": "New York",',
'"hobbies": ["reading", "swimming", "cycling"],',
'"education": {',
' "degree": "Bachelor\'s",',
' "major": "Computer Science",',
' "university": "Example University"',
"}",
"}\n```",
],
'```json\n{"name": "John Doe","age": 30,"city": "New York","hobbies": '
'["reading", "swimming", "cycling"],"education": { '
'"degree": "Bachelor\'s", "major": "Computer Science", "university": "Example University"}}\n```',
[],
),
(
"Citation as a single token",
[
Expand Down
Loading