Commit Graph

54 Commits

Author SHA1 Message Date
Christian Tzolov
cb12512775 Add spring AI Bom and related docs 2024-02-13 13:38:24 +01:00
Christian Tzolov
ed6a464ba8 Add options support to PostgresMlEmbeddingClient
- Add postgremaddmbedding adoc page.
- Auto-configuration:
  - add missing  boot-starter.
  - refactor autoconf class and properties to accomodate the PostgresMlEmbeddingOptions.
- PostgesMlEmbeddingClient
  - Add the (default) options field and remove old fields.
  - Implement default and request options merging.
  - Add tests for options and merging.
- Remove redundant code.
- Code style fixes.
2024-02-09 14:40:53 +01:00
Christian Tzolov
08fea315a4 Update the production depedencies 2024-01-26 17:31:29 +01:00
Mark Pollack
243cef976c Abstract API for AI model clients
* An abstract API for AI model clients
 * Providing portable client request options while still allowing vendor specific options when required.  Implemented only for StabilityAI/OpenAI ImageClient
 * Support for text->image for openai and stabilityai.

  Partial fix for #27 :  Text To Image and Fixes #266 and Fixes #261
2024-01-24 19:53:33 +01:00
Sohardh Chobera
5ba78c2fea Adds Spring boot starter for Neo4j Store 2023-12-24 09:51:15 +01:00
Christian Tzolov
472fadda61 Update the VecotorStore pom versions
- update boot to 3.2.1
  - update vector-stores: postgresql (42.7.1) , pgvecgor (0.1.4), pinecone (0.7.1)
    azure-search (11.6.1), weaviate (4.5.0)
  - clean the  auto-configuraito properties
  - resolve Milvus auto-conf property expossing external API.
2023-12-23 14:45:54 +01:00
Christian Tzolov
c8de949123 update azure-openai do beta6 and resolve the compatibility issues 2023-12-22 11:55:38 +01:00
Christian Tzolov
218ef38e1f remove neo4j boot starter pom module 2023-12-21 15:08:32 +01:00
Christian Tzolov
9ab857a8ab Add full support for Ollama AI models
- Implement a native client (OllamaApi) to leverage chat/streaming and embedding endpoints.
 - Add a OllamaChatClient implementing the ChatClinet and StreamingChatClinet interfaces.
 - Add a OllamaEmbedding clinent that impl. the EmbeddingClinet interface.
 - Add AutoConfiguraitons with properties for the chat and the embedding clients.
 - Add unit and ITs for the OllamaApi, OllamaChatClient, OllamaEmbeddingClient, and related auto-configuraitons.
 - Remove the old ollama impl. classes and tests.
 - minor fixes to the bedrok test methods names.
2023-12-20 14:11:17 -05:00
Mark Pollack
1a8fcac206 fix failing tests due to directory structure changes 2023-12-19 12:46:43 -05:00
Mark Pollack
82fe510b39 Moved Maven modules from top level directory and embedding-clients subdirectory to all be under a single models directory.
Rename artifact ID of

* `transformers-embedding` to `spring-ai-transformers`
2023-12-19 12:22:02 -05:00
Christian Tzolov
0e3192a8df Add AWS Bedrock AI support
- Add spring-ai-bedrock project with support for Cohere, Llama2, Ai21 Jurassic 2, Titan and Anthropic LLM models.
 - Add native API clients for CohereChat CohereEmbedding , Llama2Chat, JurassicChat, TitanChat and TitanEmbedding models, supporting both single shot and streaming completions (for the models that allows it)
 - Add ITs tests for the native API clients.
 - Implement Chat (AiClient) and ChatStreaming (AiStreamingClient) and EmbeddingClients (according to the models’ support for those) for Cohere, Llama2, and Anthropica. Titan and Jurassic2 are WIP.
 - Add ITs for the ChatClient, ChatStreamingClient and EmbeddingClient implementations.
 - Add Spring Boot Auto-configurations with flexible properties for the Llama2, Anthropic and Cohere modes + ITs
 - Add Spring Boot Starter configurations for all Bedrock models.
 - Add README documentations for all models.
 - Add BedrockAi APIs AOT hints
 - Add Ai21Jurassic2ChatBedrockApi, TitanEmbeddingBedrockApi, TitanChatBedrockApi
 - Add TitanChatBedrockApi

Resolves #66
2023-12-18 18:16:43 -05:00
Sohardh Chobera
5b46361373 Adds Spring boot starter for Neo4j Store 2023-12-18 12:39:23 -05:00
jruaux
a232166cf3 Add support for Redis vector store
- Added autoconfiguration for Redis vector store
- Added spring boot starter for Redis vector store
- Supports portable metadata filter expressions

Fixes #11
2023-12-18 11:50:03 -05:00
Omkar Shetkar
2209bfff96 Spring boot starters for Vector Stores
- Adds spring-boot starters for: azure-ai-search, chroma, mivlus, neo4j, pgvector, pinecone and weaviate vector stores.
- README.md update
2023-12-13 18:22:10 +01:00
Christian Tzolov
e30be94a56 Replace the theokanning with custom OpenAi API client
- Introducing a new OpenAiApi native client for OpenAI API and get rid of the theokanning library.
   Amongst others the OpenAiApi allows:
    - easy base-url configuration (e.g. TAS-AI)
    - Flux response for streaming OpenAI results.
    - Exposes the http headers containing important metadata
    - Pure Spring ecosystem, making it easier for  Graal VM
 - Define a new  AiStreamClient interface returning Flux<AiResponse>
 - Refactor OpenAiClient and to use the new OpenAiApi and implement the AiStreamClient.
 - Use spring-retry to improve the OpenAI EmbeddingClient stability on 503 error.

 - Remove the OpenAI http header interceptor as the OpenAiApi returns ResponseEntity<T> that provides direct access to the headers.
 - Refactor the metadata headers and usage extraction.
 - Remove redundant and obsolete classes.
 - Fix dependency issue with Pinecone, netty-codec-http2 and Spring Boot 3.2
2023-12-13 15:52:03 +01:00
Christian Tzolov
6d3c429e95 remove the occurances of 'experimenta' in the git urls and docs 2023-12-12 17:48:11 +01:00
Christian Tzolov
11e47c07ef Add vertex ai autoconfig and spring boot
- Add Vertex AI Autoconfigurations for chat and embedding clients.
 - Factor out the embeding client dimensions() computation into an abstract parent AbstractEmbeddingClient.
 - Add ITs
 - Vertex dos.
2023-12-12 17:36:50 +01:00
Christian Tzolov
69906db4f5 Add Vertex AI support
- Rename Generation#text to content and info to properties.
 - Make Generation extend the AbstractMessage and default to ASSISTANT message type.
 - Add vevertex-ai project with native api client for generation and embedding.
 - Add unit and IT tests for the vertex-ai native client.
 - Add AiClient and EmbeddingClient implementation for the the Vertex AI along with ITs.
2023-12-11 22:58:41 -05:00
Mark Pollack
8cc941d5ad move to 0.8.0-SNAPSHOT 2023-12-11 11:53:06 -05:00
Mark Pollack
27bb72999a remove unused asciidoc plugin and docs 2023-12-04 14:49:16 -05:00
Christian Tzolov
faee5fef6f Add support for Weaviate Vector Store
- Add Weaviate Vector Store implementation.
 - Implement a converter of portable Filter.Expressions into native, Weaviate GraphQL Were expressions.
 - Support for Weaviater schema auto-registration of filtarable metadata fields.
 - Add auto-configration, spring properties and tests.
 - WeaviateVectorStore ITs.
 - Add README.md

 Resolves #100
2023-11-21 18:16:34 -05:00
John Blum
eadcae7702 Define API for AI provider metadata collected during an AI request.
* Define GenerationMetadata property in AiResponse.
* Add OpenAI implementations of AiMetadata, RateLimit and Usage interfaces.
* Add REST Assured JsonPath dependency to spring-ai-openai module.
* Add OkHttp dependency to spring-ai-openai module.
* Add OkHttp Interceptor to parse OpenAI rate limit metadata from HTTP headers.
* Add OkHttp MockWebServer dependency to spring-ai-openai module, test scope
* Add Jakarta Servlet API dependency to spring-ai-openai module, test scope
* Add Spring Web MVC dependency to spring-ai-open-ai module., test scope
* Define OpenAI API response headers in an Enum.
* Add OpenAI test configuration using mock objects.
* Add integration test to assert successful extraction of OpenAI API response metadata.
* Include Spring Boot auto-configuration for (conditional) OpenAI metadata collection.
* Edit documentation and include information on AI metadata collected by Spring AI.
* Provide AI metadata implementation for Microsoft Azure OpenAI Service.
* Capture optional PromptMetadata in AiResponse.
* Define metadata for an AI generation choice.
* Capture AI choice metadata in Generation.
* Integrate ChoiceMetadata into AiResponse returned by OpenAI.

Fixes #98
2023-11-21 18:16:34 -05:00
Mark Pollack
465211f832 revert back to azure open ai client 1.0.0-beta.3 2023-11-21 18:12:12 -05:00
John Blum
142e799c86 Upgrade to Azure OpenAI client library for Java 1.0.0-beta.5. 2023-11-21 17:30:08 -05:00
Tommy Ludwig
6bdea65cd5 Auto-configuration and starter for Ollama
- Adds auto-configuration and a starter for Ollama.
 - Add testconteiner orca-mini integration test.
 - Improve code style and documentation.

Resolves #68, Resolves #69
2023-11-16 22:40:52 +01:00
meyerg
0aa8eb651e Add Azure AI Search Vector Store
- Use Azure AI Search end point to implement the VectorStore interface.
 - Add ITs and README.
 - Create/update vector index on after properties set.
 - Add boot auto-configuration and ITs.
 - Add boot starter for the vector store.

 Resolves: #82
2023-11-16 20:38:23 +01:00
Christian Tzolov
98ca3e2a8f Add Chroma VectorStore support
- Implement ChromaApi client, based on Chroma REST API.
 - Implement ChromaVectorStore, including support for filter expression conversion.
 - Common VectorStoreUtil class to share to/from Float/Double list/array convertion as well as Json/Map convertions.
 - Add ITs including for Basic Auth and Token autheticatios.
 - Add ChromaApi security support for BasicAuth and Token.
 - Fix an issue with Text filter expression parser, related to double-quoted identifiers.
 - Add Chroma README.md.
 - Add Chroma boot autoconfiguration

Resolves# #86
2023-11-15 22:43:36 -05:00
Christian Tzolov
ac2a0cd8e9 Fix auto-configurations missing form the import list 2023-11-15 12:54:13 +01:00
Christian Tzolov
952ff6c319 Simplify VectorStore interface
- Collapses all VectorStore similiaritySearch methdos into one with SearchRequest builder.
 - Fix all affected code and tests.
 - Bump the project version to 0.7.1.
 - Add tests
 - Add autoconfigurations for milvus, pinecone and pgvecor stores.
 - Improve and unify the VectorStore ITs.
 - Make use of TrasformersEmbeddingClient for auto-configurations ITs.
2023-11-14 15:39:01 -05:00
Mark Pollack
73eae56e65 Add test support for AI programming 2023-11-09 12:21:44 +01:00
Mark Pollack
6d956a6f37 Add initial support for Hugging Face Inference Endpoints
- Add maven config to attach swagger generate code to vscode java classpath.
 - Add license headers.
 - Streamline the test.
2023-11-03 18:45:34 +01:00
Christian Tzolov
81a5eaf801 Add Pinecone VectorStore
- Based on the official pinecone java library.
   Later expects that indices are created externally via Ops.
 - Map Document metadata to and from Pinecone's internal Struct.
   Later converts the metadata into pinecone json format.
 - Add integration tests and README.
2023-11-01 20:33:20 -04:00
Christian Tzolov
6030cda598 Add local, Transformers EmbeddingClient
- EmbeddingClient implementation that computes, locally, sentence embeddings with SBERT transformers.
 - Uses pre-trained transformer models, serialized into Open Neural Network Exchange (ONNX) format.
 - Deep Java Library and the Microsoft ONNX Java Runtime are used to run
   the ONNX models and compute the embeddings efficiently.
 - Add default tokenizer.json and model.onnx for sentence-transformers/all-MiniLM-L6-v2.
 - Add, configurable resource caching service to allow caching
   remote (http/https) resources to the local FS.
 - README.md provides information on how to serialize ONNX models.
 - add Git LFS configuration for large onnx model files.
2023-10-31 12:24:22 +01:00
imoyb
e68bdeb9a0 Add OllamaClient implementation of AiClient 2023-10-30 18:08:38 -04:00
Christian Tzolov
f9ca032cb3 Apache Tika based reader for all kinds of documents
- Provides a rudimentary text extractions for multitude of document formats,
   including PDF, Word Doc/Docx PowerPoint ppt/pptx and many more.
 - Generates a single Document for the extracted text.
 - No pre or post processing and cleansing for the text.
 - Move the ExtractedTextFormatter from pdf reader to the core reader to enable reusability. Improve the tika reader
2023-10-30 16:33:26 -04:00
Christian Tzolov
90117fe504 Move the version properties from the children to the parent POM 2023-10-18 16:50:31 +02:00
Christian Tzolov
3aaa357e78 Bump open-ai-client.version from 0.12.0 to 0.16.0 2023-10-18 16:35:45 +02:00
Christian Tzolov
1266c04b6d Add PDF Document Readers
- Add a set of PDF readers fro per-page (PagePdfDocumentReader) and per-paragraph (ParagraphPdfDocumentReader) readers.
  - Use a PDFLayoutTextStripper fork and PDFLayoutTextStripperByArea extension to preserve the structure of the extracted document.
  - PdfDocumentReaderConfig and PageExtractedTextFormatter in standalone classes.
  - Craeate a new document-readers top level model and the pdf-reader under.
2023-10-16 09:45:15 -04:00
Toshiaki Maki
caa8cb2021 Add PostgresML support for EmbeddingClient
- Implement dimensions method
 - Add MetadataMode support. Defaults to EMBED
 - Drop the pgml extension between tests.
 - Disable the PostgresMlEmbeddingClientIT by default.

Resolves #33
2023-10-05 12:05:47 +02:00
Christian Tzolov
76e44d68e4 Improve the Document API
- Add ContentFormatter and DefaultContentFormatter that can filter the metadata
   and format the Document metadata and text according to predefined templates.
 - Add content formatter tests
 - Allow the TextSplitter to copy the document  content-formatter to the children.
    When the splitter breaks the parent Document into multiple chunks (e.g.
    into a list of children Documents) copy the source content formatter to
    the chunks by default. Use the copyContentFormatter flag to enable/disable copping.
 - Add TextSplitter IT tests
 - Add MetadataExtractors as DocumentTransformers.
 - Bump spring-ai project version to 0.7.0-SNAPSHOT
 - Configurable metadata-mode for EmbeddingClients
   - Make the metadata mode configurable for the EmbeddingClient implementations.
   - Use the EMBED mode by default.

 Resolves #44
2023-10-03 14:39:17 -04:00
Gerrit Meier
a6fba7a3b6 GH-26 - Add support for Neo4j vector index.
This commit brings support for Neo4j graph database in general,
and uses the vector index functionality available since version 5.11.

Aligned with the existing PgVector store and its tests.

The module creates indexes, if needed, for the vector search and
the identifier of the document object.

Add neo4j to vectordb docs page

Co-authored-by: Michael Simons <michael@simons.ac>
2023-09-27 16:03:51 -04:00
Christian Tzolov
141f503341 Integrate Milvus as a Vestor Store
Resolves #19

* Clear and stream line. Inject search distance response as metadata
* Fix similarity threshold by metric type

 - Fix the similary search with threshold for L2 and IP types.
 - Create config Builder Config (inspired by Neo4jVectorStore impelementation.
   - add database-name, metric-type, index-type and index-param configurations.

* update vector store doc and readme
2023-09-27 12:24:52 -04:00
Christian Tzolov
5a63cd840c Add PGVector VectorStore implementation
* Enable PGVector indexing support
* Add same document ID vector update support
* Add documentation for VectorStores
2023-09-17 17:41:37 -04:00
Mark Pollack
99f3c1da19 add beanoutput parser 2023-08-21 18:15:37 -07:00
Mark Pollack
bfafa8bde3 Reactor PromptTemplateActions
* PromptTemplateActions contains Prompt create() methods
* PromptTemplateStringActions contains String render() methods
* PromptTemplateMessageActions contains Message createMessage() methods
* PromptTemplateChatActions contains List<Message> createMessages() actions
* Message classes can accept a Spring resource in their constructors
* AiClient implementations package name change llm->client
* Add toString() to Generation
* Add -PintegrationTest profile, disabled by default.
* Add integration test for OpenAi Client and 'evaluation'
* Add Question and Answer Prompts for evaluation of AiClient responses
2023-08-18 13:01:39 -04:00
Janne Valkealahti
05a0520596 Initial antora docs structure 2023-08-16 07:42:19 +01:00
Mark Pollack
b83b19085b Add Loader with JsonLoader impl. Add TextSplitter with TokenTextSplitter impl. 2023-08-13 17:55:37 -04:00
Mark Pollack
ca26c305ab change to 0.2.0-SNAPSHOT 2023-08-12 10:16:32 -04:00
Mark Pollack
e1b4bc2fff change to version 0.1.0-SNAPSHOT 2023-08-12 09:51:58 -04:00