Skip to main content
OctoAI는 효율적인 컴퓨팅에 대한 간편한 액세스를 제공하며 사용자가 선택한 AI 모델을 애플리케이션에 통합할 수 있도록 합니다. OctoAI 컴퓨팅 서비스는 AI 애플리케이션을 쉽게 실행, 튜닝 및 확장할 수 있도록 도와줍니다. 이 노트북은 OctoAI 엔드포인트에 대한 langchain.chat_models.ChatOctoAI 사용법을 보여줍니다.

설정

예제 앱을 실행하려면 다음 두 가지 간단한 단계를 수행하세요:
  1. OctoAI 계정 페이지에서 API 토큰을 가져옵니다.
  2. 아래 코드 셀에 API 토큰을 붙여넣거나 octoai_api_token 키워드 인수를 사용합니다.
참고: 사용 가능한 모델과 다른 모델을 사용하려면 Python에서 컨테이너 빌드컨테이너에서 커스텀 엔드포인트 생성을 참조하여 모델을 컨테이너화하고 직접 커스텀 OctoAI 엔드포인트를 만든 다음 OCTOAI_API_BASE 환경 변수를 업데이트할 수 있습니다.
import os

os.environ["OCTOAI_API_TOKEN"] = "OCTOAI_API_TOKEN"
from langchain_community.chat_models import ChatOctoAI
from langchain.messages import HumanMessage, SystemMessage

예제

chat = ChatOctoAI(max_tokens=300, model_name="mixtral-8x7b-instruct")
messages = [
    SystemMessage(content="You are a helpful assistant."),
    HumanMessage(content="Tell me about Leonardo da Vinci briefly."),
]
print(chat(messages).content)
Leonardo da Vinci (1452-1519) was an Italian polymath who is often considered one of the greatest painters in history. However, his genius extended far beyond art. He was also a scientist, inventor, mathematician, engineer, anatomist, geologist, and cartographer. Da Vinci is best known for his paintings such as the Mona Lisa, The Last Supper, and The Virgin of the Rocks. His scientific studies were ahead of his time, and his notebooks contain detailed drawings and descriptions of various machines, human anatomy, and natural phenomena. Despite never receiving a formal education, da Vinci’s insatiable curiosity and observational skills made him a pioneer in many fields. His work continues to inspire and influence artists, scientists, and thinkers today.
Connect these docs programmatically to Claude, VSCode, and more via MCP for real-time answers.
I