Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ For more information, including more details on **Setup and Configuration** plea

#### Bare-Metal Installation

To run the application on bare-metal; download the [source](https://github.com/oracle/ai-optimizer) and from `src/`:
To run the application on bare-metal; download the [source](https://github.com/oracle/ai-optimizer):

1. Create and activate a Python Virtual Environment:

Expand Down
2 changes: 1 addition & 1 deletion src/server/api/utils/embed.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
from langchain_community.document_loaders.image import UnstructuredImageLoader
from langchain_community.vectorstores import oraclevs as LangchainVS
from langchain_community.vectorstores.oraclevs import OracleVS
from langchain_core.documents import Document as LangchainDocument
from langchain_core.language_models.chat_models import BaseChatModel
from langchain.docstore.document import Document as LangchainDocument
from langchain.text_splitter import RecursiveCharacterTextSplitter
from langchain_text_splitters import HTMLHeaderTextSplitter, CharacterTextSplitter

Expand Down
18 changes: 10 additions & 8 deletions src/server/api/utils/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ def get_litellm_config(

# Get supported parameters and initialize config
supported_params = get_supported_openai_params(model=model_config["model"])

litellm_config = {
k: full_model_config[k]
for k in supported_params
Expand All @@ -123,6 +124,8 @@ def get_litellm_config(
litellm_config.update(
{"model": model_config["model"], "api_base": full_model_config.get("api_base"), "drop_params": True}
)
if "api_key" in full_model_config:
litellm_config["api_key"] = full_model_config["api_key"]

if provider == "oci":
litellm_config.update(
Expand Down Expand Up @@ -159,19 +162,18 @@ def get_client_embed(model_config: dict, oci_config: schema.OracleCloudSettings)
else:
if provider == "hosted_vllm":
kwargs = {
"provider": "openai",
"model": full_model_config["id"],
"base_url": full_model_config.get("api_base"),
"check_embedding_ctx_length":False #To avoid Tiktoken pre-transform on not OpenAI provided server
"provider": "openai",
"model": full_model_config["id"],
"base_url": full_model_config.get("api_base"),
"check_embedding_ctx_length": False, # To avoid Tiktoken pre-transform on not OpenAI provided server
}
else:
kwargs = {
"provider": provider,
"model": full_model_config["id"],
"base_url": full_model_config.get("api_base"),
"provider": provider,
"model": full_model_config["id"],
"base_url": full_model_config.get("api_base"),
}


if full_model_config.get("api_key"): # only add if set
kwargs["api_key"] = full_model_config["api_key"]
client = init_embeddings(**kwargs)
Expand Down