Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v2.1.0 #271

Merged
merged 33 commits into from
Feb 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
1d8ee4e
feat: Added none option to Knowledege bases selection (#214)
abdul-fission Feb 12, 2025
6e13812
Feature/optional knowledge base (#215)
kgeorge-fission Feb 12, 2025
d1e5cf0
fix: changed label from valid experiments to experiments and aspect c…
abdul-fission Feb 12, 2025
cd7dd58
SHowing NA if knowlwdge base is not selected in details tab chunking …
abdul-fission Feb 12, 2025
9571f9d
feat: Feat/cloudscape nuxt theme (#240)
harishFL Feb 13, 2025
88e60bc
feat: api to fetch opensearch provisioned config
adilraza-fission Feb 13, 2025
452eaff
feat: skip indexing incase of no knowledge base (#243)
nandateja Feb 13, 2025
79f459a
feat: skip index creation when no os is provisioned (#244)
nandateja Feb 13, 2025
37c058c
Feature/GitHub help links (#246)
abdul-fission Feb 13, 2025
2e9c80c
updated help liks in side drawer (#248)
abdul-fission Feb 13, 2025
93ba3bc
indexing meta data condition refactored (#249)
abdul-fission Feb 13, 2025
81a61c3
chore: aws UI revamp changes (#250)
harishFL Feb 13, 2025
1d57f8c
added ragas version and matrix with precision reference (#247)
lkumar009 Feb 13, 2025
7e5bcbc
Added Opensearch Provision Check (#251)
dandamudigirish Feb 14, 2025
ab45067
Added Chat Template to Bedrock (#242)
dandamudigirish Feb 14, 2025
d209c46
feat: KB config get api integrated (#252)
abdul-fission Feb 14, 2025
5ef4f12
fix: header alignment and form alignment changes done (#253)
abdul-fission Feb 14, 2025
27e8338
fix: system prompt format and conversation method (#255)
nandateja Feb 14, 2025
9601455
added required and removed search fields for unnecessary components (…
harishFL Feb 14, 2025
ec4c38e
fix: region select on us-west-1 disabling form issue fixed (#258)
abdul-fission Feb 14, 2025
097e6ad
fix: ragas long running issue (#260)
nandateja Feb 17, 2025
a685cec
fix: titan model inferencing short term fix (#261)
nandateja Feb 18, 2025
bb83c85
added ui bug fixes and enhancements (#262)
harishFL Feb 18, 2025
50225c4
fix: remove the return statement (#263)
nandateja Feb 18, 2025
4f38bad
Ragas/fix metrics error (#264)
nandateja Feb 18, 2025
a173e6e
added new ui enhancements (#265)
harishFL Feb 18, 2025
c121edd
added correct links to reranking model and chunk size (#266)
harishFL Feb 18, 2025
4b72534
added fixes to drawer content static, n shot prompt guide sample and …
harishFL Feb 18, 2025
ad7eb53
fix: condition w.r.t reranking and few ui bug fixes (#268)
harishFL Feb 18, 2025
502fe64
CFN Changes (#259)
BalaSriharsha-Ch Feb 18, 2025
b0951cf
added n prompt guide info bar fix
harishFL Feb 18, 2025
07172df
Merge pull request #269 from harishFL/bug_fix/n-prompt-info-fix
BalaSriharsha-Ch Feb 18, 2025
10337e8
v2.1.0 (#270)
BalaSriharsha-Ch Feb 18, 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
309 changes: 309 additions & 0 deletions Help_Links.MD

Large diffs are not rendered by default.

13 changes: 7 additions & 6 deletions app/configuration_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
def is_valid_combination(config, data):
# Define your rules here
regions = ["us-east-1", "us-west-2"]
if config['bedrock_knowledge_base']:
if config['bedrock_knowledge_base'] or not config['knowledge_base']:
return True
if config["region"] not in regions:
return False
Expand Down Expand Up @@ -274,7 +274,7 @@ def generate_all_combinations(data):
[num_prompts, num_chars] = read_gt_data(gt_data)

avg_prompt_length = round(num_chars / num_prompts / 4)
if parameters_all["bedrock_knowledge_base"][0]:
if parameters_all["bedrock_knowledge_base"][0] or not parameters_all['knowledge_base'][0]:
num_tokens_kb_data = 0
else:
num_tokens_kb_data = count_characters_in_file(parameters_all["kb_data"][0]) / 4
Expand Down Expand Up @@ -305,6 +305,7 @@ def generate_all_combinations(data):

if len(valid_configurations) > 0:
for configuration in valid_configurations:
configuration["is_opensearch"] = True if configs.opensearch_host else False
#TODO: Organize the pricing code, break into static methods
configuration["directional_pricing"] = 0
configuration["indexing_cost_estimate"] = 0
Expand All @@ -313,12 +314,12 @@ def generate_all_combinations(data):
configuration["eval_cost_estimate"] = 0

# kb data tokens would be zero if it is Bedrock knowledge bases
effective_num_tokens_kb_data = 0 if configuration["bedrock_knowledge_base"] else estimate_effective_kb_tokens(configuration, num_tokens_kb_data)
effective_num_tokens_kb_data = 0 if configuration["bedrock_knowledge_base"] or not configuration["knowledge_base"] else estimate_effective_kb_tokens(configuration, num_tokens_kb_data)

indexing_time, retrieval_time, eval_time = estimate_times(effective_num_tokens_kb_data, num_prompts, configuration)

# Bedrock knowledge bases price not supported at the moment
if configuration["bedrock_knowledge_base"]:
if configuration["bedrock_knowledge_base"] or not configuration["knowledge_base"]:
configuration["indexing_cost_estimate"] = 0
elif configuration['embedding_service'] == "bedrock" :
embedding_price = estimate_embedding_model_bedrock_price(bedrock_price_df, configuration, num_tokens_kb_data)
Expand Down Expand Up @@ -349,7 +350,7 @@ def generate_all_combinations(data):
configuration["eval_cost_estimate"] += estimate_fargate_price(eval_time)

# add opensearch provisioned costs
if not configuration["bedrock_knowledge_base"]:
if not configuration["bedrock_knowledge_base"] or configuration["is_opensearch"]:
configuration["indexing_cost_estimate"] += estimate_opensearch_price(indexing_time)
configuration["retrieval_cost_estimate"] += estimate_opensearch_price(retrieval_time)
configuration["eval_cost_estimate"] += estimate_opensearch_price(eval_time)
Expand All @@ -358,7 +359,7 @@ def generate_all_combinations(data):
configuration["directional_pricing"] +=configuration["directional_pricing"]*0.05 #extra
configuration["directional_pricing"] = round(configuration["directional_pricing"],2)

return valid_configurations
return valid_configurations[:1000]

def generate_all_combinations_in_background(execution_id: str, execution_config_data):
"""
Expand Down
3 changes: 2 additions & 1 deletion app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from .seed_data import seed_models

from app.dependencies.database import db
from app.routes import execution, experiment, health, uploads, bedrock_config
from app.routes import execution, experiment, health, uploads, bedrock_config, config
from app.dependencies.database import (
get_execution_model_invocations_db
)
Expand Down Expand Up @@ -32,6 +32,7 @@ async def startup_event():
app.include_router(experiment.router)
app.include_router(health.router)
app.include_router(bedrock_config.router)
app.include_router(config.router)

return app

Expand Down
2 changes: 1 addition & 1 deletion app/price_calculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def estimate_times(no_of_kb_tokens, num_prompts, configuration):
indexing_service = configuration['embedding_service']
retrieval_service = configuration['retrieval_service']

indexing_time = 0 if configuration["bedrock_knowledge_base"] else (no_of_kb_tokens/ 50000) * estimated_time['indexing'][indexing_service]
indexing_time = 0 if configuration["bedrock_knowledge_base"] or not configuration["knowledge_base"] else (no_of_kb_tokens/ 50000) * estimated_time['indexing'][indexing_service]
retrieval_time = (num_prompts / 25) * estimated_time['retrieval'][retrieval_service]
eval_time = (num_prompts / 25) * estimated_time['eval'][retrieval_service]

Expand Down
10 changes: 10 additions & 0 deletions app/routes/config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from fastapi import APIRouter
from util.open_search_config_utils import OpenSearchUtils

router = APIRouter()

@router.get("/config", tags=["config"])
async def config():
return {
"opensearch": OpenSearchUtils.opensearch_config()
}
2 changes: 1 addition & 1 deletion baseclasses/base_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ def from_dict(self, metrics_dict: Dict[str, str]) -> 'EvaluationMetrics':
"""Convert metrics from DynamoDB format to EvaluationMetrics"""
return EvaluationMetrics(
faithfulness_score=float(metrics_dict.get('faithfulness', '0.0')),
context_precision_score=float(metrics_dict.get('llm_context_precision_without_reference', '0.0')),
context_precision_score=float(metrics_dict.get('llm_context_precision_with_reference', '0.0')),
aspect_critic_score=float(metrics_dict.get('maliciousness', '0.0')),
answers_relevancy_score=float(metrics_dict.get('answer_relevancy', '0.0')),
string_similarity=float(metrics_dict.get('String_Similarity', '0.0')),
Expand Down
6 changes: 6 additions & 0 deletions cfn/ecr-repository-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,31 +17,37 @@ Resources:
Type: AWS::ECR::Repository
Properties:
RepositoryName: !Sub "flotorch-indexing-${TableSuffix}"
EmptyOnDelete: true

RetrieverRepository:
Type: AWS::ECR::Repository
Properties:
RepositoryName: !Sub "flotorch-retriever-${TableSuffix}"
EmptyOnDelete: true

AppRepository:
Type: AWS::ECR::Repository
Properties:
RepositoryName: !Sub "flotorch-app-${TableSuffix}"
EmptyOnDelete: true

EvaluationRepository:
Type: AWS::ECR::Repository
Properties:
RepositoryName: !Sub "flotorch-evaluation-${TableSuffix}"
EmptyOnDelete: true

RuntimeRepository:
Type: AWS::ECR::Repository
Properties:
RepositoryName: !Sub "flotorch-runtime-${TableSuffix}"
EmptyOnDelete: true

CostComputeRepository:
Type: AWS::ECR::Repository
Properties:
RepositoryName: !Sub "flotorch-costcompute-${TableSuffix}"
EmptyOnDelete: true

Outputs:
AppRepositoryURI:
Expand Down
105 changes: 98 additions & 7 deletions cfn/lambda-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,16 @@ Parameters:
CostComputeImageTag:
Type: String
Description: Tag for the AI image
PrerequisitesMet:
Type: String
Description: Whether prerequisites are met (yes/no)
AllowedValues:
- "yes"
- "no"

Conditions:
PrerequisitesMet: !Equals [!Ref PrerequisitesMet, "yes"]
PrerequisitesNotMet: !Equals [!Ref PrerequisitesMet, "no"]

Resources:
LambdaSecurityGroup:
Expand Down Expand Up @@ -156,6 +166,7 @@ Resources:

DockerPullPushRole:
Type: AWS::IAM::Role
Condition: PrerequisitesMet
Properties:
AssumeRolePolicyDocument:
Version: '2012-10-17'
Expand Down Expand Up @@ -213,6 +224,7 @@ Resources:

DockerPullPushFunction:
Type: AWS::Lambda::Function
Condition: PrerequisitesMet
Properties:
Handler: index.handler
Role: !GetAtt DockerPullPushRole.Arn
Expand Down Expand Up @@ -347,10 +359,21 @@ Resources:
fi
}}

install_git() {{
if command_exists git; then
echo "Git is already installed"
git --version
else
echo "Installing Git..."
sudo yum install -y git
fi
}}

# Detect OS and install requirements
detect_os
install_docker
install_awscli
install_git

# Configure Docker to use non-interactive mode
export DOCKER_CLI_NO_INTERACTIVE=1
Expand Down Expand Up @@ -475,6 +498,7 @@ Resources:

DockerPullPushResource:
Type: Custom::DockerPullPush
Condition: PrerequisitesMet
DependsOn: DockerPullPushFunction
Properties:
ServiceToken: !GetAtt DockerPullPushFunction.Arn
Expand All @@ -495,14 +519,45 @@ Resources:
RuntimeImageTag: !Ref RuntimeImageTag
CostComputeImageTag: !Ref CostComputeImageTag

RuntimeLambdaFunction:
RuntimeLambdaFunctionWithPrereqs:
Type: AWS::Lambda::Function
Condition: PrerequisitesMet
DependsOn: DockerPullPushResource
Properties:
FunctionName: !Sub flotorch-runtime-${TableSuffix}
Role: !GetAtt LambdaExecutionRole.Arn
Code:
ImageUri: !Sub ${AWS::AccountId}.dkr.ecr.${AWS::Region}.amazonaws.com/flotorch-runtime-${TableSuffix}:${RuntimeImageTag}
ImageUri: !Sub ${AWS::AccountId}.dkr.ecr.${AWS::Region}.amazonaws.com/flotorch-runtime-${TableSuffix}:latest
PackageType: Image
MemorySize: 4096
Timeout: 900
VpcConfig:
SubnetIds: !Split [",", !Join [",", !Ref PrivateSubnets]]
SecurityGroupIds:
- !Ref LambdaSecurityGroup
Environment:
Variables:
DATA_BUCKET: !Ref DataBucketName
EXECUTION_TABLE: !Ref ExecutionTableName
EXPERIMENT_TABLE: !Ref ExperimentTableName
METRICS_TABLE: !Ref MetricsTableName
MODEL_INVOCATIONS_TABLE: !Ref ModelInvocationsTableName
opensearch_host: !Ref OpenSearchEndpoint
opensearch_username: !Ref OpenSearchAdminUser
opensearch_password: !Ref OpenSearchAdminPassword
INFERENCE_SYSTEM_PROMPT: "You are a helpful assistant. Use the provided context to answer questions accurately. If you cannot find the answer in the context, say so"
vector_field_name: "vectors"
opensearch_serverless: "false"
aws_region: !Ref AWS::Region

RuntimeLambdaFunctionNoPrereqs:
Type: AWS::Lambda::Function
Condition: PrerequisitesNotMet
Properties:
FunctionName: !Sub flotorch-runtime-${TableSuffix}
Role: !GetAtt LambdaExecutionRole.Arn
Code:
ImageUri: !Sub ${AWS::AccountId}.dkr.ecr.${AWS::Region}.amazonaws.com/flotorch-runtime-${TableSuffix}:latest
PackageType: Image
MemorySize: 4096
Timeout: 900
Expand All @@ -525,8 +580,9 @@ Resources:
opensearch_serverless: "false"
aws_region: !Ref AWS::Region

CostComputeLambdaFunction:
CostComputeLambdaFunctionWithPrereqs:
Type: AWS::Lambda::Function
Condition: PrerequisitesMet
DependsOn: DockerPullPushResource
Properties:
FunctionName: !Sub flotorch-costcompute-${TableSuffix}
Expand All @@ -550,13 +606,48 @@ Resources:
experiment_question_metrics_index: experiment_id-index
experiment_question_metrics_table: !Ref MetricsTableName

CostComputeLambdaFunctionNoPrereqs:
Type: AWS::Lambda::Function
Condition: PrerequisitesNotMet
Properties:
FunctionName: !Sub flotorch-costcompute-${TableSuffix}
Role: !GetAtt LambdaExecutionRole.Arn
Code:
ImageUri: !Sub ${AWS::AccountId}.dkr.ecr.${AWS::Region}.amazonaws.com/flotorch-costcompute-${TableSuffix}:latest
PackageType: Image
MemorySize: 4096
Timeout: 900
VpcConfig:
SubnetIds: !Split [",", !Join [",", !Ref PrivateSubnets]]
SecurityGroupIds:
- !Ref LambdaSecurityGroup
Environment:
Variables:
execution_table: !Ref ExecutionTableName
experiment_table: !Ref ExperimentTableName
s3_bucket: !Ref DataBucketName
bedrock_limit_csv: seed/bedrock_limits_small.csv
aws_region: !Ref AWS::Region
experiment_question_metrics_index: experiment_id-index
experiment_question_metrics_table: !Ref MetricsTableName

Outputs:
RuntimeLambdaArn:
RuntimeLambdaArnWithPrereqs:
Description: ARN of the Runtime Lambda function
Condition: PrerequisitesMet
Value: !GetAtt RuntimeLambdaFunctionWithPrereqs.Arn
CostComputeLambdaArnWithPrereqs:
Description: ARN of the cost compute lambda function
Condition: PrerequisitesMet
Value: !GetAtt CostComputeLambdaFunctionWithPrereqs.Arn
RuntimeLambdaArnNoPrereqs:
Description: ARN of the Runtime Lambda function
Value: !GetAtt RuntimeLambdaFunction.Arn
CostComputeLambdaArn:
Condition: PrerequisitesNotMet
Value: !GetAtt RuntimeLambdaFunctionNoPrereqs.Arn
CostComputeLambdaArnNoPrereqs:
Description: ARN of the cost compute lambda function
Value: !GetAtt CostComputeLambdaFunction.Arn
Condition: PrerequisitesNotMet
Value: !GetAtt CostComputeLambdaFunctionNoPrereqs.Arn
LambdaRoleArn:
Description: ARN of the Lambda execution role
Value: !GetAtt LambdaExecutionRole.Arn
Expand Down
Loading