Skip to content

Commit

Permalink
a few fixes (#98)
Browse files Browse the repository at this point in the history
* fix things up to work in docker-compose and postgres

* remove some extraneous logging

* Update 9_create_session.up.sql

* fix sidebar

* spotless formatting

* "don't spam logs if you can't figure out if we need to update or not"

* Update release version to dev-testing

* fix not displaying chunk data correctly

---------

Co-authored-by: ewilliams-cloudera <[email protected]>
Co-authored-by: actions-user <[email protected]>
  • Loading branch information
3 people authored Jan 9, 2025
1 parent c61fcca commit 2cd64c8
Show file tree
Hide file tree
Showing 20 changed files with 29 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ public RagFileUploader ragFileUploader(S3Config configuration) {
}

public static String getRagIndexUrl() {
return Optional.ofNullable(System.getenv("LLM_SERVICE_URL")).orElse("http://localhost:8000");
var llmServiceUrl =
Optional.ofNullable(System.getenv("LLM_SERVICE_URL")).orElse("http://localhost:8000");
log.info("LLM Service URL: {}", llmServiceUrl);
return llmServiceUrl;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@
* DATA.
*/

SET MODE MYSQL;

BEGIN;

ALTER TABLE RAG_DATA_SOURCE_DOCUMENT DROP COLUMN summary_creation_timestamp;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@
* DATA.
*/

SET MODE MYSQL;

BEGIN;

ALTER TABLE RAG_DATA_SOURCE_DOCUMENT ADD COLUMN summary_creation_timestamp TIMESTAMP NULL;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@
* DATA.
*/

SET MODE MYSQL;

BEGIN;

ALTER TABLE chat_session DROP COLUMN deleted;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@
* DATA.
*/

SET MODE MYSQL;

BEGIN;

ALTER TABLE chat_session ADD COLUMN deleted boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@
* DATA.
*/

SET MODE MYSQL;

BEGIN;

ALTER TABLE CHAT_SESSION DROP COLUMN inference_model;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@
* DATA.
*/

SET MODE MYSQL;

BEGIN;

ALTER TABLE CHAT_SESSION ADD COLUMN inference_model VARCHAR(255);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@
* DATA.
*/

SET MODE MYSQL;

BEGIN;

ALTER TABLE rag_data_source DROP COLUMN embedding_model;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@
* DATA.
*/

SET MODE MYSQL;

BEGIN;

ALTER TABLE rag_data_source ADD COLUMN embedding_model varchar(255);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,8 @@
* DATA.
*/

SET MODE MYSQL;

BEGIN;

ALTER TABLE rag_data_source DROP COLUMN embedding_model;
ALTER TABLE rag_data_source DROP COLUMN summarization_model;

COMMIT;
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,8 @@
* DATA.
*/

SET MODE MYSQL;

BEGIN;

ALTER TABLE rag_data_source ADD COLUMN embedding_model varchar(255);
ALTER TABLE rag_data_source ADD COLUMN summarization_model varchar(255);

COMMIT;
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@
* DATA.
*/

SET MODE MYSQL;

BEGIN;

ALTER TABLE RAG_DATA_SOURCE_DOCUMENT DROP COLUMN indexing_status;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@
* DATA.
*/

SET MODE MYSQL;

BEGIN;

ALTER TABLE RAG_DATA_SOURCE_DOCUMENT ADD COLUMN indexing_status VARCHAR(255) NULL;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,14 @@ CREATE TABLE chat_session
time_updated TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
created_by_id VARCHAR(255) NOT NULL,
updated_by_id VARCHAR(255) NOT NULL,
last_interaction_time BIGINT NULL,
CONSTRAINT PK_chat_session PRIMARY KEY (id)
last_interaction_time BIGINT NULL
);

CREATE TABLE chat_session_data_source
(
id SERIAL PRIMARY KEY,
chat_session_id BIGINT NOT NULL,
data_source_id BIGINT NOT NULL,
CONSTRAINT PK_chat_session_ds PRIMARY KEY (id)
data_source_id BIGINT NOT NULL
);

COMMIT;
COMMIT;
6 changes: 3 additions & 3 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ services:
- OTEL_TRACES_EXPORTER=otlp
- OTEL_PROPAGATORS=tracecontext
- S3_RAG_DOCUMENT_BUCKET=cloudera-ai-rag-dev-us-west-2
- RAG_BACKEND_URL=http://rag-backend:8000
- LLM_SERVICE_URL=http://rag-backend:8000
- AWS_DEFAULT_REGION=us-west-2
- AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}
- AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}
Expand Down Expand Up @@ -50,9 +50,9 @@ services:
- AWS_DEFAULT_REGION=us-west-2
- AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}
- AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}
- OTEL_EXPORTER_OTLP_ENDPOINT=http://tempo:4318
- OTEL_SEMCONV_STABILITY_OPT_IN=http
- S3_RAG_DOCUMENT_BUCKET=cloudera-ai-rag-dev-us-west-2
- QDRANT_HOST=qdrant
- API_URL=http://api:8080
depends_on:
- qdrant
db:
Expand Down
8 changes: 6 additions & 2 deletions llm-service/app/routers/index/amp_metadata/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
from fastapi import APIRouter
from subprocess import CompletedProcess
from .... import exceptions
from ....services.amp_update import check_amp_update_status
from ....services.amp_update import does_amp_need_updating

router = APIRouter(prefix="/amp-update", tags=["AMP Update"])

Expand All @@ -51,7 +51,11 @@
@router.get("", summary="Returns a boolean for whether AMP needs updating.")
@exceptions.propagates
def amp_up_to_date_status() -> bool:
return check_amp_update_status()
# noinspection PyBroadException
try:
return does_amp_need_updating()
except Exception:
return False


@router.post("", summary="Updates AMP.")
Expand Down
5 changes: 3 additions & 2 deletions llm-service/app/services/amp_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,9 @@ def check_if_ahead_or_behind(current_hash: str, current_branch: str) -> tuple[in
)


def check_amp_update_status() -> bool:
"""Check if the AMP is up-to-date."""
def does_amp_need_updating() -> bool:
"""Check if the AMP is up-to-date. Returns True if the AMP needs updating."""

# Retrieve the current branch only once
current_branch = (
subprocess.check_output(["git", "rev-parse", "--abbrev-ref", "HEAD"])
Expand Down
2 changes: 1 addition & 1 deletion scripts/release_version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export RELEASE_TAG=1.6.0-beta
export RELEASE_TAG=dev-testing
7 changes: 6 additions & 1 deletion ui/src/layout/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,12 @@ const Sidebar: React.FC = () => {
onCollapse={(value) => {
setCollapsed(value);
}}
style={{ transition: "none", height: "100vh" }}
style={{
transition: "none",
height: "100vh",
top: 0,
position: "sticky",
}}
width={250}
ref={ref}
>
Expand Down
2 changes: 1 addition & 1 deletion ui/src/pages/RagChatTab/ChatOutput/Sources/SourceCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ export const SourceCard = ({ source }: { source: SourceNode }) => {
<Typography.Paragraph
style={{ textAlign: "left", whiteSpace: "pre-wrap" }}
>
chunkContents.data.text
{chunkContents.data.text}
</Typography.Paragraph>
)}
<MetaData metadata={chunkContents.data.metadata} />
Expand Down

0 comments on commit 2cd64c8

Please sign in to comment.