Skip to content

Conversation

@sobychacko
Copy link
Contributor

Fixes: #1831

  • Document auto-truncation configuration with high token limits
  • Add integration tests for auto-truncation behavior
  • Include Spring Boot and manual configuration examples
  • Test large documents and batching scenarios

Enables proper use of embedding model auto-truncation while avoiding batching strategy exceptions.

@markpollack
Copy link
Member

I see test errors.


org.opentest4j.AssertionFailedError: Unexpected exception thrown: java.lang.IllegalArgumentException: Tokens in a single document exceeds the maximum number of allowed input tokens

	at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:152)
	at org.junit.jupiter.api.AssertDoesNotThrow.createAssertionFailedError(AssertDoesNotThrow.java:84)
	at org.junit.jupiter.api.AssertDoesNotThrow.assertDoesNotThrow(AssertDoesNotThrow.java:53)
	at org.junit.jupiter.api.AssertDoesNotThrow.assertDoesNotThrow(AssertDoesNotThrow.java:36)
	at org.junit.jupiter.api.Assertions.assertDoesNotThrow(Assertions.java:3199)
	at org.springframework.ai.vectorstore.pgvector.PgVectorStoreAutoTruncationIT.lambda$testAutoTruncationWithLargeDocument$3(PgVectorStoreAutoTruncationIT.java:105)
	at org.springframework.boot.test.context.runner.AbstractApplicationContextRunner.accept(AbstractApplicationContextRunner.java:469)

and


org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.springframework.ai.embedding.BatchingStrategy' available

	at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:394)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:385)
	at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1290)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at org.springframework.boot.test.context.assertj.AssertProviderApplicationContextInvocationHandler.invokeApplicationContextMethod(AssertProviderApplicationContextInvocationHandler.java:147)
	at org.springframework.boot.test.context.assertj.AssertProviderApplicationContextInvocationHandler.invoke(AssertProviderApplicationContextInvocationHandler.java:85)
	at jdk.proxy2/jdk.proxy2.$Proxy77.getBean(Unknown Source)
	at org.springframework.ai.vectorstore.pgvector.PgVectorStoreAutoTruncationIT.lambda$testExceedingArtificialLimit$5(PgVectorStoreAutoTruncationIT.java:142)

@markpollack markpollack self-assigned this May 10, 2025
…atching documents

Fixes: spring-projects#1831

- Document auto-truncation configuration with high token limits
- Add integration tests for auto-truncation behavior
- Include Spring Boot and manual configuration examples
- Test large documents and batching scenarios

Enables proper use of embedding model auto-truncation while avoiding batching strategy exceptions.

Signed-off-by: Soby Chacko <[email protected]>
@sobychacko
Copy link
Contributor Author

@markpollack Sorry about that. It is fixed now.

@markpollack
Copy link
Member

great, merged in 8f879aa

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.

Auto truncate for vertex embedding is broken by TokenCountBatchingStrategy

2 participants