Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commiteafc5b8

Browse files
authored
Fixed postgres floating point type (#952)
1 parent0b84746 commiteafc5b8

File tree

3 files changed

+32
-19
lines changed

3 files changed

+32
-19
lines changed

‎pgml-sdks/rust/pgml/javascript/tests/typescript-tests/test.ts‎

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ const generate_dummy_documents = (count: number) => {
1818
docs.push({
1919
id:i,
2020
text:`This is a test document:${i}`,
21+
project:"a10",
2122
uuid:i*10,
23+
floating_uuid:i*1.1,
2224
name:`Test Document${i}`,
2325
});
2426
}
@@ -36,7 +38,7 @@ it("can create collection", () => {
3638

3739
it("can create model",()=>{
3840
letmodel=pgml.newModel("test","openai",{
39-
"tester":"test 0123948712394871234987"
41+
some_example_parameter:"test 0123948712394871234987",
4042
});
4143
expect(model).toBeTruthy();
4244
});
@@ -74,7 +76,7 @@ it("can vector search with local embeddings", async () => {
7476
awaitcollection.archive();
7577
});
7678

77-
it("can vector search with remote embeddings",async()=>{
79+
it("can vector search with remote embeddings",async()=>{
7880
letmodel=pgml.newModel("text-embedding-ada-002","openai");
7981
letsplitter=pgml.newSplitter();
8082
letpipeline=pgml.newPipeline("test_j_p_cvswre_0",model,splitter);
@@ -86,26 +88,34 @@ it("can vector search with remote embeddings", async() => {
8688
awaitcollection.archive();
8789
});
8890

89-
it("can vector search with query builder",async()=>{
91+
it("can vector search with query builder",async()=>{
9092
letmodel=pgml.newModel();
9193
letsplitter=pgml.newSplitter();
9294
letpipeline=pgml.newPipeline("test_j_p_cvswqb_0",model,splitter);
9395
letcollection=pgml.newCollection("test_j_c_cvswqb_1");
9496
awaitcollection.upsert_documents(generate_dummy_documents(3));
9597
awaitcollection.add_pipeline(pipeline);
96-
letresults=awaitcollection.query().vector_recall("Here is some query",pipeline).limit(10).fetch_all();
98+
letresults=awaitcollection
99+
.query()
100+
.vector_recall("Here is some query",pipeline)
101+
.limit(10)
102+
.fetch_all();
97103
expect(results).toHaveLength(3);
98104
awaitcollection.archive();
99105
});
100106

101-
it("can vector search with query builder with remote embeddings",async()=>{
107+
it("can vector search with query builder with remote embeddings",async()=>{
102108
letmodel=pgml.newModel("text-embedding-ada-002","openai");
103109
letsplitter=pgml.newSplitter();
104110
letpipeline=pgml.newPipeline("test_j_p_cvswqbwre_0",model,splitter);
105111
letcollection=pgml.newCollection("test_j_c_cvswqbwre_1");
106112
awaitcollection.upsert_documents(generate_dummy_documents(3));
107113
awaitcollection.add_pipeline(pipeline);
108-
letresults=awaitcollection.query().vector_recall("Here is some query",pipeline).limit(10).fetch_all();
114+
letresults=awaitcollection
115+
.query()
116+
.vector_recall("Here is some query",pipeline)
117+
.limit(10)
118+
.fetch_all();
109119
expect(results).toHaveLength(3);
110120
awaitcollection.archive();
111121
});
@@ -122,10 +132,12 @@ it("can vector search with query builder and metadata filtering", async () => {
122132
.vector_recall("Here is some query",pipeline)
123133
.filter({
124134
metadata:{
125-
$or:[{uuid:{$eq:0}},{uuid:{$eq:20}}],
135+
$or:[{uuid:{$eq:0}},{floating_uuid:{$lt:2}}],
136+
project:{$eq:"a10"},
126137
},
127138
})
128-
.limit(10).fetch_all();
139+
.limit(10)
140+
.fetch_all();
129141
expect(results).toHaveLength(2);
130142
awaitcollection.archive();
131143
});
@@ -141,7 +153,6 @@ it("pipeline to dict", async () => {
141153
letcollection=pgml.newCollection("test_j_c_ptd_2");
142154
awaitcollection.add_pipeline(pipeline);
143155
letpipeline_dict=awaitpipeline.to_dict();
144-
console.log(JSON.stringify(pipeline_dict))
145156
expect(pipeline_dict["name"]).toBe("test_j_p_ptd_0");
146157
awaitcollection.archive();
147158
});

‎pgml-sdks/rust/pgml/python/tests/test.py‎

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ def generate_dummy_documents(count: int) -> List[Dict[str, Any]]:
2929
{
3030
"id":i,
3131
"text":"This is a test document: {}".format(i),
32-
"some_random_thing":"This will be metadata on it",
32+
"project":"a10",
33+
"floating_uuid":i*1.01,
3334
"uuid":i*10,
3435
"name":"Test Document {}".format(i),
3536
}
@@ -147,17 +148,18 @@ async def test_can_vector_search_with_query_builder_and_metadata_filtering():
147148
results= (
148149
awaitcollection.query()
149150
.vector_recall("Here is some query",pipeline)
150-
.filter({
151-
"metadata": {
152-
"uuid": {
153-
"$eq":0
154-
}
151+
.filter(
152+
{
153+
"metadata": {
154+
"$or": [{"uuid": {"$eq":0}}, {"floating_uuid": {"$lt":2}}],
155+
"project": {"$eq":"a10"},
156+
},
155157
}
156-
})
158+
)
157159
.limit(10)
158160
.fetch_all()
159161
)
160-
assertlen(results)==1
162+
assertlen(results)==2
161163
awaitcollection.archive()
162164

163165

‎pgml-sdks/rust/pgml/src/filter_builder.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,9 @@ fn get_value_type(value: &serde_json::Value) -> String {
117117
}elseif value.is_string(){
118118
"text".to_string()
119119
}elseif value.is_i64(){
120-
"bigint".to_string()
120+
"float8".to_string()
121121
}elseif value.is_f64(){
122-
"double".to_string()
122+
"float8".to_string()
123123
}elseif value.is_boolean(){
124124
"bool".to_string()
125125
}else{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp