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

feat: flat API and add cost in readme #513

Merged
merged 24 commits into from
Jan 20, 2025
Merged

feat: flat API and add cost in readme #513

merged 24 commits into from
Jan 20, 2025

Conversation

530051970
Copy link
Collaborator

@530051970 530051970 commented Jan 20, 2025

Fixes #

🤖 AI-Generated PR Description (Powered by Amazon Bedrock)

Description

This pull request includes several changes related to cost optimization and documentation updates. The primary changes are:

  1. Added COST.md and COST_zh-cn.md files to provide documentation on cost optimization strategies and best practices.
  2. Updated README.md and README_zh-cn.md to include information about the new cost optimization documentation.
  3. Modified api_test/buildspec.yaml and api_test/config.json to optimize the API testing process and reduce unnecessary resource consumption.
  4. Added api_test/policies.json to define resource policies for API testing.
  5. Updated docs/api_doc/apis/api-prod-oas30.yaml to reflect changes in the API documentation.
  6. Modified source/lambda/online/common_logic/common_utils/constant.py and source/lambda/online/lambda_main/main.py to implement cost optimization strategies in the Lambda functions.
  7. Updated source/model/etl/code/model.sh to optimize resource usage during model training and deployment.

These changes aim to improve cost efficiency and provide better documentation for cost optimization strategies within the project.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

File Stats Summary

File number involved in this PR: 11, unfold to see the details:

The file changes summary is as follows:

Files
Changes
Change Summary
README_zh-cn.md 3 added, 0 removed This commit adds a new section for cost information, referencing a COST_zh-cn.md file for details on the cost of running the Intelli-Agent project.
api_test/config.json 3 added, 2 removed The code changes include updating the prefix, enabling the use of an open-source LLM for chat, and changing the model assets bucket in the modelConfig.
source/model/etl/code/model.sh 7 added, 8 removed This code change adds a new argument for specifying the image tag, renames the aws_region variable to region, and uses the provided tag when constructing the full image name for pushing to Amazon ECR.
api_test/buildspec.yaml 1 added, 1 removed The code change updates the STACK_NAME environment variable from "ai-customer-service" to "api-test-ai-customer-service" for the specified project.
source/lambda/online/common_logic/common_utils/constant.py 3 added, 0 removed The code adds a new ParamType class with constants NEST and FLAT, and no changes are made to the existing EntryType and SceneType classes.
api_test/policies.json 149 added, 0 removed This code change adds an AWS IAM policy with permissions for various AWS services like CodeBuild, S3, CloudFormation, Cognito, ECR, Lambda, CodePipeline, EC2, SSM, and IAM roles for an application deployment.
source/lambda/online/lambda_main/main.py 22 added, 1 removed This code change introduces a new parameter type "flat" and adds a function to convert flat parameters to a nested dictionary structure. It also adds several new configuration parameters for chatbot settings, language model configurations, private knowledge settings, and agent configurations.
README.md 3 added, 0 removed The code changes include adding a section for Cost information with a link to COST.md, and a section for Contribution guidelines with a link to CONTRIBUTING.md#security-issue-notifications.
docs/api_doc/apis/api-prod-oas30.yaml 142 added, 46 removed The code changes introduce two different formats for the LLMRequest object, one with nested properties and another with flattened properties. It adds new properties like max_rounds_in_memory, private_knowledge_config, use_websearch, chatbot_goods_id, llm_endpoint_name, private_knowledge_top_k, private_knowledge_score, and param_type to control various aspects of the chatbot and LLM configuration.
COST.md 281 added, 0 removed This code change provides a detailed cost estimation for deploying an AI asset using Amazon Web Services. It includes two models: 1) Full deployment with all components, estimated at $1169.52/month, and 2) Online chat core deployment, estimated at $119.06/month. The cost breakdown covers services like S3, Lambda, DynamoDB, OpenSearch, Cognito, API Gateway, Step Functions, ECR, CloudWatch, and Amazon Bedrock for the LLM model and embeddings.
COST_zh-cn.md 281 added, 0 removed This code change provides a detailed cost estimation for running an asset on Amazon Web Services (AWS) across two deployment modes: (1) Full module deployment with online retrieval and an embedded knowledge base, and (2) Online retrieval only. It breaks down the costs for various AWS services like S3, Lambda, DynamoDB, OpenSearch, Cognito, API Gateway, Step Functions, ECR, CloudWatch, and the Bedrock LLM service based on usage metrics like storage, requests, instances, and tokens. The total estimated monthly cost for mode 1 is $1169.52, while for mode 2 (online retrieval only), it is $119.06.
🤖 AI-Generated PR Description (Powered by Amazon Bedrock)

Description

This pull request includes several changes to the project:

  1. Modifications to the .viperlightignore file, which is likely used for specifying files or directories to be ignored during certain operations.

  2. Addition of two new files, COST.md and COST_zh-cn.md, which may contain documentation or information related to the project's cost or pricing.

  3. Updates to the README.md and README_zh-cn.md files, which typically provide an overview and instructions for the project.

  4. Changes to the api_test/buildspec.yaml file, which is likely a configuration file for building or deploying the project's API tests.

  5. Modifications to the api_test/config.json file, which may contain configuration settings for the API tests.

  6. Addition of a new file, api_test/policies.json, which could be related to defining policies or permissions for the API tests.

  7. Updates to the docs/api_doc/apis/api-prod-oas30.yaml file, which appears to be an OpenAPI specification file for the project's production API.

  8. Changes to the source/lambda/online/common_logic/common_utils/constant.py file, which is likely a Python file containing constants or utility functions used by the project's Lambda functions.

  9. Modifications to the source/lambda/online/lambda_main/main.py file, which could be the main entry point for the project's Lambda functions.

  10. Updates to the source/model/etl/code/model.sh file, which may be a shell script related to the project's data modeling or ETL (Extract, Transform, Load) processes.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

File Stats Summary

File number involved in this PR: 12, unfold to see the details:

The file changes summary is as follows:

Files
Changes
Change Summary
api_test/buildspec.yaml 1 added, 1 removed This change modifies the STACK_NAME environment variable from "ai-customer-service" to "api-test-ai-customer-service" in the GitHub Actions workflow.
source/lambda/online/common_logic/common_utils/constant.py 3 added, 0 removed The code adds a new class ParamType with two constants NEST and FLAT, and does not modify the existing EntryType and SceneType classes.
api_test/config.json 3 added, 2 removed The code changes include updating the prefix, enabling the use of an open-source language model for chat, and modifying the model assets bucket.
source/lambda/online/lambda_main/main.py 22 added, 1 removed This code change introduces a new parameter type 'FLAT' to handle flat parameters, converts flat parameters to a nested dictionary structure, and updates the chatbot configuration with the provided flat parameters.
README.md 3 added, 0 removed The code changes include adding a new section for cost information, referencing a COST.md file, and another section for contribution guidelines, linking to the CONTRIBUTING.md file.
api_test/policies.json 149 added, 0 removed This code change adds an AWS IAM policy document that grants permissions for various AWS services like CodeBuild, S3, CloudFormation, Cognito, ECR, Lambda, CodePipeline, EC2, SSM, and IAM for resource management and deployment operations.
README_zh-cn.md 3 added, 0 removed 这些代码更改添加了一个成本文档链接,提供了有关该项目成本的更多信息。
docs/api_doc/apis/api-prod-oas30.yaml 142 added, 46 removed The code changes introduce two different formats for the LLMRequest object: a nested format and a flat format. The nested format includes a chatbot_config object with various properties, while the flat format has separate properties for each configuration value. Additionally, new properties like max_rounds_in_memory, private_knowledge_config, and param_type have been added to handle conversation history, private knowledge retrieval, and input parameter format, respectively.
source/model/etl/code/model.sh 7 added, 8 removed The code changes introduce a new argument for specifying the image tag, rename the aws_region variable to region, and use the provided tag argument when constructing the full image name and logging into the ECR registry.
.viperlightignore 1 added, 0 removed The code changes involve modifications to the configuration, command-line interface, asset corpus, and footer component files, as well as the addition of a policies.json file for API testing.
COST.md 281 added, 0 removed The provided code changes describe detailed cost estimations for deploying an asset using Amazon Web Services, with two deployment models: a full deployment and an online chat core deployment. It includes cost breakdowns for various AWS services like S3, Lambda, DynamoDB, OpenSearch, Cognito, API Gateway, Step Functions, ECR, CloudWatch, and Bedrock (for LLM and embedding models), considering factors like storage, requests, instances, and data transfer.
COST_zh-cn.md 281 added, 0 removed This code change provides a detailed cost estimation for running an asset on Amazon Web Services (AWS) across two deployment modes: 1) Full module deployment (online retrieval + built-in knowledge base), and 2) Online retrieval only. It breaks down the costs for various AWS services like S3, Lambda, DynamoDB, OpenSearch, Cognito, API Gateway, Step Functions, ECR, CloudWatch, and Bedrock (for LLM and embedding models) based on their usage and configurations. The cost estimation is provided for a monthly run of 20 working days with a maximum token consumption of 4096 per run, using the anthropic.claude-3-sonnet model in the us-east-1 region.

@530051970 530051970 requested a review from NingLu January 20, 2025 05:37
@NingLu NingLu merged commit 0a6061b into dev Jan 20, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants