Skip to content

Conversation

@ferenc-csaky
Copy link
Collaborator

@ferenc-csaky ferenc-csaky commented Jun 6, 2025

For the sake of completeness in the current structure this requires a openai-functions to depend on vector-type, as FlinkVectorType is defined in the latter. That is not a problem, cause both will be part of the uber JAR, hence I incloded it with a provided scope.

Relevant examples PR: DataSQRL/datasqrl-examples#62

TODO

@ferenc-csaky ferenc-csaky requested review from mbroecheler and velo June 6, 2025 14:56
@ferenc-csaky ferenc-csaky linked an issue Jun 6, 2025 that may be closed by this pull request
Copy link
Collaborator

@velo velo left a comment

Choose a reason for hiding this comment

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

Looking good

@velo velo requested a review from Copilot June 10, 2025 18:41
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates the vector_embed function and its tests to use FlinkVectorType instead of raw double[], and adds the vector-type dependency to the module.

  • Change return types of vectorEmbed and eval methods from double[] to FlinkVectorType
  • Update tests in VectorEmbedTest.java to use AssertJ and handle FlinkVectorType
  • Add vector-type module as a provided-scope dependency in pom.xml

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
functions/openai-functions/src/test/java/com/datasqrl/flinkrunner/functions/openai/VectorEmbedTest.java Updated future generics and assertions for FlinkVectorType.
functions/openai-functions/src/main/java/com/datasqrl/flinkrunner/stdlib/openai/vector_embed.java Changed eval signature to accept CompletableFuture<FlinkVectorType>.
functions/openai-functions/src/main/java/com/datasqrl/flinkrunner/stdlib/openai/OpenAIEmbeddings.java Changed embedding methods to return FlinkVectorType.
functions/openai-functions/pom.xml Added vector-type dependency with provided scope.
Comments suppressed due to low confidence (1)

functions/openai-functions/pom.xml:48

  • Using provided scope for vector-type may exclude it from the final shaded runtime artifact, leading to NoClassDefFoundError. Consider using compile scope or adjusting the shade plugin to include this dependency.
<scope>provided</scope>

}

public void eval(CompletableFuture<double[]> result, String text, String modelName) {
public void eval(CompletableFuture<FlinkVectorType> result, String text, String modelName) {
Copy link

Copilot AI Jun 10, 2025

Choose a reason for hiding this comment

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

Exceptions thrown by openAIEmbeddings.vectorEmbed are not handled; consider using whenComplete or exceptionally on the returned future to complete the result CompletableFuture exceptionally, ensuring errors propagate correctly.

Copilot uses AI. Check for mistakes.
@ferenc-csaky ferenc-csaky force-pushed the return-vector-from-vector-embed branch from 5afcb02 to cd2fe7a Compare June 10, 2025 21:25
@ferenc-csaky ferenc-csaky merged commit 9bd4609 into main Jun 10, 2025
2 checks passed
@ferenc-csaky ferenc-csaky deleted the return-vector-from-vector-embed branch June 10, 2025 21:31
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.

Use Vector type as return type for vector_embed

3 participants