본문 바로가기
LLM

[LLM][Claude][Gemini][GPT][Clova] LLM 모델 사용해보기

by Chandler.j 2024. 4. 23.
반응형

fig1. title

1. Studio

1) OPENAI

2) Google AI Studio

3) Anthropic

4) CLOVA Studio

 

2. API


1. Studio

- Web 상에서 편하게 채팅모드 playground 로 사용해볼 수 있다.

- 다양한 종류의 LLM 모델을 경험해보는 것은 매우 중요하다.

1) OPENAI

- https://platform.openai.com/playground/chat

fig2. OPENAI platform Dashboard

- Model: 3.5 turbo 부터 4 turbo 까지 선택 가능

- Temperature [0,1]: 0에 가까울 수록 보수적인

- Maximum length: tocken 정할 수 있음

- 유료 사용 Credit 충전


2) Google AI Studio

- https://aistudio.google.com/app/prompts/new_chat

fig3. Google AI Studio

- Model: 1.0 Pro or 1.5 Pro

fig4. model list of Google AI Studio

 

 

- Gemini 1.0 Pro에서만 기타 변수 설정 가능 (1.5 Pro 불가능)

- 무료 사용 가능 ***************


3) Anthropic

- https://console.anthropic.com/workbench

fig5. anthropic dashboard

 

fig6. anthropic model list

- Model: claude 1 부터 3까지

- 유료 사용 Credit 충전

 


4) CLOVA Studio

- https://clovastudio.ncloud.com/playground

fig7. clova studio dashboard

 

- Naver cloud platform 에서 CLOVA Studio로 사용 가능

- 국내 유일하게 사용해 볼 수 있는 LLM 모델

- 한국어 성능은 나름 괜찮음

- 간단한 챗봇 손쉽게 제작 가능

- 유료 사용 Credit 충전


2. API

- OPENAI https://platform.openai.com/api-keys


- Google AI Studio https://aistudio.google.com/app/apikey

 


- Antrhopic https://console.anthropic.com/settings/keys


- Codebook (feat. LangChain)

!pip install langchain langchain-openai langchain-google-genai langchain-anthropic
import os
# from getpass import getpass
from langchain_openai import OpenAI
from langchain_google_genai import GoogleGenerativeAI
from langchain_anthropic import AnthropicLLM
from langchain_core.prompts import PromptTemplate
# API 키 설정
os.environ["OPENAI_API_KEY"] = ""
gem_api_key = ""
os.environ["ANTHROPIC_API_KEY"] = ""
# 각 모델에 대한 LLM 인스턴스 생성
openai_llm = OpenAI()
gemini_llm = GoogleGenerativeAI(model="gemini-pro", google_api_key=gem_api_key)
anthropic_llm = AnthropicLLM(model="claude-3-haiku-20240307")
template = """Question: {question}

Answer: Let's think step by step."""
prompt = PromptTemplate.from_template(template)
question = "세상에서 가장 큰 동물은 무엇인가요?"

chain = prompt | openai_llm
print("OpenAI:")
print(chain.invoke({"question": question}))

chain = prompt | gemini_llm
print("\nGemini:")
print(chain.invoke({"question": question}))

chain = prompt | anthropic_llm
print("\nAnthropic:")
print(chain.invoke({"question": question}))

TOP

Designed by 티스토리