Commit Graph

37 Commits

Author SHA1 Message Date
Mark Pollack
e1884d1d92 Next development version 2024-08-23 18:47:37 -04:00
Mark Pollack
43ad2bdb97 Release version 1.0.0-M2 2024-08-23 18:46:58 -04:00
Thomas Vitale
3fa102e78f Prompt content and completion as span events
Signed-off-by: Thomas Vitale <ThomasVitale@users.noreply.github.com>
2024-08-20 00:59:43 -04:00
Thomas Vitale
6bdb395686 Initial observability for Spring AI
* Observation APIs for chat, embedding and image models
* Conventions based on OpenTelemetry Semantic Conventions for GenAI
* Instrumentation for OpenAI chat, embedding, and image models
* Autoconfiguration for observability for OpenAI

Fixes gh-953

Signed-off-by: Thomas Vitale <ThomasVitale@users.noreply.github.com>
2024-08-01 22:25:43 +02:00
Nicholas Zhan
5417d19d9a Fix prompt template validation if a variable name contains hyphen 2024-07-02 11:13:54 -04:00
Piotr Olaszewski
06ff651734 Remove duplicated ApiUtils and polish javadocs 2024-06-17 15:39:32 +02:00
Mark Pollack
ac91302eed Next development version 2024-05-28 13:53:04 -04:00
Mark Pollack
0670575f3e Release version 1.0.0-M1 2024-05-28 13:49:11 -04:00
Christian Tzolov
2b421a49ff Move spring-core pom deps versions to the parent pom
Also update the spring could function context to 4.1.1 and jsonchema to 4.35.0
2024-04-07 18:54:32 +02:00
Ben Middleton
e004751842 Add Bedrock Anthropic Claude 3 models support
- Created low-leverl anthropic messages API for Claude 3.
   Use the new message API.
 - Add Chat Client with tests.
 - Add bedrok anthropic 3 docs.
 - Add multibudality support + tests.
 - Add auto-configuraiton & tests.
 - Rename Athropic to Athropic3 in class names to avoid confusion with previous Bedrock Anthropic 2 impl.
2024-03-19 12:29:50 +01:00
Mark Pollack
4c617e16b4 Prepare next development iteration 2024-03-12 14:33:45 -04:00
Mark Pollack
490f3cd1cb Milestone Release 0.8.1 2024-03-12 14:28:28 -04:00
Christian Tzolov
0fdc6aa844 Add streaming Function Calling support of OpenAI and Mistral AI
- Extends the  reactor logic to to allow aggregation of the chunked tool-calls messages and
  leverage the exsiting fnctoin calling infrastructure.
  - Seamples experience for the streaming functionality.
  - Add Message ID and  FinishReason to the returned Generations properties.
2024-03-10 21:01:59 +01:00
Christian Tzolov
65d42c9d4f Add full support or Vertex AI Gemini and Azure OpenAI function calling
- Extend the Spring AI Message with getMediaData() : List<MediaData>
   MediaData is a pair of MimeType and data of type Object.
   Message#getContent() return text only.

 - VertexAI Gemini Support
   - implement VertexAiGeiminChatClient for ChatClient and StreamingChat client and support for MediaData content.
     add IT tests for Chat, Streaming and Multimodality
   - add Auto-configuration + ITs
   - add Gemini Spring Boot starter.
   - add clients and boot starters to the Spring AI BOM.
   - add Anotra documentation for the Gemini chat client.
   - update gemini to latest 26.33.0 BOM.
   - add vertex ai gemini dependencies to the BOM.
   - add Vertex AI Gemini API Function Calling support
   - add Gemini API Function Calling Streaming support
   - add vertex ai gemini function calling documentation
   - factor out the Function Calling functionality into common abstraction used by OpenAI, Azure and Gemini.
   - group the VertexAI documentation under a common parent
   - add PortableFunctionCallingOption that implements FunctionCallingOptions and ChatOptions and provide builder for it.
   - remove some deprecated code.
   - allow authorization with GoogleCredentials form json file.
   - add AOT support for VertexAI Gemini.
   - move legacy Vertex AI into VertexAI PaLM2.
   - better handling for empty chat responses.
   - update the Gemini version to latest 26.33.0. This required lifting the protobuf-java to 3.25.2 as well.
   - fix a bug for handling System messages with Gemini.

- Implement Azure OpenAI Function Calling
  Uses the same the common abstractions used by OpenAI and Gemini: FunctionCallingOptions and AbstractFunctionCallSupport
2024-02-28 15:41:37 +01:00
Mark Pollack
8532cb7bcc Bump to 0.8.1-SNAPSHOT 2024-02-23 11:11:14 -05:00
Mark Pollack
596f2b06c0 Move native hints into individual modules
* Use aot.factories approach for registration
* Add tests
* final tweaks- Thanks Josh!
2024-02-20 14:23:40 -05:00
Christian Tzolov
1fa2036120 Refactor the Function Calling Support
- Remove the SpringAiFunction annotation in favour of palin Functino Beans, @Description annotation and JacksonClassAnnotation.
 - Update the function calling documentation to reflect latest changes.
 - Add a new openai option (and related property): spring.ai.openai.chat.options.beanFunctions.<function-name>.<description>
   Map of bean names and their descriptions to register as function callbacks.
 - Refactor the OpenAiAutoConfiguration to resolve and register the beans in beanFunctions.
 - Add dependency on Spring Cloud Function to use the FunctionContextUtils and FunctionTypeUtils
   Those utilites help to resolve the function input type signature.
 - Add DefaultToolFunctionCallback class for manually wrapping Functions.
 - Update the ITs.
2024-02-15 12:39:35 +01: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
Josh Long
95cbe54bae vertex ai aot hints, plus a fix to localize the dependency on spring webflux 2023-12-18 08:26:08 +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
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
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
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
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
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
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
0e0c4b9ba7 client refactoring 2023-08-15 17:46:59 -04: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
Mark Pollack
47cbb07a84 Implement LLMResult generate(Prompt... prompts) for Azure OpenAI 2023-08-06 20:21:18 -04:00
Mark Pollack
e042a8e604 OpenAI implementation with autoconfig and starters 2023-08-05 11:13:42 -04:00
Mark Pollack
6325fd361c initial prompts package 2023-07-26 20:05:12 -04:00
Mark Pollack
d5c1044aee iniital maven build system 2023-07-24 19:37:06 -04:00