Skip to content

Commit 5c3df39

Browse files
Fix embedding size and correctly filter default models (#31)
* correctly filter default model * minor typing fix * fix chat mode streaming with non-multiturn columns * minor fix to ollama model, update to qwen2.5 3B * update changelog --------- Co-authored-by: deafnv <[email protected]>
1 parent b144455 commit 5c3df39

36 files changed

+827
-768
lines changed

CHANGELOG.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,25 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
1414

1515
- The version number mentioned here refers to the cloud version. For each release, all SDKs will have the same major and minor version, but their patch version may differ. For example, latest Python SDK might be `v0.2.0` whereas TS SDK might be `v0.2.1`, but both will be compatible with release `v0.2`.
1616

17+
## [Unreleased]
18+
19+
Backend - owl (API server)
20+
21+
- Fix bge-small embedding size (1024 -> 384)
22+
- Correctly filter models at auth level
23+
- Fix ollama model deployment config
24+
25+
Frontend
26+
27+
- Added support for multiple multiturn columns in Chat table chat view.
28+
- Added multiturn chat toggle to column settings.
29+
30+
Docker
31+
32+
- Added Mac Apple Silicon `compose.mac.yml`
33+
- Update `ollama.yml` to use Qwen2.5 3B
34+
- Fix ollama default config
35+
1736
## [v0.3.1] (2024-11-26)
1837

1938
This is a bug fix release for frontend code. SDKs are not affected.

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
)

docker/compose.cpu.ollama.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ services:
2929
echo 'ollama serve did not start in time'; \
3030
exit 1; \
3131
fi; \
32-
ollama pull phi3.5 && ollama cp phi3.5 microsoft/Phi3.5-mini-instruct; \
32+
ollama pull qwen2.5:3b && ollama cp qwen2.5:3b Qwen/Qwen2.5-3B-Instruct; \
3333
tail -f /dev/null",
3434
]
3535
restart: unless-stopped
3636
healthcheck:
37-
test: ["CMD", "sh", "-c", "ollama show microsoft/Phi3.5-mini-instruct || exit 1"]
37+
test: ["CMD", "sh", "-c", "ollama show Qwen/Qwen2.5-3B-Instruct || exit 1"]
3838
interval: 20s
3939
timeout: 2s
4040
retries: 20

docker/ollama.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
services:
22
owl:
33
environment:
4-
- OWL_MODELS_CONFIG="models_ollama.json"
4+
- OWL_MODELS_CONFIG=models_ollama.json

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_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: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,15 @@
4343
]
4444
},
4545
{
46-
"id": "ellm/microsoft/Phi3.5-mini-instruct",
47-
"name": "ELLM Phi3.5 mini instruct (3.8B)",
48-
"context_length": 131072,
46+
"id": "ellm/Qwen/Qwen2.5-3B-Instruct",
47+
"name": "ELLM Qwen2.5 (3B)",
48+
"context_length": 32000,
4949
"languages": ["en"],
5050
"capabilities": ["chat"],
5151
"deployments": [
5252
{
53-
"litellm_id": "ollama_chat/microsoft/Phi3.5-mini-instruct",
54-
"api_base": "http://ollama:11434",
53+
"litellm_id": "openai/Qwen/Qwen2.5-3B-Instruct",
54+
"api_base": "http://ollama:11434/v1",
5555
"provider": "ellm"
5656
}
5757
]
@@ -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)