Commit Graph

75 Commits

Author SHA1 Message Date
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
OğuzhanSarisakaloglu
7aad51da7f Fix typo errors in code and readme file. 2023-12-12 18:40:07 -05:00
Mark Pollack
a58e1fec64 Remove chain package. Fixes #109 2023-12-12 15:43:32 -05: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
5f7e78bd1b add prompt docs 2023-12-06 16:58:46 -05:00
Christian Tzolov
ac9ae589f4 Add NOT operator to VectorStore portable filter expressions
- Add NOT expression type to the portable Filter.Expression model.
 - Add NOT to the Antlr grammar and implement the related parser listener method to generate Filter NOT expressions.
 - Add NOT support to the filter programming DSL.
 - Implement FilterHelper.negation for logically transform any boolean expression with NOT statements into
   semantically equivalent one with NOT applied to the leaf expressions.
 - Add tests for paresers, converters and vectorsores ITs.
 - Move the filter IN/NIN expansion logic to the FilterHelper
 - Factor out the filter IN/NIN boolean expression expansion logic out of Weaviate up to the FilterHelper.
 - add in/nin expantion FilterHelper tests
2023-11-28 18:17:56 -05:00
Craig Walls
ffe44e24e2 Add equals() and hashCode() for Prompt and SearchRequest 2023-11-22 15:52:56 -05:00
Christian Tzolov
ad7af600fd improve vector-store docs 2023-11-22 01:10:14 +01: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
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
KathrynBrusewitz
837c4080aa Make filter expression builder Op public 2023-11-15 19:35:49 +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
37e53900ac fix failing test 2023-11-07 21:13:13 -05:00
Mark Pollack
57fae37dec ignore failing test... for now! 2023-11-07 21:07:25 -05:00
Mark Pollack
d514f28cd4 update vector store docs 2023-11-07 17:05:14 -05:00
Christian Tzolov
3615667f05 Support for search with metdata filter expressions
- Extend the VectorStore with similaritySearch using metadata filters using internal DSL and external DSL using Antlr
 - Metdata support for Pinecone, Milvus, and pgvector vector stores
 - PGVectorStore uses explict ::jsonpath casting for the pgvector filter expression to avoid injections
 - Add unit tests for the filter converters, parser and DSL.
 - Add ITs for the 3 vector stores

Resolves: #75
2023-11-07 15:47:53 -05:00
Sebastian Ullrich
c15663137c Add test for BeanOutputParser and support for JacksonAnnotations
Fixes #53
2023-10-30 16:50:58 -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
e5693f7e60 Convert the PdfTestUtils into a generic FileDocumentWriter 2023-10-17 11:56:29 +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
Christian Tzolov
7c3c8445f0 minor javadoc 2023-10-05 11:10:21 +02:00
Christian Tzolov
179d1747f8 Improve parsers javadocs 2023-10-04 21:22:51 +02:00
John Blum
070c924e71 Simplify AiClient, Prompt and Message construction.
Change Generation access from AiResponse in AiCilent.generate(:String).

Include unit tests for AiClient.

Cleanup compiler warnings.
2023-10-04 15:34:24 +02:00
Michal Bernhard
e0667ddf01 Fix typo in embedding-model-dimensions.properties 2023-10-04 12:22:30 +02:00
Christian Tzolov
f4f1d6f821 Rename XXLoader to XXReader. Disable AcmeIT.acmeChain() test. 2023-10-04 11:25:01 +02:00
Christian Tzolov
3eff6a75c9 Refactoring to functional interfaces
Fixes #47

reformatting
2023-10-03 19:04:29 -04: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
Craig Walls
5c23b9d3d8 Add TextLoader implementation of Loader
- supports custom Charsets.
 - User metdata can be assigned to the generated documents.
 - Add tests.
2023-09-29 15:03:02 +02:00
Christian Tzolov
65a6ffcffb Dynamic embedding dimensions resolution
Leverage #28 to allow the vector stores to resolve the embedding dimensions dynamically.
 The explicitly set dimensions (if set) precedence over other configurations.
 If the embedding dimensions are not explicitly set, the embeddingClient is used
 to determine  them dynamically. If the client fails the it falls back to 1536.
2023-09-28 08:57:20 +02:00
Ueibin Kim
5ff2c3bb92 modify message type get value 2023-09-27 17:15:34 -04:00
Christian Tzolov
92773f17c0 Add embedding model dimensions retrieval
- Add dimension method to the EmbeddingClient interface.
   Default dimension implementation uses the embed method to produce results and counts the result dimensions.
 - Add EmbeddingUtil#dimensions utilities that look up the model dimensions from a pre-defined (static) file.
   If the requested model is unknown, fallback to the default behaviour.
 - Override the dimensions method in the OpenAiEmbeddingClient and AzureOpenAiEmbeddingClient to implement local caching.
 - Add unit and IT tests.

 Resolves #28
2023-09-27 13:06:25 -04:00
Mark Pollack
ec601c3e6d Updates for moving acme-assist fully on Spring AI
* Add SimplePersistentVectorStore
2023-09-18 14:04:58 -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
mackey0225
09816b43df Fix typo 2023-08-31 02:01:44 +09:00
Simon Verhoeven
6b9a1dad5c Update documentation, remove unused imports
Signed-off-by: Simon Verhoeven <verhoeven.simon@gmail.com>
2023-08-26 06:50:07 +02:00
Mark Pollack
bc30051548 add optional ObjectMapper to BeanObjectMapper and allow for subclassing 2023-08-23 12:47:56 -07:00
Mark Pollack
c9905fdaec add duration and boot config procoessor dep 2023-08-22 16:42:28 -07:00
Mark Pollack
12b0234508 format code, remove extraneous comments 2023-08-22 07:59:30 -07:00
Mark Pollack
bf8fce995a update beanoutput parser prompt 2023-08-22 07:58:48 -07:00
Mark Pollack
99f3c1da19 add beanoutput parser 2023-08-21 18:15:37 -07:00
Mark Pollack
f2f81cd963 Change JsonOutputParser to MapOutputParser 2023-08-19 15:28:34 -04:00
Mark Pollack
8e276cae6d improve acme bike use case and evaluation tests 2023-08-19 12:31:48 -04:00
Mark Pollack
2b10843537 use AiInput/AiOuput in chain instead of raw hashmaps 2023-08-18 17:40:52 -04:00
Mark Pollack
b229bf898e Add JsonOutputParser 2023-08-18 17:13:58 -04:00
Mark Pollack
36f3e96745 Add OutputParser 2023-08-18 16:37:34 -04:00
Mark Pollack
678690aeca fix java formatting 2023-08-18 13:02:58 -04: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