Skip to content

Instantly share code, notes, and snippets.

@koorukuroo
Created September 25, 2024 01:37
Show Gist options
  • Save koorukuroo/bf989e330d1fc04f0c037117ab3e751f to your computer and use it in GitHub Desktop.
Save koorukuroo/bf989e330d1fc04f0c037117ab3e751f to your computer and use it in GitHub Desktop.
import openai
openai.api_key = 'sk-API 키를 입력하세요'
def lambda_handler(event, context):
if 'm' in event['params']['querystring']:
input_message = event['params']['querystring']['m']
else:
input_message = "나는 신한투자증권에 입사하려는 개발자야. 클라우드를 공부해야 할 필요가 있을까?"
message = openai.ChatCompletion.create(
model="gpt-4o-mini", # 사용 모델
messages=[
{"role": "system", "content": "너는 클라우드 전문 개발자야. 핵심만 담아서 최대한 짧게 말하는 특징이 있어."},
{"role": "user", "content": input_message}
] # 전달 메세지
)
return message
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment