Skip to content

Commit ce08702

Browse files
committed
correctly filter default model
1 parent 1cd1446 commit ce08702

34 files changed

+796
-759
lines changed

clients/python/src/jamaibase/protocol.py

Lines changed: 7 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1719,46 +1719,27 @@ class ActionTableSchemaCreate(TableSchemaCreate):
17191719

17201720

17211721
class AddActionColumnSchema(ActionTableSchemaCreate):
1722+
# TODO: Deprecate this
17221723
pass
17231724

17241725

17251726
class KnowledgeTableSchemaCreate(TableSchemaCreate):
1727+
# TODO: Maybe deprecate this and use EmbedGenConfig instead ?
17261728
embedding_model: str
17271729

1728-
@model_validator(mode="after")
1729-
def check_cols(self) -> Self:
1730-
super().check_cols()
1731-
num_text_cols = sum(c.id.lower() in ("text", "title", "file id") for c in self.cols)
1732-
if num_text_cols != 0:
1733-
raise ValueError("Schema cannot contain column names: 'Text', 'Title', 'File ID'.")
1734-
return self
1735-
17361730

17371731
class AddKnowledgeColumnSchema(TableSchemaCreate):
1738-
@model_validator(mode="after")
1739-
def check_cols(self) -> Self:
1740-
super().check_cols()
1741-
num_text_cols = sum(c.id.lower() in ("text", "title", "file id") for c in self.cols)
1742-
if num_text_cols != 0:
1743-
raise ValueError("Schema cannot contain column names: 'Text', 'Title', 'File ID'.")
1744-
return self
1732+
# TODO: Deprecate this
1733+
pass
17451734

17461735

17471736
class ChatTableSchemaCreate(TableSchemaCreate):
1748-
@model_validator(mode="after")
1749-
def check_cols(self) -> Self:
1750-
super().check_cols()
1751-
num_text_cols = sum(c.id.lower() in ("user", "ai") for c in self.cols)
1752-
if num_text_cols != 2:
1753-
raise ValueError("Schema must contain column names: 'User' and 'AI'.")
1754-
return self
1737+
pass
17551738

17561739

17571740
class AddChatColumnSchema(TableSchemaCreate):
1758-
@model_validator(mode="after")
1759-
def check_cols(self) -> Self:
1760-
super().check_cols()
1761-
return self
1741+
# TODO: Deprecate this
1742+
pass
17621743

17631744

17641745
class TableMeta(TableBase):

clients/python/tests/oss/gen_table/test_table_ops.py

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"str": '"Arrival" is a 2016 science fiction film. "Arrival" è un film di fantascienza del 2016. 「Arrival」は2016年のSF映画です。',
2222
}
2323
KT_FIXED_COLUMN_IDS = ["Title", "Title Embed", "Text", "Text Embed", "File ID"]
24+
CT_FIXED_COLUMN_IDS = ["User"]
2425

2526
TABLE_ID_A = "table_a"
2627
TABLE_ID_B = "table_b"
@@ -1430,6 +1431,21 @@ def test_kt_drop_invalid_columns(client_cls: Type[JamAI]):
14301431
)
14311432

14321433

1434+
@flaky(max_runs=5, min_passes=1, rerun_filter=_rerun_on_fs_error_with_delay)
1435+
@pytest.mark.parametrize("client_cls", CLIENT_CLS)
1436+
def test_ct_drop_invalid_columns(client_cls: Type[JamAI]):
1437+
table_type = "chat"
1438+
jamai = client_cls()
1439+
with _create_table(jamai, table_type) as table:
1440+
assert isinstance(table, p.TableMetaResponse)
1441+
for col in CT_FIXED_COLUMN_IDS:
1442+
with pytest.raises(RuntimeError):
1443+
jamai.table.drop_columns(
1444+
table_type,
1445+
p.ColumnDropRequest(table_id=table.id, column_names=[col]),
1446+
)
1447+
1448+
14331449
@flaky(max_runs=5, min_passes=1, rerun_filter=_rerun_on_fs_error_with_delay)
14341450
@pytest.mark.parametrize("client_cls", CLIENT_CLS)
14351451
@pytest.mark.parametrize("table_type", TABLE_TYPES)
@@ -1450,7 +1466,7 @@ def test_rename_columns(
14501466
assert isinstance(table, p.TableMetaResponse)
14511467
assert all(isinstance(c, p.ColumnSchema) for c in table.cols)
14521468
# Test rename on empty table
1453-
table = jamai.rename_columns(
1469+
table = jamai.table.rename_columns(
14541470
table_type,
14551471
p.ColumnRenameRequest(table_id=table.id, column_map=dict(y="z")),
14561472
)
@@ -1475,7 +1491,7 @@ def test_rename_columns(
14751491
_add_row(jamai, table_type, False, data=dict(x="True", z="<dummy>"))
14761492
# Test rename table with data
14771493
# Test also auto gen config reference update
1478-
table = jamai.rename_columns(
1494+
table = jamai.table.rename_columns(
14791495
table_type,
14801496
p.ColumnRenameRequest(table_id=table.id, column_map=dict(x="a")),
14811497
)
@@ -1503,14 +1519,14 @@ def test_rename_columns(
15031519

15041520
# Repeated new column names
15051521
with pytest.raises(RuntimeError):
1506-
jamai.rename_columns(
1522+
jamai.table.rename_columns(
15071523
table_type,
15081524
p.ColumnRenameRequest(table_id=table.id, column_map=dict(a="b", z="b")),
15091525
)
15101526

15111527
# Overlapping new and old column names
15121528
with pytest.raises(RuntimeError):
1513-
jamai.rename_columns(
1529+
jamai.table.rename_columns(
15141530
table_type,
15151531
p.ColumnRenameRequest(table_id=table.id, column_map=dict(a="b", z="a")),
15161532
)
@@ -1525,7 +1541,22 @@ def test_kt_rename_invalid_columns(client_cls: Type[JamAI]):
15251541
assert isinstance(table, p.TableMetaResponse)
15261542
for col in KT_FIXED_COLUMN_IDS:
15271543
with pytest.raises(RuntimeError):
1528-
jamai.rename_columns(
1544+
jamai.table.rename_columns(
1545+
table_type,
1546+
p.ColumnRenameRequest(table_id=table.id, column_map={col: col}),
1547+
)
1548+
1549+
1550+
@flaky(max_runs=5, min_passes=1, rerun_filter=_rerun_on_fs_error_with_delay)
1551+
@pytest.mark.parametrize("client_cls", CLIENT_CLS)
1552+
def test_ct_rename_invalid_columns(client_cls: Type[JamAI]):
1553+
table_type = "chat"
1554+
jamai = client_cls()
1555+
with _create_table(jamai, table_type) as table:
1556+
assert isinstance(table, p.TableMetaResponse)
1557+
for col in CT_FIXED_COLUMN_IDS:
1558+
with pytest.raises(RuntimeError):
1559+
jamai.table.rename_columns(
15291560
table_type,
15301561
p.ColumnRenameRequest(table_id=table.id, column_map={col: col}),
15311562
)
@@ -1582,7 +1613,7 @@ def test_reorder_columns(
15821613
cols = [c.id for c in table.cols]
15831614
assert cols == expected_order, cols
15841615
# Test reorder empty table
1585-
table = jamai.reorder_columns(
1616+
table = jamai.table.reorder_columns(
15861617
table_type,
15871618
p.ColumnReorderRequest(table_id=TABLE_ID_A, column_names=column_names),
15881619
)
@@ -1692,7 +1723,7 @@ def test_reorder_columns_invalid(
16921723
else:
16931724
raise ValueError(f"Invalid table type: {table_type}")
16941725
with pytest.raises(RuntimeError, match="referenced an invalid source column"):
1695-
jamai.reorder_columns(
1726+
jamai.table.reorder_columns(
16961727
table_type,
16971728
p.ColumnReorderRequest(table_id=TABLE_ID_A, column_names=column_names),
16981729
)

scripts/remove_cloud_modules.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@ function quiet_rm($item)
1919
quiet_rm "services/app/ecosystem.config.cjs"
2020
quiet_rm "services/appecosystem.json"
2121
quiet_rm ".github/workflows/trigger-push-gh-image.yml"
22+
quiet_rm ".github/workflows/ci.cloud.yml"

scripts/remove_cloud_modules.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ find . -type d -name "(cloud)" -exec rm -rf {} +
99
rm -f services/app/ecosystem.config.cjs
1010
rm -f services/app/ecosystem.json
1111
rm -f .github/workflows/trigger-push-gh-image.yml
12+
rm -f .github/workflows/ci.cloud.yml

services/api/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ dependencies = [
132132
"sqlmodel~=0.0.21",
133133
"srsly~=2.4.8",
134134
# starlette 0.38.3 and 0.38.4 seem to have issues with background tasks
135-
"starlette==0.38.2",
135+
"starlette~=0.41.3",
136136
"stripe~=9.12.0",
137137
"tantivy~=0.22.0",
138138
"tenacity~=8.5.0",

services/api/src/owl/configs/models.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
"id": "ellm/BAAI/bge-small-en-v1.5",
4949
"name": "ELLM BAAI BGE Small EN v1.5",
5050
"context_length": 512,
51-
"embedding_size": 1024,
51+
"embedding_size": 384,
5252
"languages": ["mul"],
5353
"capabilities": ["embed"],
5454
"deployments": [

services/api/src/owl/configs/models_aipc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@
132132
"id": "ellm/BAAI/bge-small-en-v1.5",
133133
"name": "ELLM BAAI BGE Small EN v1.5",
134134
"context_length": 512,
135-
"embedding_size": 1024,
135+
"embedding_size": 384,
136136
"languages": ["mul"],
137137
"capabilities": ["embed"],
138138
"deployments": [

services/api/src/owl/configs/models_ollama.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
"id": "ellm/BAAI/bge-small-en-v1.5",
6363
"name": "ELLM BAAI BGE Small EN v1.5",
6464
"context_length": 512,
65-
"embedding_size": 1024,
65+
"embedding_size": 384,
6666
"languages": ["mul"],
6767
"capabilities": ["embed"],
6868
"deployments": [

0 commit comments

Comments
 (0)