DATABASE_URL=
-MODEL=hkunlp/instructor-xl
-MODEL_PARAMS={"instruction": "Represent the Wikipedia document for retrieval: "}
-QUERY_PARAMS={"instruction": "Represent the Wikipedia question for retrieving supporting documents: "}
+MODEL=intfloat/e5-small-v2
SYSTEM_PROMPT="You are an assistant to answer questions about an open source software named PostgresML. Your name is PgBot. You are based out of San Francisco, California."
BASE_PROMPT="Given relevant parts of a document and a question, create a final answer.\
Include a SQL query in the answer wherever possible. \
diff --git a/pgml-cms/docs/use-cases/embeddings/personalize-embedding-results-with-application-data-in-your-database.md b/pgml-cms/docs/use-cases/embeddings/personalize-embedding-results-with-application-data-in-your-database.md
index d6094233b..a7d68e86b 100644
--- a/pgml-cms/docs/use-cases/embeddings/personalize-embedding-results-with-application-data-in-your-database.md
+++ b/pgml-cms/docs/use-cases/embeddings/personalize-embedding-results-with-application-data-in-your-database.md
@@ -122,7 +122,7 @@ We can find a customer that our embeddings model feels is close to the sentiment
```postgresql
WITH request AS (
SELECT pgml.embed(
- 'intfloat/e5-large',
+ 'intfloat/e5-small-v2',
'query: I love all Star Wars, but Empire Strikes Back is particularly amazing'
)::vector(1024) AS embedding
)
@@ -199,7 +199,7 @@ Now we can write our personalized SQL query. It's nearly the same as our query f
-- create a request embedding on the fly
WITH request AS (
SELECT pgml.embed(
- 'intfloat/e5-large',
+ 'intfloat/e5-small-v2',
'query: Best 1980''s scifi movie'
)::vector(1024) AS embedding
),
diff --git a/pgml-cms/docs/use-cases/embeddings/tuning-vector-recall-while-generating-query-embeddings-in-the-database.md b/pgml-cms/docs/use-cases/embeddings/tuning-vector-recall-while-generating-query-embeddings-in-the-database.md
index 7e762128b..4fc6060da 100644
--- a/pgml-cms/docs/use-cases/embeddings/tuning-vector-recall-while-generating-query-embeddings-in-the-database.md
+++ b/pgml-cms/docs/use-cases/embeddings/tuning-vector-recall-while-generating-query-embeddings-in-the-database.md
@@ -110,7 +110,7 @@ We'll start with semantic search. Given a user query, e.g. "Best 1980's scifi mo
```postgresql
WITH request AS (
SELECT pgml.embed(
- 'intfloat/e5-large',
+ 'intfloat/e5-small-v2',
'query: Best 1980''s scifi movie'
)::vector(1024) AS embedding
)
@@ -157,7 +157,7 @@ Generating a query plan more quickly and only computing the values once, may mak
There's some good stuff happening in those query results, so let's break it down:
* **It's fast** - We're able to generate a request embedding on the fly with a state-of-the-art model, and search 5M reviews in 152ms, including fetching the results back to the client 😍. You can't even generate an embedding from OpenAI's API in that time, much less search 5M reviews in some other database with it.
-* **It's good** - The `review_body` results are very similar to the "Best 1980's scifi movie" request text. We're using the `intfloat/e5-large` open source embedding model, which outperforms OpenAI's `text-embedding-ada-002` in most [quality benchmarks](https://huggingface.co/spaces/mteb/leaderboard).
+* **It's good** - The `review_body` results are very similar to the "Best 1980's scifi movie" request text. We're using the `intfloat/e5-small-v2` open source embedding model, which outperforms OpenAI's `text-embedding-ada-002` in most [quality benchmarks](https://huggingface.co/spaces/mteb/leaderboard).
* Qualitatively: the embeddings understand our request for `scifi` being equivalent to `Sci-Fi`, `sci-fi`, `SciFi`, and `sci fi`, as well as `1980's` matching `80s` and `80's` and is close to `seventies` (last place). We didn't have to configure any of this and the most enthusiastic for "best" is at the top, the least enthusiastic is at the bottom, so the model has appropriately captured "sentiment".
* Quantitatively: the `cosine_similarity` of all results are high and tight, 0.90-0.95 on a scale from -1:1. We can be confident we recalled very similar results from our 5M candidates, even though it would take 485 times as long to check all of them directly.
* **It's reliable** - The model is stored in the database, so we don't need to worry about managing a separate service. If you repeat this query over and over, the timings will be extremely consistent, because we don't have to deal with things like random network congestion.
@@ -240,7 +240,7 @@ Now we can quickly search for movies by what people have said about them:
```postgresql
WITH request AS (
SELECT pgml.embed(
- 'intfloat/e5-large',
+ 'intfloat/e5-small-v2',
'Best 1980''s scifi movie'
)::vector(1024) AS embedding
)
@@ -298,7 +298,7 @@ SET ivfflat.probes = 300;
```postgresql
WITH request AS (
SELECT pgml.embed(
- 'intfloat/e5-large',
+ 'intfloat/e5-small-v2',
'Best 1980''s scifi movie'
)::vector(1024) AS embedding
)
@@ -386,7 +386,7 @@ SET ivfflat.probes = 1;
```postgresql
WITH request AS (
SELECT pgml.embed(
- 'intfloat/e5-large',
+ 'intfloat/e5-small-v2',
'query: Best 1980''s scifi movie'
)::vector(1024) AS embedding
)
@@ -442,7 +442,7 @@ SQL is a very expressive language that can handle a lot of complexity. To keep t
-- create a request embedding on the fly
WITH request AS (
SELECT pgml.embed(
- 'intfloat/e5-large',
+ 'intfloat/e5-small-v2',
'query: Best 1980''s scifi movie'
)::vector(1024) AS embedding
),
diff --git a/pgml-dashboard/content/blog/benchmarks/hf_pinecone_vs_postgresml/pgml_embeddings.py b/pgml-dashboard/content/blog/benchmarks/hf_pinecone_vs_postgresml/pgml_embeddings.py
index 2a1cf5ddd..0e071e04f 100644
--- a/pgml-dashboard/content/blog/benchmarks/hf_pinecone_vs_postgresml/pgml_embeddings.py
+++ b/pgml-dashboard/content/blog/benchmarks/hf_pinecone_vs_postgresml/pgml_embeddings.py
@@ -14,7 +14,7 @@ async def main():
collection_name = "squad_collection_benchmark"
collection = await db.create_or_get_collection(collection_name)
- model_id = await collection.register_model(model_name="intfloat/e5-large")
+ model_id = await collection.register_model(model_name="intfloat/e5-small-v2")
await collection.generate_embeddings(model_id=model_id)
if __name__ == "__main__":
diff --git a/pgml-dashboard/content/blog/benchmarks/hf_pinecone_vs_postgresml/pgml_embeddings.sql b/pgml-dashboard/content/blog/benchmarks/hf_pinecone_vs_postgresml/pgml_embeddings.sql
index 4bd8f82ad..e0f92e8e0 100644
--- a/pgml-dashboard/content/blog/benchmarks/hf_pinecone_vs_postgresml/pgml_embeddings.sql
+++ b/pgml-dashboard/content/blog/benchmarks/hf_pinecone_vs_postgresml/pgml_embeddings.sql
@@ -14,7 +14,7 @@ BEGIN
INTO curr_val;
-- Use the correct syntax to call pgml.embed and store the result
- PERFORM embed FROM pgml.embed('intfloat/e5-large', curr_val);
+ PERFORM embed FROM pgml.embed('intfloat/e5-small-v2', curr_val);
curr_id := curr_id + batch_size;
EXIT WHEN curr_id >= total_records;
@@ -26,7 +26,7 @@ BEGIN
INTO curr_val;
-- Use the correct syntax to call pgml.embed and store the result
- PERFORM embed FROM pgml.embed('intfloat/e5-large', curr_val);
+ PERFORM embed FROM pgml.embed('intfloat/e5-small-v2', curr_val);
END;
$$;
diff --git a/pgml-dashboard/content/blog/benchmarks/hf_pinecone_vs_postgresml/pgml_query.py b/pgml-dashboard/content/blog/benchmarks/hf_pinecone_vs_postgresml/pgml_query.py
index 9a0d29206..45468a39d 100644
--- a/pgml-dashboard/content/blog/benchmarks/hf_pinecone_vs_postgresml/pgml_query.py
+++ b/pgml-dashboard/content/blog/benchmarks/hf_pinecone_vs_postgresml/pgml_query.py
@@ -20,7 +20,7 @@ async def main():
data = load_dataset("squad", split="train")
data = data.to_pandas()
data = data.drop_duplicates(subset=["context"])
- model_id = await collection.register_model(model_name="intfloat/e5-large")
+ model_id = await collection.register_model(model_name="intfloat/e5-small-v2")
run_times = []
for query in data["context"][0:100]:
start = time()
diff --git a/pgml-dashboard/src/components/pages/demo/template.html b/pgml-dashboard/src/components/pages/demo/template.html
index 4e1ef82de..1dbe9df22 100644
--- a/pgml-dashboard/src/components/pages/demo/template.html
+++ b/pgml-dashboard/src/components/pages/demo/template.html
@@ -14,19 +14,19 @@
<%+ small_table::Table::new(&["Model", "Performance", "Cost"], &[
small_table::Row::new(&[
- "intfloat/e5-small".into(),
+ "intfloat/e5-small-v2".into(),
"5ms/embedding".into(),
"$0.0000000001/embedding".into(),
]).into(),
small_table::Row::new(&[
- "intfloat/e5-large".into(),
+ "Alibaba-NLP/gte-large-en-v1.5".into(),
"10ms/embedding".into(),
"$0.0000000002/embedding".into(),
]).into(),
small_table::Row::new(&[
- "intfloat/e5-large-with-overflow-intfloat/e5-large-with-overflow-intfloat/e5-large-with-overflow".into(),
+ "mixedbread-ai/mxbai-embed-large-v1".into(),
"10ms/embedding".into(),
- "$0.0000000002/embedding-intfloat/e5-large-with-overflow-intfloat/e5-large-with-overflow".into(),
+ "$0.0000000002/embedding".into(),
]).into(),
]) %>
@@ -34,19 +34,19 @@
<%+ large_table::Table::new(&["Model", "Performance", "Cost"], &[
large_table::Row::new(&[
- "intfloat/e5-small".into(),
+ "intfloat/e5-small-v2".into(),
"5ms/embedding".into(),
"$0.0000000001/embedding".into(),
]).into(),
large_table::Row::new(&[
- "intfloat/e5-large".into(),
+ "Alibaba-NLP/gte-large-en-v1.5".into(),
"10ms/embedding".into(),
"$0.0000000002/embedding".into(),
]).into(),
large_table::Row::new(&[
- "intfloat/e5-large-with-overflow-intfloat/e5-large-with-overflow-intfloat/e5-large-with-overflow".into(),
+ "mixedbread-ai/mxbai-embed-large-v1".into(),
"10ms/embedding".into(),
- "$0.0000000002/embedding-intfloat/e5-large-with-overflow-intfloat/e5-large-with-overflow".into(),
+ "$0.0000000002/embedding".into(),
]).into(),
]) %>
diff --git a/pgml-dashboard/src/utils/markdown.rs b/pgml-dashboard/src/utils/markdown.rs
index 4cb4b136c..12f085673 100644
--- a/pgml-dashboard/src/utils/markdown.rs
+++ b/pgml-dashboard/src/utils/markdown.rs
@@ -1267,10 +1267,7 @@ impl SiteSearch {
"configuration": "english"
},
"semantic_search": {
- "model": "hkunlp/instructor-base",
- "parameters": {
- "instruction": "Represent the Wikipedia document for retrieval: "
- },
+ "model": "intfloat/e5-small-v2",
}
},
"contents": {
@@ -1281,10 +1278,7 @@ impl SiteSearch {
"configuration": "english"
},
"semantic_search": {
- "model": "hkunlp/instructor-base",
- "parameters": {
- "instruction": "Represent the Wikipedia document for retrieval: "
- },
+ "model": "intfloat/e5-small-v2",
}
}
})
diff --git a/pgml-extension/examples/dbt/embeddings/README.md b/pgml-extension/examples/dbt/embeddings/README.md
index a46f8636e..55930b0b4 100644
--- a/pgml-extension/examples/dbt/embeddings/README.md
+++ b/pgml-extension/examples/dbt/embeddings/README.md
@@ -75,7 +75,7 @@ vars:
splitter_name: "recursive_character"
splitter_parameters: {"chunk_size": 100, "chunk_overlap": 20}
task: "embedding"
- model_name: "intfloat/e5-base"
+ model_name: "intfloat/e5-small-v2"
query_string: 'Lorem ipsum 3'
limit: 2
```
@@ -84,7 +84,7 @@ Here's a summary of the key parameters:
- `splitter_name`: Specifies the name of the splitter, set as "recursive_character".
- `splitter_parameters`: Defines the parameters for the splitter, such as a chunk size of 100 and a chunk overlap of 20.
- `task`: Indicates the task being performed, specified as "embedding".
-- `model_name`: Specifies the name of the model to be used, set as "intfloat/e5-base".
+- `model_name`: Specifies the name of the model to be used, set as "intfloat/e5-small-v2".
- `query_stringd`: Provides a query string, set as 'Lorem ipsum 3'.
- `limit`: Specifies a limit of 2, indicating the maximum number of results to be processed.
diff --git a/pgml-extension/examples/dbt/embeddings/dbt_project.yml b/pgml-extension/examples/dbt/embeddings/dbt_project.yml
index 9433d8f41..c9b26cc1d 100644
--- a/pgml-extension/examples/dbt/embeddings/dbt_project.yml
+++ b/pgml-extension/examples/dbt/embeddings/dbt_project.yml
@@ -10,7 +10,7 @@ vars:
splitter_name: "recursive_character"
splitter_parameters: {"chunk_size": 100, "chunk_overlap": 20}
task: "embedding"
- model_name: "intfloat/e5-base"
+ model_name: "intfloat/e5-small-v2"
#embeddings_table_name: "embeddings_intfloat_e5_small"
query_string: 'Lorem ipsum 3'
limit: 2
diff --git a/pgml-extension/examples/transformers.sql b/pgml-extension/examples/transformers.sql
index 8734cdb45..8c1e51b28 100644
--- a/pgml-extension/examples/transformers.sql
+++ b/pgml-extension/examples/transformers.sql
@@ -2,16 +2,16 @@
-- \set ON_ERROR_STOP true
\timing on
-SELECT pgml.embed('intfloat/e5-small', 'hi mom');
-SELECT pgml.embed('intfloat/e5-small', 'hi mom', '{"device": "cuda"}');
-SELECT pgml.embed('intfloat/e5-small', 'hi mom', '{"device": "cpu"}');
+SELECT pgml.embed('intfloat/e5-small-v2', 'hi mom');
+SELECT pgml.embed('intfloat/e5-small-v2', 'hi mom', '{"device": "cuda"}');
+SELECT pgml.embed('intfloat/e5-small-v2', 'hi mom', '{"device": "cpu"}');
SELECT pgml.embed('hkunlp/instructor-xl', 'hi mom', '{"instruction": "Encode it with love"}');
SELECT pgml.embed('mixedbread-ai/mxbai-embed-large-v1', 'test', '{"prompt": "test prompt: "}');
SELECT pgml.transform_stream(
task => '{
"task": "text-generation",
- "model": "TheBloke/zephyr-7B-beta-GPTQ",
+ "model": "meta-llama/Meta-Llama-3-8B-Instruct",
"model_type": "mistral",
"revision": "main",
"device_map": "auto"
diff --git a/pgml-sdks/pgml/javascript/examples/README.md b/pgml-sdks/pgml/javascript/examples/README.md
index 22eb39ddc..55d9acc1c 100644
--- a/pgml-sdks/pgml/javascript/examples/README.md
+++ b/pgml-sdks/pgml/javascript/examples/README.md
@@ -10,13 +10,13 @@ export DATABASE_URL={YOUR DATABASE URL}
Optionally, configure a .env file containing a DATABASE_URL variable.
## [Semantic Search](./semantic_search.js)
-This is a basic example to perform semantic search on a collection of documents. Embeddings are created using `intfloat/e5-small` model. The results are semantically similar documemts to the query. Finally, the collection is archived.
+This is a basic example to perform semantic search on a collection of documents. Embeddings are created using `intfloat/e5-small-v2` model. The results are semantically similar documemts to the query. Finally, the collection is archived.
## [Question Answering](./question_answering.js)
This is an example to find documents relevant to a question from the collection of documents. The query is passed to vector search to retrieve documents that match closely in the embeddings space. A score is returned with each of the search result.
## [Question Answering using Instructore Model](./question_answering_instructor.js)
-In this example, we will use `hknlp/instructor-base` model to build text embeddings instead of the default `intfloat/e5-small` model.
+In this example, we will use `hknlp/instructor-base` model to build text embeddings instead of the default `intfloat/e5-small-v2` model.
## [Extractive Question Answering](./extractive_question_answering.js)
In this example, we will show how to use `vector_recall` result as a `context` to a HuggingFace question answering model. We will use `Builtins.transform()` to run the model on the database.
diff --git a/pgml-sdks/pgml/javascript/examples/extractive_question_answering.js b/pgml-sdks/pgml/javascript/examples/extractive_question_answering.js
index 0ab69decb..461c1c5ac 100644
--- a/pgml-sdks/pgml/javascript/examples/extractive_question_answering.js
+++ b/pgml-sdks/pgml/javascript/examples/extractive_question_answering.js
@@ -10,7 +10,7 @@ const main = async () => {
text: {
splitter: { model: "recursive_character" },
semantic_search: {
- model: "intfloat/e5-small",
+ model: "intfloat/e5-small-v2",
},
},
});
diff --git a/pgml-sdks/pgml/javascript/examples/question_answering.js b/pgml-sdks/pgml/javascript/examples/question_answering.js
index 0d4e08844..dba169823 100644
--- a/pgml-sdks/pgml/javascript/examples/question_answering.js
+++ b/pgml-sdks/pgml/javascript/examples/question_answering.js
@@ -10,7 +10,7 @@ const main = async () => {
text: {
splitter: { model: "recursive_character" },
semantic_search: {
- model: "intfloat/e5-small",
+ model: "intfloat/e5-small-v2",
},
},
});
diff --git a/pgml-sdks/pgml/javascript/examples/question_answering_instructor.js b/pgml-sdks/pgml/javascript/examples/question_answering_instructor.js
index bb265cc6a..7c922dff7 100644
--- a/pgml-sdks/pgml/javascript/examples/question_answering_instructor.js
+++ b/pgml-sdks/pgml/javascript/examples/question_answering_instructor.js
@@ -10,10 +10,7 @@ const main = async () => {
text: {
splitter: { model: "recursive_character" },
semantic_search: {
- model: "hkunlp/instructor-base",
- parameters: {
- instruction: "Represent the Wikipedia document for retrieval: "
- }
+ model: "intfloat/e5-small-v2",
},
},
});
diff --git a/pgml-sdks/pgml/javascript/examples/semantic_search.js b/pgml-sdks/pgml/javascript/examples/semantic_search.js
index a40970768..4bc680787 100644
--- a/pgml-sdks/pgml/javascript/examples/semantic_search.js
+++ b/pgml-sdks/pgml/javascript/examples/semantic_search.js
@@ -10,7 +10,7 @@ const main = async () => {
text: {
splitter: { model: "recursive_character" },
semantic_search: {
- model: "intfloat/e5-small",
+ model: "intfloat/e5-small-v2",
},
},
});
diff --git a/pgml-sdks/pgml/javascript/examples/summarizing_question_answering.js b/pgml-sdks/pgml/javascript/examples/summarizing_question_answering.js
index 5afeba45c..c7822d6e3 100644
--- a/pgml-sdks/pgml/javascript/examples/summarizing_question_answering.js
+++ b/pgml-sdks/pgml/javascript/examples/summarizing_question_answering.js
@@ -10,7 +10,7 @@ const main = async () => {
text: {
splitter: { model: "recursive_character" },
semantic_search: {
- model: "intfloat/e5-small",
+ model: "intfloat/e5-small-v2",
},
},
});
diff --git a/pgml-sdks/pgml/javascript/tests/typescript-tests/test.ts b/pgml-sdks/pgml/javascript/tests/typescript-tests/test.ts
index f35e8efbb..021c03d3c 100644
--- a/pgml-sdks/pgml/javascript/tests/typescript-tests/test.ts
+++ b/pgml-sdks/pgml/javascript/tests/typescript-tests/test.ts
@@ -74,7 +74,11 @@ it("can create builtins", () => {
it("can search", async () => {
let pipeline = pgml.newPipeline("test_j_p_cs", {
+<<<<<<< Updated upstream
title: { semantic_search: { model: "intfloat/e5-small-v2", parameters: { prompt: "passage: " } } },
+=======
+ title: { semantic_search: { model: "intfloat/e5-small-v2" } },
+>>>>>>> Stashed changes
body: {
splitter: { model: "recursive_character" },
semantic_search: {
@@ -115,7 +119,11 @@ it("can search", async () => {
it("can vector search", async () => {
let pipeline = pgml.newPipeline("1", {
title: {
+<<<<<<< Updated upstream
semantic_search: { model: "intfloat/e5-small-v2", parameters: { prompt: "passage: " } },
+=======
+ semantic_search: { model: "intfloat/e5-small-v2" },
+>>>>>>> Stashed changes
full_text_search: { configuration: "english" },
},
body: {
diff --git a/pgml-sdks/pgml/python/examples/README.md b/pgml-sdks/pgml/python/examples/README.md
index 3cd4298e6..9e2f716a3 100644
--- a/pgml-sdks/pgml/python/examples/README.md
+++ b/pgml-sdks/pgml/python/examples/README.md
@@ -10,13 +10,13 @@ export DATABASE_URL={YOUR DATABASE URL}
Optionally, configure a .env file containing a DATABASE_URL variable.
## [Semantic Search](./semantic_search.py)
-This is a basic example to perform semantic search on a collection of documents. It loads the Quora dataset, creates a collection in a PostgreSQL database, upserts documents, generates chunks and embeddings, and then performs a vector search on a query. Embeddings are created using `intfloat/e5-small` model. The results are semantically similar documemts to the query. Finally, the collection is archived.
+This is a basic example to perform semantic search on a collection of documents. It loads the Quora dataset, creates a collection in a PostgreSQL database, upserts documents, generates chunks and embeddings, and then performs a vector search on a query. Embeddings are created using `intfloat/e5-small-v2` model. The results are semantically similar documemts to the query. Finally, the collection is archived.
## [Question Answering](./question_answering.py)
This is an example to find documents relevant to a question from the collection of documents. It loads the Stanford Question Answering Dataset (SQuAD) into the database, generates chunks and embeddings. Query is passed to vector search to retrieve documents that match closely in the embeddings space. A score is returned with each of the search result.
## [Question Answering using Instructor Model](./question_answering_instructor.py)
-In this example, we will use `hknlp/instructor-base` model to build text embeddings instead of the default `intfloat/e5-small` model.
+In this example, we will use `hknlp/instructor-base` model to build text embeddings instead of the default `intfloat/e5-small-v2` model.
## [Extractive Question Answering](./extractive_question_answering.py)
In this example, we will show how to use `vector_recall` result as a `context` to a HuggingFace question answering model. We will use `Builtins.transform()` to run the model on the database.
diff --git a/pgml-sdks/pgml/python/examples/extractive_question_answering.py b/pgml-sdks/pgml/python/examples/extractive_question_answering.py
index 21a0060f5..afd0f82b8 100644
--- a/pgml-sdks/pgml/python/examples/extractive_question_answering.py
+++ b/pgml-sdks/pgml/python/examples/extractive_question_answering.py
@@ -20,7 +20,7 @@ async def main():
{
"text": {
"splitter": {"model": "recursive_character"},
- "semantic_search": {"model": "intfloat/e5-small"},
+ "semantic_search": {"model": "intfloat/e5-small-v2"},
}
},
)
diff --git a/pgml-sdks/pgml/python/examples/question_answering.py b/pgml-sdks/pgml/python/examples/question_answering.py
index d4b2cc082..dfe0545ca 100644
--- a/pgml-sdks/pgml/python/examples/question_answering.py
+++ b/pgml-sdks/pgml/python/examples/question_answering.py
@@ -19,7 +19,7 @@ async def main():
{
"text": {
"splitter": {"model": "recursive_character"},
- "semantic_search": {"model": "intfloat/e5-small"},
+ "semantic_search": {"model": "intfloat/e5-small-v2"},
}
},
)
diff --git a/pgml-sdks/pgml/python/examples/question_answering_instructor.py b/pgml-sdks/pgml/python/examples/question_answering_instructor.py
index ba0069837..a32cc160c 100644
--- a/pgml-sdks/pgml/python/examples/question_answering_instructor.py
+++ b/pgml-sdks/pgml/python/examples/question_answering_instructor.py
@@ -20,10 +20,7 @@ async def main():
"text": {
"splitter": {"model": "recursive_character"},
"semantic_search": {
- "model": "hkunlp/instructor-base",
- "parameters": {
- "instruction": "Represent the Wikipedia document for retrieval: "
- },
+ "model": "intfloat/e5-small-v2",
},
}
},
diff --git a/pgml-sdks/pgml/python/examples/rag_question_answering.py b/pgml-sdks/pgml/python/examples/rag_question_answering.py
index 2558287f6..687675ac4 100644
--- a/pgml-sdks/pgml/python/examples/rag_question_answering.py
+++ b/pgml-sdks/pgml/python/examples/rag_question_answering.py
@@ -23,7 +23,7 @@ async def main():
{
"text": {
"splitter": {"model": "recursive_character"},
- "semantic_search": {"model": "intfloat/e5-small"},
+ "semantic_search": {"model": "intfloat/e5-small-v2"},
}
},
)
@@ -80,7 +80,7 @@ async def main():
# Using OpenSource LLMs for Chat Completion
client = OpenSourceAI()
- chat_completion_model = "HuggingFaceH4/zephyr-7b-beta"
+ chat_completion_model = "meta-llama/Meta-Llama-3-8B-Instruct"
console.print("Generating response using %s LLM..."%chat_completion_model)
response = client.chat_completions_create(
model=chat_completion_model,
diff --git a/pgml-sdks/pgml/python/examples/semantic_search.py b/pgml-sdks/pgml/python/examples/semantic_search.py
index 9a4e134e5..1cd2d1350 100644
--- a/pgml-sdks/pgml/python/examples/semantic_search.py
+++ b/pgml-sdks/pgml/python/examples/semantic_search.py
@@ -19,7 +19,7 @@ async def main():
{
"text": {
"splitter": {"model": "recursive_character"},
- "semantic_search": {"model": "intfloat/e5-small"},
+ "semantic_search": {"model": "intfloat/e5-small-v2"},
}
},
)
diff --git a/pgml-sdks/pgml/python/examples/summarizing_question_answering.py b/pgml-sdks/pgml/python/examples/summarizing_question_answering.py
index 862830277..ce67c96f6 100644
--- a/pgml-sdks/pgml/python/examples/summarizing_question_answering.py
+++ b/pgml-sdks/pgml/python/examples/summarizing_question_answering.py
@@ -20,7 +20,7 @@ async def main():
{
"text": {
"splitter": {"model": "recursive_character"},
- "semantic_search": {"model": "intfloat/e5-small"},
+ "semantic_search": {"model": "intfloat/e5-small-v2"},
}
},
)
diff --git a/pgml-sdks/pgml/python/tests/stress_test.py b/pgml-sdks/pgml/python/tests/stress_test.py
index 552193690..cc13c3349 100644
--- a/pgml-sdks/pgml/python/tests/stress_test.py
+++ b/pgml-sdks/pgml/python/tests/stress_test.py
@@ -22,10 +22,7 @@
"model": "recursive_character",
},
"semantic_search": {
- "model": "hkunlp/instructor-base",
- "parameters": {
- "instruction": "Represent the Wikipedia document for retrieval: "
- },
+ "model": "intfloat/e5-small-v2",
},
},
},
diff --git a/pgml-sdks/pgml/python/tests/test.py b/pgml-sdks/pgml/python/tests/test.py
index b7367103a..e6a779c0d 100644
--- a/pgml-sdks/pgml/python/tests/test.py
+++ b/pgml-sdks/pgml/python/tests/test.py
@@ -95,12 +95,16 @@ async def test_can_search():
pipeline = pgml.Pipeline(
"test_p_p_tcs_0",
{
+<<<<<<< Updated upstream
"title": {
"semantic_search": {
"model": "intfloat/e5-small-v2",
"parameters": {"prompt": "passage: "},
}
},
+=======
+ "title": {"semantic_search": {"model": "intfloat/e5-small-v2"}},
+>>>>>>> Stashed changes
"body": {
"splitter": {"model": "recursive_character"},
"semantic_search": {
@@ -148,18 +152,26 @@ async def test_can_vector_search():
"test_p_p_tcvs_0",
{
"title": {
+<<<<<<< Updated upstream
"semantic_search": {
"model": "intfloat/e5-small-v2",
"parameters": {"prompt": "passage: "},
},
+=======
+ "semantic_search": {"model": "intfloat/e5-small-v2"},
+>>>>>>> Stashed changes
"full_text_search": {"configuration": "english"},
},
"text": {
"splitter": {"model": "recursive_character"},
+<<<<<<< Updated upstream
"semantic_search": {
"model": "intfloat/e5-small-v2",
"parameters": {"prompt": "passage: "},
},
+=======
+ "semantic_search": {"model": "intfloat/e5-small-v2"},
+>>>>>>> Stashed changes
},
},
)
diff --git a/pgml-sdks/pgml/src/lib.rs b/pgml-sdks/pgml/src/lib.rs
index 8060e23f1..3e34d348c 100644
--- a/pgml-sdks/pgml/src/lib.rs
+++ b/pgml-sdks/pgml/src/lib.rs
@@ -372,10 +372,14 @@ mod tests {
json!({
"title": {
"semantic_search": {
+<<<<<<< Updated upstream
"model": "intfloat/e5-small-v2",
"parameters": {
"prompt": "passage: "
}
+=======
+ "model": "intfloat/e5-small-v2"
+>>>>>>> Stashed changes
}
},
"body": {
@@ -388,9 +392,12 @@ mod tests {
},
"semantic_search": {
"model": "intfloat/e5-small-v2",
+<<<<<<< Updated upstream
"parameters": {
"prompt": "passage: "
}
+=======
+>>>>>>> Stashed changes
},
"full_text_search": {
"configuration": "english"
@@ -533,10 +540,14 @@ mod tests {
json!({
"title": {
"semantic_search": {
+<<<<<<< Updated upstream
"model": "intfloat/e5-small-v2",
"parameters": {
"prompt": "passage: "
}
+=======
+ "model": "intfloat/e5-small-v2"
+>>>>>>> Stashed changes
}
},
"body": {
@@ -545,9 +556,12 @@ mod tests {
},
"semantic_search": {
"model": "intfloat/e5-small-v2",
+<<<<<<< Updated upstream
"parameters": {
"prompt": "passage: "
}
+=======
+>>>>>>> Stashed changes
},
"full_text_search": {
"configuration": "english"
@@ -619,10 +633,14 @@ mod tests {
json!({
"title": {
"semantic_search": {
+<<<<<<< Updated upstream
"model": "intfloat/e5-small-v2",
"parameters": {
"prompt": "passage: "
}
+=======
+ "model": "intfloat/e5-small-v2"
+>>>>>>> Stashed changes
}
}
})
@@ -667,10 +685,14 @@ mod tests {
json!({
"title": {
"semantic_search": {
+<<<<<<< Updated upstream
"model": "intfloat/e5-small-v2",
"parameters": {
"prompt": "passage: "
}
+=======
+ "model": "intfloat/e5-small-v2"
+>>>>>>> Stashed changes
}
},
"body": {
@@ -679,9 +701,12 @@ mod tests {
},
"semantic_search": {
"model": "intfloat/e5-small-v2",
+<<<<<<< Updated upstream
"parameters": {
"prompt": "passage: "
}
+=======
+>>>>>>> Stashed changes
},
"full_text_search": {
"configuration": "english"
@@ -724,10 +749,14 @@ mod tests {
json!({
"title": {
"semantic_search": {
+<<<<<<< Updated upstream
"model": "intfloat/e5-small-v2",
"parameters": {
"prompt": "passage: "
}
+=======
+ "model": "intfloat/e5-small-v2"
+>>>>>>> Stashed changes
}
},
"body": {
@@ -736,9 +765,12 @@ mod tests {
},
"semantic_search": {
"model": "intfloat/e5-small-v2",
+<<<<<<< Updated upstream
"parameters": {
"prompt": "passage: "
}
+=======
+>>>>>>> Stashed changes
},
"full_text_search": {
"configuration": "english"
@@ -827,10 +859,14 @@ mod tests {
json!({
"title": {
"semantic_search": {
+<<<<<<< Updated upstream
"model": "intfloat/e5-small-v2",
"parameters": {
"prompt": "passage: "
}
+=======
+ "model": "intfloat/e5-small-v2"
+>>>>>>> Stashed changes
},
"full_text_search": {
"configuration": "english"
@@ -939,9 +975,12 @@ mod tests {
"title": {
"semantic_search": {
"model": "intfloat/e5-small-v2",
+<<<<<<< Updated upstream
"parameters": {
"prompt": "passage: "
},
+=======
+>>>>>>> Stashed changes
"hnsw": {
"m": 100,
"ef_construction": 200
@@ -991,10 +1030,14 @@ mod tests {
json!({
"title": {
"semantic_search": {
+<<<<<<< Updated upstream
"model": "intfloat/e5-small-v2",
"parameters": {
"prompt": "passage: "
}
+=======
+ "model": "intfloat/e5-small-v2"
+>>>>>>> Stashed changes
},
"full_text_search": {
"configuration": "english"
@@ -1005,6 +1048,7 @@ mod tests {
"model": "recursive_character"
},
"semantic_search": {
+<<<<<<< Updated upstream
"model": "intfloat/e5-small-v2",
"parameters": {
"prompt": "passage: "
@@ -1015,6 +1059,9 @@ mod tests {
"parameters": {
"prompt": "passage: "
}
+=======
+ "model": "intfloat/e5-small-v2"
+>>>>>>> Stashed changes
},
"full_text_search": {
"configuration": "english"
@@ -1022,10 +1069,14 @@ mod tests {
},
"notes": {
"semantic_search": {
+<<<<<<< Updated upstream
"model": "intfloat/e5-small-v2",
"parameters": {
"prompt": "passage: "
}
+=======
+ "model": "intfloat/e5-small-v2"
+>>>>>>> Stashed changes
}
}
})
@@ -1055,9 +1106,12 @@ mod tests {
},
"body": {
"query": "This is the body test",
+<<<<<<< Updated upstream
"parameters": {
"prompt": "query: ",
},
+=======
+>>>>>>> Stashed changes
"boost": 1.01
},
"notes": {
@@ -1151,10 +1205,14 @@ mod tests {
json!({
"title": {
"semantic_search": {
+<<<<<<< Updated upstream
"model": "intfloat/e5-small-v2",
"parameters": {
"prompt": "passage: "
}
+=======
+ "model": "intfloat/e5-small-v2"
+>>>>>>> Stashed changes
}
},
"body": {
@@ -1239,10 +1297,14 @@ mod tests {
json!({
"title": {
"semantic_search": {
+<<<<<<< Updated upstream
"model": "intfloat/e5-small-v2",
"parameters": {
"prompt": "passage: "
}
+=======
+ "model": "intfloat/e5-small-v2"
+>>>>>>> Stashed changes
},
"full_text_search": {
"configuration": "english"
@@ -1253,10 +1315,14 @@ mod tests {
"model": "recursive_character"
},
"semantic_search": {
+<<<<<<< Updated upstream
"model": "intfloat/e5-small-v2",
"parameters": {
"prompt": "passage: "
}
+=======
+ "model": "intfloat/e5-small-v2"
+>>>>>>> Stashed changes
},
},
})
@@ -1271,9 +1337,12 @@ mod tests {
"fields": {
"title": {
"query": "Test document: 2",
+<<<<<<< Updated upstream
"parameters": {
"prompt": "passage: "
},
+=======
+>>>>>>> Stashed changes
"full_text_filter": "test",
"boost": 1.2
},
@@ -1325,10 +1394,14 @@ mod tests {
json!({
"title": {
"semantic_search": {
+<<<<<<< Updated upstream
"model": "intfloat/e5-small-v2",
"parameters": {
"prompt": "passage: "
}
+=======
+ "model": "intfloat/e5-small-v2"
+>>>>>>> Stashed changes
},
"full_text_search": {
"configuration": "english"
@@ -1396,10 +1469,14 @@ mod tests {
json!({
"text": {
"semantic_search": {
+<<<<<<< Updated upstream
"model": "intfloat/e5-small-v2",
"parameters": {
"prompt": "passage: "
}
+=======
+ "model": "intfloat/e5-small-v2"
+>>>>>>> Stashed changes
},
"full_text_search": {
"configuration": "english"
@@ -2109,10 +2186,14 @@ mod tests {
json!({
"title": {
"semantic_search": {
+<<<<<<< Updated upstream
"model": "intfloat/e5-small-v2",
"parameters": {
"prompt": "passage: "
}
+=======
+ "model": "intfloat/e5-small-v2"
+>>>>>>> Stashed changes
},
"full_text_search": {
"configuration": "english"
@@ -2123,10 +2204,14 @@ mod tests {
"model": "recursive_character"
},
"semantic_search": {
+<<<<<<< Updated upstream
"model": "intfloat/e5-small-v2",
"parameters": {
"prompt": "passage: "
}
+=======
+ "model": "intfloat/e5-small-v2"
+>>>>>>> Stashed changes
},
"full_text_search": {
"configuration": "english"
@@ -2134,10 +2219,14 @@ mod tests {
},
"notes": {
"semantic_search": {
+<<<<<<< Updated upstream
"model": "intfloat/e5-small-v2",
"parameters": {
"prompt": "passage: "
}
+=======
+ "model": "intfloat/e5-small-v2"
+>>>>>>> Stashed changes
}
}
})
diff --git a/pgml-sdks/pgml/src/model.rs b/pgml-sdks/pgml/src/model.rs
index 432654298..7161715f0 100644
--- a/pgml-sdks/pgml/src/model.rs
+++ b/pgml-sdks/pgml/src/model.rs
@@ -70,7 +70,7 @@ impl Default for Model {
impl Model {
//github.com/ Creates a new [Model]
pub fn new(name: Option, source: Option, parameters: Option) -> Self {
- let name = name.unwrap_or("intfloat/e5-small".to_string());
+ let name = name.unwrap_or("intfloat/e5-small-v2".to_string());
let parameters = parameters.unwrap_or(Json(serde_json::json!({})));
let source = source.unwrap_or("pgml".to_string());
let runtime: ModelRuntime = source.as_str().into();
diff --git a/pgml-sdks/pgml/src/open_source_ai.rs b/pgml-sdks/pgml/src/open_source_ai.rs
index f7348ad11..e86d9f9e3 100644
--- a/pgml-sdks/pgml/src/open_source_ai.rs
+++ b/pgml-sdks/pgml/src/open_source_ai.rs
@@ -43,11 +43,11 @@ fn try_model_nice_name_to_model_name_and_parameters(
.into(),
)),
- "HuggingFaceH4/zephyr-7b-beta" => Some((
- "HuggingFaceH4/zephyr-7b-beta",
+ "meta-llama/Meta-Llama-3-8B-Instruct" => Some((
+ "meta-llama/Meta-Llama-3-8B-Instruct",
serde_json::json!({
"task": "conversational",
- "model": "HuggingFaceH4/zephyr-7b-beta",
+ "model": "meta-llama/Meta-Llama-3-8B-Instruct",
"device_map": "auto",
"torch_dtype": "bfloat16"
})
diff --git a/pgml-sdks/pgml/src/sql/remote.sql b/pgml-sdks/pgml/src/sql/remote.sql
index d44b7b84f..e1fae6c17 100644
--- a/pgml-sdks/pgml/src/sql/remote.sql
+++ b/pgml-sdks/pgml/src/sql/remote.sql
@@ -20,12 +20,12 @@
SELECT * FROM dblink(
'{db_name}',
- 'SELECT pgml.embed(''intfloat/e5-small'', ''test postgresml embedding'') AS embedding'
+ 'SELECT pgml.embed(''intfloat/e5-small-v2'', ''test postgresml embedding'') AS embedding'
) AS t(embedding real[386]);
CREATE FUNCTION pgml_embed_e5_small(text) RETURNS real[386] AS $$
SELECT * FROM dblink(
'{db_name}',
- 'SELECT pgml.embed(''intfloat/e5-small'', ''' || $1 || ''') AS embedding'
+ 'SELECT pgml.embed(''intfloat/e5-small-v2'', ''' || $1 || ''') AS embedding'
) AS t(embedding real[386]);
$$ LANGUAGE SQL;
--- a PPN by Garber Painting Akron. With Image Size Reduction included!Fetched URL: http://github.com/postgresml/postgresml/pull/1481.diff
Alternative Proxies:
Alternative Proxy
pFad Proxy
pFad v3 Proxy
pFad v4 Proxy