Skip to content
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
a31ecae
switch to api_base
gotsysdba Aug 27, 2025
8c0cfda
starting unit tests
gotsysdba Aug 27, 2025
1ce73b8
remove unused import
gotsysdba Aug 27, 2025
bd23d08
starting litellm client
gotsysdba Aug 27, 2025
2fb3dc7
dedupe code
gotsysdba Aug 27, 2025
0dd2392
Switched to LiteLLM
gotsysdba Aug 29, 2025
d1358c6
history and streaming
gotsysdba Aug 29, 2025
eba62b0
litellm_config
gotsysdba Aug 29, 2025
62166f1
Prompts
gotsysdba Aug 29, 2025
41498a8
All but SelectAI
gotsysdba Aug 31, 2025
94764de
Workaround for XAI
gotsysdba Aug 31, 2025
6ffe0a7
SelectAI
gotsysdba Aug 31, 2025
f52e669
Linting
gotsysdba Aug 31, 2025
9c56976
Linting
gotsysdba Aug 31, 2025
6628389
Update Tests
gotsysdba Sep 1, 2025
db9f63e
removed cyclic import on databases
gotsysdba Sep 1, 2025
d61c987
Merge remote-tracking branch 'origin/main' into 98-shift-to-litellm
gotsysdba Sep 1, 2025
7bfa827
resolve oci cyclic imports
gotsysdba Sep 1, 2025
325871e
Update SpringAI
gotsysdba Sep 1, 2025
7b70525
bump versions
gotsysdba Sep 1, 2025
1e47c94
Fix tests
gotsysdba Sep 1, 2025
ce5d07a
Resolves @cjbj conversation
gotsysdba Sep 2, 2025
7b1e703
Linted OpenTofu
gotsysdba Sep 2, 2025
78e7c2c
IaC Updates
gotsysdba Sep 2, 2025
9c5a820
Updates for instance principals
gotsysdba Sep 2, 2025
a9e5be2
Update IAM for instance principals
gotsysdba Sep 2, 2025
c0661c2
Merge remote-tracking branch 'origin/main' into 98-shift-to-litellm
gotsysdba Sep 2, 2025
84afaa2
Fix after merge
gotsysdba Sep 2, 2025
90a6130
fix vllm support
corradodebari Sep 2, 2025
6cd5f67
LangChain MCP template fix
corradodebari Sep 2, 2025
d29b701
API Server Control
gotsysdba Sep 2, 2025
488af6b
add hosted_vllm
gotsysdba Sep 2, 2025
87e76b1
Fix Tests
gotsysdba Sep 2, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
647 changes: 647 additions & 0 deletions .pylintrc

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions opentofu/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ resource "oci_database_autonomous_database" "default_adb" {
module "vm" {
count = var.infrastructure == "VM" ? 1 : 0
source = "./modules/vm"
optimizer_version = var.optimizer_version
label_prefix = local.label_prefix
tenancy_id = var.tenancy_ocid
compartment_id = local.compartment_ocid
Expand Down
4 changes: 4 additions & 0 deletions opentofu/modules/vm/iam.tf
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ resource "oci_identity_policy" "identity_node_policies" {
"allow dynamic-group %s to read objects in compartment id %s",
oci_identity_dynamic_group.compute_dynamic_group.name, var.compartment_id
),
format(
"allow dynamic-group %s to use generative-ai-family in compartment id %s",
oci_identity_dynamic_group.compute_dynamic_group.name, var.compartment_id
),
]
provider = oci.home_region
}
13 changes: 7 additions & 6 deletions opentofu/modules/vm/locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@

locals {
cloud_init_compute = templatefile("${path.module}/templates/cloudinit-compute.tpl", {
tenancy_id = var.tenancy_id
compartment_id = var.compartment_id
oci_region = var.region
db_name = var.adb_name
db_password = var.adb_password
install_ollama = var.vm_is_gpu_shape ? true : false
tenancy_id = var.tenancy_id
compartment_id = var.compartment_id
oci_region = var.region
db_name = var.adb_name
db_password = var.adb_password
optimizer_version = var.optimizer_version
install_ollama = var.vm_is_gpu_shape ? true : false
})

cloud_init_database = templatefile("${path.module}/templates/cloudinit-database.tpl", {
Expand Down
11 changes: 7 additions & 4 deletions opentofu/modules/vm/templates/cloudinit-compute.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,14 @@ write_files:
permissions: '0755'
content: |
#!/bin/bash
# Setup for Instance Principles

# Download/Setup Source Code
curl -L https://github.com/oracle/ai-optimizer/releases/latest/download/ai-optimizer-src.tar.gz \
| tar -xz -C /app
if [ "${optimizer_version}" = "main" ]; then
URL="https://github.com/oracle/ai-optimizer/archive/refs/heads/main.tar.gz"
curl -L "$URL" | tar -xz -C /app --strip-components=2 ai-optimizer-main/src
else
URL="https://github.com/oracle/ai-optimizer/releases/latest/download/ai-optimizer-src.tar.gz"
curl -L "$URL" | tar -xz -C /app
fi
cd /app
python3.11 -m venv .venv
source .venv/bin/activate
Expand Down
4 changes: 4 additions & 0 deletions opentofu/modules/vm/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
# All rights reserved. The Universal Permissive License (UPL), Version 1.0 as shown at http://oss.oracle.com/licenses/upl
# spell-checker: disable

variable "optimizer_version" {
type = string
}

variable "tenancy_id" {
type = string
}
Expand Down
1 change: 1 addition & 0 deletions opentofu/schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ variableGroups:

- title: "Hidden (Defaults)"
variables:
- optimizer_version
- adb_version
- k8s_run_cfgmgt
visible: false
Expand Down
10 changes: 10 additions & 0 deletions opentofu/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@
# spell-checker: disable

// Standard Default Vars
variable "optimizer_version" {
description = "Determines if latest release or main is used"
type = string
default = "latest"
validation {
condition = var.optimizer_version == "latest" || var.optimizer_version == "main"
error_message = "optimizer_version must be either 'latest' or 'main'."
}
}

variable "tenancy_ocid" {
description = "The Tenancy ID of the OCI Cloud Account in which to create the resources."
type = string
Expand Down
17 changes: 7 additions & 10 deletions src/client/content/api_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,15 @@
import streamlit as st
from streamlit import session_state as state

import client.utils.client as client
import client.utils.api_call as api_call
import common.logging_config as logging_config
from client.utils import client, api_call
from common import logging_config

logger = logging_config.logging.getLogger("client.content.api_server")

try:
import launch_server

REMOTE_SERVER = False
except ImportError:
REMOTE_SERVER = True
pass


#####################################################
Expand Down Expand Up @@ -53,7 +50,7 @@ def server_restart() -> None:
state.server["key"] = os.getenv("API_SERVER_KEY")

launch_server.stop_server(state.server["pid"])
state.server["pid"] = launch_server.start_server(state.server["port"])
_, state.server["pid"] = launch_server.start_server(state.server["port"])
time.sleep(10)
state.pop("server_client", None)

Expand All @@ -72,16 +69,16 @@ async def main() -> None:
key="user_server_port",
min_value=1,
max_value=65535,
disabled=REMOTE_SERVER,
disabled=state.server["remote"],
)
right.text_input(
"API Server Key:",
value=state.server["key"],
key="user_server_key",
type="password",
disabled=REMOTE_SERVER,
disabled=state.server["remote"],
)
if not REMOTE_SERVER:
if not state.server["remote"]:
st.button("Restart Server", type="primary", on_click=server_restart)

st.header("Server Settings", divider="red")
Expand Down
16 changes: 3 additions & 13 deletions src/client/content/chatbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,9 @@
from streamlit import session_state as state

from client.content.config.tabs.models import get_models

import client.utils.st_common as st_common
import client.utils.api_call as api_call

from client.utils import st_common, api_call, client
from client.utils.st_footer import render_chat_footer
import client.utils.client as client
import common.logging_config as logging_config
from common import logging_config

logger = logging_config.logging.getLogger("client.content.chatbot")

Expand Down Expand Up @@ -143,13 +139,7 @@ async def main() -> None:
# Stream until we hit the end then refresh to replace with history
st.rerun()
except Exception:
logger.error("Exception:", exc_info=1)
st.chat_message("ai").write(
"""
I'm sorry, something's gone wrong. Please try again.
If the problem persists, please raise an issue.
"""
)
message_placeholder.markdown("An unexpected error occurred, please retry your request.")
if st.button("Retry", key="reload_chatbot"):
st_common.clear_state_key("user_client")
st.rerun()
Expand Down
17 changes: 10 additions & 7 deletions src/client/content/config/tabs/databases.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,25 @@
import streamlit as st
from streamlit import session_state as state

import client.utils.api_call as api_call
import client.utils.st_common as st_common

import common.logging_config as logging_config
from client.utils import api_call, st_common
from common import logging_config

logger = logging_config.logging.getLogger("client.content.config.tabs.database")


#####################################################
# Functions
#####################################################
def get_databases(force: bool = False) -> None:
def get_databases(validate: bool = False, force: bool = False) -> None:
"""Get Databases from API Server"""
if force or "database_configs" not in state or not state.database_configs:
try:
logger.info("Refreshing state.database_configs")
# Validation will be done on currently configured client database
# validation includes new vector_stores, etc.
if validate:
client_database = state.client_settings.get("database", {}).get("alias", {})
_ = api_call.get(endpoint=f"v1/databases/{client_database}")
state.database_configs = api_call.get(endpoint="v1/databases")
except api_call.ApiError as ex:
logger.error("Unable to populate state.database_configs: %s", ex)
Expand Down Expand Up @@ -63,7 +66,7 @@ def patch_database(name: str, supplied: dict, connected: bool) -> bool:
def drop_vs(vs: dict) -> None:
"""Drop a Vector Storage Table"""
api_call.delete(endpoint=f"v1/embed/{vs['vector_store']}")
get_databases(force=True)
get_databases(validate=True, force=True)


def select_ai_profile() -> None:
Expand Down Expand Up @@ -221,7 +224,7 @@ def display_databases() -> None:
column_config={
"enabled": st.column_config.CheckboxColumn(label="Enabled", help="Toggle to enable or disable")
},
use_container_width=True,
width="stretch",
hide_index=True,
)
if st.button("Apply SelectAI Changes", type="secondary"):
Expand Down
Loading