Skip to content

Commit

Permalink
Fix typo errors in code and readme file.
Browse files Browse the repository at this point in the history
  • Loading branch information
ogzugru authored and markpollack committed Dec 12, 2023
1 parent f361426 commit 7aad51d
Show file tree
Hide file tree
Showing 25 changed files with 33 additions and 40 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ assignees: ''

---

Please do a quick search on Github issues first, there might be already a duplicate issue for the one you are about to create.
Please do a quick search on GitHub issues first, there might be already a duplicate issue for the one you are about to create.
If the bug is trivial, just go ahead and create the issue. Otherwise, please take a few moments and fill in the following sections:

**Bug description**
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ assignees: ''

---

Please do a quick search on Github issues first, the feature you are about to request might have already been requested.
Please do a quick search on GitHub issues first, the feature you are about to request might have already been requested.

**Expected Behavior**

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ For usage details, consult the [AiClient API guide](https://docs.spring.io/spri


**Prompts:** Central to AI model interaction is the Prompt, which provides specific instructions for the AI to act upon.
Crafting an effective Prompt is both an art and science, giving rist to the discipline of "Prompt Engineering".
Crafting an effective Prompt is both an art and science, giving rise to the discipline of "Prompt Engineering".
These prompts often leverage a templating engine for easy data substitution within predefined text using placeholders.

Explore more on [Prompts](https://docs.spring.io/spring-ai/reference/concepts.html#_prompts) in our concept guide.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public class ResourceCacheService {

/**
* Resources with URI schemas belonging to the excludedUriSchemas are not cached. By
* default the file and classpath resources are not cached as they are already in the
* default, the file and classpath resources are not cached as they are already in the
* local file system.
*/
private List<String> excludedUriSchemas = new ArrayList<>(List.of("file", "classpath"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public SearchRequest withTopK(int topK) {
/**
* Similarity threshold score to filter the search response by. Only documents with
* similarity score equal or greater than the 'threshold' will be returned. Note that
* this is a post processing step performed on the client not the server side. A
* this is a post-processing step performed on the client not the server side. A
* threshold value of 0.0 means any similarity is accepted or disable the similarity
* threshold filtering. A threshold value of 1.0 means an exact match is required.
* @param threshold The lower bound of the similarity score.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,9 @@

import org.antlr.v4.runtime.Lexer;
import org.antlr.v4.runtime.CharStream;
import org.antlr.v4.runtime.Token;
import org.antlr.v4.runtime.TokenStream;
import org.antlr.v4.runtime.*;
import org.antlr.v4.runtime.atn.*;
import org.antlr.v4.runtime.dfa.DFA;
import org.antlr.v4.runtime.misc.*;

@SuppressWarnings({ "all", "warnings", "unchecked", "unused", "cast", "CheckReturnValue", "this-escape" })
public class FiltersLexer extends Lexer {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,8 @@
import org.antlr.v4.runtime.atn.*;
import org.antlr.v4.runtime.dfa.DFA;
import org.antlr.v4.runtime.*;
import org.antlr.v4.runtime.misc.*;
import org.antlr.v4.runtime.tree.*;
import java.util.List;
import java.util.Iterator;
import java.util.ArrayList;

@SuppressWarnings({ "all", "warnings", "unchecked", "unused", "cast", "CheckReturnValue" })
public class FiltersParser extends Parser {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Add the `spring-ai-ollama` dependency to your project's pom:
</dependency>
----

then create an client and use generate response:
then create a client and use generate response:

[source,java]
----
Expand All @@ -38,7 +38,7 @@ AiResponse aiResponse = ollamaClient.generate(new Prompt("Hello"));
=== Spring Boot Starter

For convenience, you can opt for the Ollama Boot starter.
For this, add the following dependency:
For this add the following dependency:

[source,xml]
----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ The design of the EmbeddingClient interface centers around two primary goals:

* *Portability*: This interface ensures easy adaptability across various embedding models.
It allows developers to switch between different embedding techniques or models with minimal code changes.
This design aligns with Spring's philophy of modularity and interchangeability.
This design aligns with Spring's philosophy of modularity and interchangeability.

* *Simplicity*: EmbeddingClient simplifies the process of converting text to embeddings.
By providing straightforward methods like `embed(String text)` and `embed(Document document)`, it takes the complexity out of dealing with raw text data and embedding algorithms. This design choice makes it easier for developers, especially those new to AI, to utilize embeddings in their applications without delving deep into the underlying mechanics.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ List<List<Double>> embeddings = embeddingClient.embed(List.of("Hello world", "Wo

Note that when created manually you have to call the `afterPropertiesSet()` after setting the properties and before using the client.

The first `embed()` call downloads the the large ONNX model and caches it on the local file system.
Therefore the first call might take longer than usual.
The first `embed()` call downloads the large ONNX model and caches it on the local file system.
Therefore, the first call might take longer than usual.
Use the `#setResourceCacheDirectory(<path>)` to set the local folder where the ONNX models as stored.
The default cache folder is `${java.io.tmpdir}/spring-ai-onnx-model`.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

= Output Parsers

The `OutputParser` interface allows you to obtain structured output, for example ampping the output to a Java class or an array of values from the String based ouput of AI Models.
The `OutputParser` interface allows you to obtain structured output, for example mapping the output to a Java class or an array of values from the String based ouput of AI Models.

You can think of it in terms similar to Spring JDBC's concept of a `RowMapper` or `ResultSetExtractor`.
Developers want to quickly turn results from an AI model into data types that can be passed to other functions and methods in their application.
Expand Down Expand Up @@ -66,7 +66,7 @@ There has been considerable effort in recent OpenAI models to improve the model'
You can run a fully working example that demonstrates the use of `BeanOutputParser` as part of the https://github.com/Azure-Samples/spring-ai-azure-workshop[Spring AI Azure Workshop].
Part of this workshop code is reproduced below.

The use case for the example is to as the AI Model to generate the filography for an actor.
The use case for the example is to as the AI Model to generate the filmography for an actor.

The User prompt used is

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ For example, this portable filter expression:
author in ['john', 'jill'] && article_type == 'blog'
```

is converted inot the proprietyar Chroma format
is converted into the proprietary Chroma format

```json
{"$and":[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public static class Tokenizer {
/**
* HuggingFaceTokenizer options such as 'addSpecialTokens', 'modelMaxLength',
* 'truncation', 'padding', 'maxLength', 'stride' and 'padToMultipleOf'. Leave
* empty to fallback to the defaults.
* empty to fall back to the defaults.
*/
private Map<String, String> options = new HashMap<>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
import retrofit2.Retrofit;
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
import retrofit2.converter.jackson.JacksonConverterFactory;
import retrofit2.http.HEAD;

@AutoConfiguration
@ConditionalOnClass(OpenAiService.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public void addAndSearchWithFilters() {
var bgDocument = new Document("The World is Big and Salvation Lurks Around the Corner",
Map.of("country", "Bulgaria"));
var nlDocument = new Document("The World is Big and Salvation Lurks Around the Corner",
Map.of("country", "Netherland"));
Map.of("country", "Netherlands"));

vectorStore.add(List.of(bgDocument, nlDocument));

Expand All @@ -77,8 +77,8 @@ public void addAndSearchWithFilters() {
assertThat(results).hasSize(1);
assertThat(results.get(0).getId()).isEqualTo(bgDocument.getId());

results = vectorStore
.similaritySearch(request.withSimilarityThresholdAll().withFilterExpression("country == 'Netherland'"));
results = vectorStore.similaritySearch(
request.withSimilarityThresholdAll().withFilterExpression("country == 'Netherlands'"));
assertThat(results).hasSize(1);
assertThat(results.get(0).getId()).isEqualTo(nlDocument.getId());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public void addAndSearchWithFilters() {
var bgDocument = new Document("The World is Big and Salvation Lurks Around the Corner",
Map.of("country", "Bulgaria", "price", 3.14, "active", true, "year", 2020));
var nlDocument = new Document("The World is Big and Salvation Lurks Around the Corner",
Map.of("country", "Netherland", "price", 1.57, "active", false, "year", 2023));
Map.of("country", "Netherlands", "price", 1.57, "active", false, "year", 2023));

vectorStore.add(List.of(bgDocument, nlDocument));

Expand All @@ -95,8 +95,8 @@ public void addAndSearchWithFilters() {
assertThat(results).hasSize(1);
assertThat(results.get(0).getId()).isEqualTo(bgDocument.getId());

results = vectorStore
.similaritySearch(request.withSimilarityThresholdAll().withFilterExpression("country == 'Netherland'"));
results = vectorStore.similaritySearch(
request.withSimilarityThresholdAll().withFilterExpression("country == 'Netherlands'"));
assertThat(results).hasSize(1);
assertThat(results.get(0).getId()).isEqualTo(nlDocument.getId());

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
The Great Depression (1929–1939) was an economic shock that affected most countries across the world. It was a period of economic depression that became evident after a major fall in stock prices in the United States.[1] The economic contagion began around September 1929 and led to the Wall Street stock market crash of October 24 (Black Thursday). It was the longest, deepest, and most widespread depression of the 20th century.[2]
Between 1929 and 1932, worldwide gross domestic product (GDP) fell by an estimated 15%. By comparison, worldwide GDP fell by less than 1% from 2008 to 2009 during the Great Recession.[3] Some economies started to recover by the mid-1930s. However, in many countries,[specify] the negative effects of the Great Depression lasted until the beginning of World War II. Devastating effects were seen in both rich and poor countries with falling personal income, prices, tax revenues, and profits. International trade fell by more than 50%, unemployment in the U.S. rose to 23% and in some countries rose as high as 33%.[4]
Cities around the world were hit hard, especially those dependent on heavy industry. Construction was virtually halted in many countries. Farming communities and rural areas suffered as crop prices fell by about 60%.[5][6][7] Faced with plummeting demand and few job alternatives, areas dependent on primary sector industries suffered the most.[8]
Economic historians usually consider the catalyst of the Great Depression to be the sudden devastating collapse of U.S. stock market prices, starting on October 24, 1929. However, some dispute this conclusion, seeing the stock crash less as a cause of the Depression and more as a symptom of the rising nervousness of investors partly due to gradual price declines caused by falling sales of consumer goods (as a result of overproduction because of new production techniques, falling exports and income inequality, among other factors) that had already been underway as part of a gradual Depression
Economic historians usually consider the catalyst of the Great Depression to be the sudden devastating collapse of U.S. stock market prices, starting on October 24, 1929. However, some dispute this conclusion, seeing the stock crash less than a cause of the Depression and more as a symptom of the rising nervousness of investors partly due to gradual price declines caused by falling sales of consumer goods (as a result of overproduction because of new production techniques, falling exports and income inequality, among other factors) that had already been underway as part of a gradual Depression
2 changes: 1 addition & 1 deletion spring-ai-test/src/main/resources/test/data/spring.ai.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ The Spring AI project aims to streamline the development of applications that in
The project draws inspiration from notable Python projects, such as LangChain and LlamaIndex, but Spring AI is not a direct port of those projects. The project was founded with the belief that the next wave of Generative AI applications will not be only for Python developers but will be ubiquitous across many programming languages.
At its core, Spring AI provides abstractions that serve as the foundation for developing AI applications. These abstractions have multiple implementations, enabling easy component swapping with minimal code changes. For example, Spring AI introduces the AiClient interface with implementations for OpenAI and Azure OpenAI.
In addition to these core abstractions, Spring AI aims to provide higher-level functionalities to address common use cases such as “Q&A over your documentation” or “Chat with your documentation.” As the complexity of the use cases increases, the Spring AI project will integrate with other projects in the Spring Ecosystem, such as Spring Integration, Spring Batch, and Spring Data.
To simplify setup, Spring Boot starters are available to help set up essential dependencies and classes. There is also a collection of sample applications to help you explore the project’s features. Lastly, the new Spring CLI project also enables you to get started quickly by using the spring boot new ai command for new projects or spring boot add ai for adding AI capabilities to your existing application.
To simplify setup, Spring Boot starters are available to help set up essential dependencies and classes. There is also a collection of sample applications to help you explore the project’s features. Lastly, the new Spring CLI project also enables you to get started quickly by using the spring boot new AI command for new projects or spring boot add AI for adding AI capabilities to your existing application.

Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Somewhere in the Andes, they believe to this very day that the future is behind you. It comes up from behind your back, surprising and unforeseeable, while the past is always before your eyes, that which has already happened. When they talk about the past, the people of the Aymara tribe point in front of them. You walk forward facing the past and you turn back toward the future.
Somewhere in the Andes, they believe in this very day that the future is behind you. It comes up from behind your back, surprising and unforeseeable, while the past is always before your eyes, that which has already happened. When they talk about the past, the people of the Aymara tribe point in front of them. You walk forward facing the past, and you turn back toward the future.
― Georgi Gospodinov, Time Shelter
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public void addAndSearchWithFilters() {
var bgDocument = new Document("The World is Big and Salvation Lurks Around the Corner",
Map.of("country", "Bulgaria"));
var nlDocument = new Document("The World is Big and Salvation Lurks Around the Corner",
Map.of("country", "Netherland"));
Map.of("country", "Netherlands"));

vectorStore.add(List.of(bgDocument, nlDocument));

Expand All @@ -115,13 +115,13 @@ public void addAndSearchWithFilters() {
assertThat(results).hasSize(1);
assertThat(results.get(0).getId()).isEqualTo(bgDocument.getId());

results = vectorStore
.similaritySearch(request.withSimilarityThresholdAll().withFilterExpression("country == 'Netherland'"));
results = vectorStore.similaritySearch(
request.withSimilarityThresholdAll().withFilterExpression("country == 'Netherlands'"));
assertThat(results).hasSize(1);
assertThat(results.get(0).getId()).isEqualTo(nlDocument.getId());

results = vectorStore.similaritySearch(
request.withSimilarityThresholdAll().withFilterExpression("NOT(country == 'Netherland')"));
request.withSimilarityThresholdAll().withFilterExpression("NOT(country == 'Netherlands')"));
assertThat(results).hasSize(1);
assertThat(results.get(0).getId()).isEqualTo(bgDocument.getId());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import com.theokanning.openai.service.OpenAiService;
import com.zaxxer.hikari.HikariDataSource;
import org.junit.Assert;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@

import org.springframework.ai.document.Document;
import org.springframework.ai.embedding.EmbeddingClient;
import org.springframework.ai.vectorstore.filter.Filter;
import org.springframework.ai.vectorstore.filter.converter.FilterExpressionConverter;
import org.springframework.ai.vectorstore.filter.converter.PineconeFilterExpressionConverter;
import org.springframework.util.Assert;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public void addAndSearchWithFilters() {
var bgDocument = new Document("The World is Big and Salvation Lurks Around the Corner",
Map.of("country", "Bulgaria"));
var nlDocument = new Document("The World is Big and Salvation Lurks Around the Corner",
Map.of("country", "Netherland"));
Map.of("country", "Netherlands"));

vectorStore.add(List.of(bgDocument, nlDocument));

Expand All @@ -152,13 +152,13 @@ public void addAndSearchWithFilters() {

results = vectorStore.similaritySearch(searchRequest.withTopK(5)
.withSimilarityThresholdAll()
.withFilterExpression("country == 'Netherland'"));
.withFilterExpression("country == 'Netherlands'"));
assertThat(results).hasSize(1);
assertThat(results.get(0).getId()).isEqualTo(nlDocument.getId());

results = vectorStore.similaritySearch(searchRequest.withTopK(5)
.withSimilarityThresholdAll()
.withFilterExpression("NOT(country == 'Netherland')"));
.withFilterExpression("NOT(country == 'Netherlands')"));

assertThat(results).hasSize(1);
assertThat(results.get(0).getId()).isEqualTo(bgDocument.getId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ private Document toDocument(Map<String, ?> item) {
}

/**
* Converts a list of doubles to a array of floats.
* Converts a list of doubles to an array of floats.
* @param doubleList The list of doubles.
* @return The converted array of floats.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ services:
- http
image: semitechnologies/weaviate:1.22.4
ports:
- 8080:8080
- "8080:8080"
restart: on-failure:0
environment:
QUERY_DEFAULTS_LIMIT: 25
Expand Down

0 comments on commit 7aad51d

Please sign in to comment.