Skip to content

Commit 852bac2

Browse files
committed
Bump Psych code point limit if possible
JRuby's YAML backend, SnakeYAML, has a default codepoint limit to prevent large content from leading to a DOS. The limit needs to be increased here to allow it to propagate through the rest of the test, or it will raise too early and fail. See ruby/psych#647
1 parent dfe6a92 commit 852bac2

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

spec/ruby_llm/chat_error_spec.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@
6969

7070
it 'handles context length exceeded errors' do # rubocop:disable RSpec/ExampleLength,RSpec/MultipleExpectations
7171
skip('Ollama does not throw an error for context length exceeded') if provider == :ollama
72+
73+
# Configure Psych to allow large input (JRuby's ext provider SnakeYAML has a low limit by default)
74+
Psych::Parser.code_point_limit = 20_000_000 if Psych::Parser.respond_to?(:code_point_limit=)
75+
7276
# Create a huge conversation
7377
massive_text = 'a' * 1_000_000
7478

0 commit comments

Comments
 (0)