Skip to content

Conversation

@JM-Lab
Copy link
Contributor

@JM-Lab JM-Lab commented Jun 30, 2024

These changes enable support for both Exact k-NN and Approximate k-NN searches in OpenSearch. The code was updated and refactored to include this new functionality, as it previously only supported Exact k-NN.

  • Enhanced OpenSearchVectorStore to support both exact and approximate k-NN search methods.
  • Updated integration tests to cover common similarity metrics (cosinesimil, l2, innerproduct) for both exact and approximate k-NN.
  • Made necessary updates to the auto-configuration to accommodate the new support for approximate k-NN.

@tzolov
Copy link
Contributor

tzolov commented Jul 2, 2024

Thank you @JM-Lab ,
Could you please update the documentation as well. Add and document the new (and/or updated) properties there and perhaps explain how to switch between the 2 search options.

- Enable Authentication using OpenAI API key
- Use TokenCredential for authorization if provided by the user
- Add the spring.ai.azure.openai.openai-api-key for auth with OpenAI service
- Update Azure Chat and Embedding docs
- Add integration tests for OpenAI connection

Resolves spring-projects#260
xieyucan and others added 13 commits July 2, 2024 10:42
There is a parameter missing. Would avoid confusion
* Add comments in OpenAiAudioSpeechModel like OpenAiChatModel

* Remove duplicated word in OpenAiAudioSpeechOptions AudioResponseFormat comment
Co-authored-by: Alex Klymenko <[email protected]>
 - add StreamEven API domain model for reliably parsing stream events.
 - add StreamHelper#mergeToolUseEvents to aggregate partial tool use jsons into a list of ContentBlocks.
 - add StreamHelper#eventToChatCompletionResponse to convert Flux<StreamEvents> into Flux<ChatCompletionResponse>.
 - Rename MediaContent -> ContentBlock, RequestMessage -> AnthropicMessage, ChatCompletion -> ChatCompletionResponse.
 - Improve tests and docs.
- Add comment in MessageType for readability
@JM-Lab
Copy link
Contributor Author

JM-Lab commented Jul 3, 2024

@tzolov Thanks for the feedback!
I’ve updated the documentation with the new properties, search options, and corrected some errors.

markpollack and others added 3 commits July 5, 2024 12:18
In testing the docker mongodb/atlas container doesn't throw an exception when
calling `mongoTemplate.executeCommand({"createSearchIndexes": ...});`. However,
when using the Atlas service it does and throws a `IndexAlreadyExists` exception.

Added error handling for error code 68 or error code name `IndexAlreadyExists`.
See: https://www.mongodb.com/docs/manual/reference/error-codes/

Fixes spring-projects#910
piotrooo and others added 28 commits July 22, 2024 14:08
 - Breaking changes: Classes from the org.springframework.ai.openai.metadata.audio.transcription package have been moved to the org.springframework.ai.audio.transcription package.
 - The AzureOpenAiAudioTranscriptionModel has been added to the auto-configuration.
 - The spring.ai.azure.openai.audio.transcription prefix was introduced for properties.
 - Introduces options properties which cover all of them (see: AzureOpenAiAudioTranscriptionOptions).
 - fix missing MutableResponseMetadata
 - add docs
 - adjust code to updated ResponseMetadata design
 - add test to AzureOpenAiAutoConfiguration
 - add missing AzureOpenAiAudioTranscriptionModel tests
 The Lambda functions do not retain the type information, so we need to provide the input type explicitly.

 Resolves spring-projects#1052

 Co-authored-by: liuzhifei <[email protected]>
* Updated docs
* Minor code cleanup
- extend the OllamaApi with Tool, ToolCalls and Function and add Tool Role.
- make OllamaChatModel extend the AbstractToolCallSupport.
- extend the OllamaChatModel to convert the Spring AI messages to OllamaApi messages, including Tools.
- OllamaOptions implements FunctionCallingOptions.
- add OllamaApiToolFunctionCallIT for testing function calling.
- patch the AbstractToolCallSupport#isToolCall to take set of stop resons.
- add FunctionCallbackInPromptIT and FunctionCallbackWrapperIT function calling auto-configuration tests.
- extend OllamAutoConfiguration to support function calling registration.
- add function call tests to OllamChatAutoConfigurationIT.
- add OllamaWithOpenAiChatModelIT to OpenAi that uses the OpenAI API to call Ollama.
- move buildToolCallConversation and handleToolCalls to parent AbstractToolCallSupport.
- update Docs. add Ollama function call docs.
- update Ollama diagrams.

Resolves spring-projects#720
…jects#1026)

org.bson.Documents have been the preferred document structure
since the 3.0 release of the mongo-java-driver
- Extract Method
- Replace explicit instanceof checks and casting with pattern matching
- Change var to explicit type
 - factor out the common funciton calling logic form AnthropicChatModel to the AbstractToolCallSupport.
 - improve the AbstractToolCallSupport isToolCall to handle OpenAi and Anthropic.
 - fix an issue with the function calling streaming aggreagation leading to lost usage statistics.
 - small code improvements for OpenAiChatModel.
… both exact and approximate k-NN.

Signed-off-by: Jemin Huh <[email protected]>
Signed-off-by: Jemin Huh <[email protected]>
…M-Lab/spring-ai into enhance-opensearch-vectorstore

# Conflicts:
#	spring-ai-spring-boot-autoconfigure/src/main/java/org/springframework/ai/autoconfigure/vectorstore/opensearch/OpenSearchVectorStoreProperties.java
#	vector-stores/spring-ai-opensearch-store/src/main/java/org/springframework/ai/vectorstore/OpenSearchVectorStore.java
#	vector-stores/spring-ai-opensearch-store/src/test/java/org/springframework/ai/vectorstore/OpenSearchVectorStoreIT.java
Signed-off-by: Jemin Huh <[email protected]>
@JM-Lab
Copy link
Contributor Author

JM-Lab commented Jul 26, 2024

Hi @tzolov, @sobychacko,

This branch is too outdated, and while rebasing with the main branch, it got tangled. I have created a new pull request to start fresh from the squashed branch: #1121. Therefore, I am closing this pull request.

Review the new pull request. Thank you.

@JM-Lab JM-Lab closed this Jul 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.