Skip to Content
GPT API를 활용한 인공지능 앱 개발(2판)
book

GPT API를 활용한 인공지능 앱 개발(2판)

by 올리비에 케일린, 마리 알리스 블레트, 이일섭, 박태환
December 2024
Beginner to intermediate
320 pages
7h 25m
Korean
Hanbit Media, Inc.
Content preview from GPT API를 활용한 인공지능 앱 개발(2판)
61
2
오픈AI API
윈도
11
에서 환경 변수를 영구적으로 추가하고 관리하려면 [
Windows
] + [
R
]을 눌러 실행 창
을 엽니다. 이 창에
sysdm
.
cpl
을 입력해 [시스템 속성] 패널로 이동합니다. 그리고 [고급] 탭
을 누른 다음 [환경 변수] 버튼을 누릅니다. 해당 화면에서 오픈
AI
키로 새 환경 변수를 추가합
니다.
구글 코랩, 주피터 노트북 등의 작업 환경에서
API
키를 설정하려면, 다음 코드를 추가합니다.
import os
os.environ['OPENAI_API_KEY'] = 'sk-()'
환경 변수 관리는 개발에서 중요한 요소입니다. 그렇기에 일반적으로
API
키를
.
env
에 저장
하고
.
gitignore
로 버전 관리에서 제외할 항목으로 지정합니다. 파이썬에서는
dotenv
를 통
해 환경 변수를 불러옵니다. 환경 설정을 올바르게 적용하려면 다음과 같이
.
env
파일을 로드
한 후에
openai
를 불러와야 합니다.
from dotenv import load_dotenv
load_dotenv()
from openai import OpenAI
NOTE
파이썬으로
dotenv
를 활용하려면
dotenv
파이썬 패키지(패키지명:
python
-
dotenv
)를 설치해야 합니다.
pip
install
python
-
dotenv
로 설치할 수 있습니다.
TIP
API ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

개발 7년차, 매니저 1일차

개발 7년차, 매니저 1일차

권원상, 한민주, 카미유 푸르니에
GPT-4를 활용한 인공지능 앱 개발

GPT-4를 활용한 인공지능 앱 개발

올리비에 케일린, 마리 알리스 블레트

Publisher Resources

ISBN: 9791169213295