- Setting up Needed AWS Infrastrucure: Make sure that you have cloudtrail enabled and a Cloudwatch Log Group os created. You can use
templates/logsinsight-bot.yaml
to enable cloudtrail and create a loggroup - Sign up to OpenAI at https://openai.com and create an API Key
OpenAI allows you to tune your own versions of their model. for example you can tune the default davinci model on a specific use case
To do that:
- set your envinroment with the following three parameters
export OPENAI_API_KEY=<Open AI Key>
export AWS_DEFAULT_REGION=<Region>
export LOGGROUP_NAME=<Cloud Trail LogGroup to search>
- Install OpenAI tools
pip install openai
- Create your sample tunning JSONL file with few hundreds examples Example:
{"prompt":"Show me the fields eventName, eventSource, source IP, with a limit of 79 ->","completion":" fields @timestamp, eventName, eventSource, sourceIPAddress | sort @timestamp desc | limit 79 ###"}
- Create your tuned model
openai api fine_tunes.create -t <tuning-file>.jsonl -m davinci --suffix <Personal Identifier>
- Set the value of FT_PERSONAL_MODEL to the newly created model name
export FT_PERSONAL_MODEL=<Model Name>
Run cloudwatch-bot with a natural laguage question as a parameter
python3 bin/cloudwatch-bot.py <Questions>
Examples
python3 bin/cloudwatch-bot.py "show me the event name, ip address and arn with a limit of 7 ->"
For more information visit OpenAi's documentation page https://beta.openai.com/docs/api-reference/introduction