Konko API는 애플리케이션 개발자를 돕기 위해 설계된 완전 관리형 Web API입니다:
  1. 선택 - 애플리케이션에 적합한 오픈 소스 또는 독점 LLM 선택
  2. 구축 - 주요 애플리케이션 프레임워크와의 통합 및 완전 관리형 API를 통해 더 빠르게 애플리케이션 구축
  3. Fine tune - 더 작은 오픈 소스 LLM을 fine tune하여 비용의 일부만으로 업계 최고 수준의 성능 달성
  4. 프로덕션 규모 API 배포 - Konko AI의 SOC 2 준수 멀티 클라우드 인프라를 사용하여 인프라 설정이나 관리 없이 보안, 개인정보 보호, 처리량 및 지연 시간 SLA를 충족하는 API 배포
이 예제는 LangChain을 사용하여 Konko ChatCompletion models와 상호작용하는 방법을 다룹니다 이 노트북을 실행하려면 Konko API key가 필요합니다. 웹 앱에 로그인하여 모델에 액세스할 수 있는 API key를 생성하세요
from langchain_community.chat_models import ChatKonko
from langchain.messages import HumanMessage, SystemMessage

Environment Variables 설정

  1. 다음에 대한 environment variables를 설정할 수 있습니다
    1. KONKO_API_KEY (필수)
    2. OPENAI_API_KEY (선택)
  2. 현재 shell session에서 export 명령을 사용하세요:
export KONKO_API_KEY={your_KONKO_API_KEY_here}
export OPENAI_API_KEY={your_OPENAI_API_KEY_here} #Optional

model 호출

Konko overview page에서 model을 찾으세요 Konko 인스턴스에서 실행 중인 model 목록을 찾는 또 다른 방법은 이 endpoint를 통하는 것입니다. 여기서 model을 초기화할 수 있습니다:
chat = ChatKonko(max_tokens=400, model="meta-llama/llama-2-13b-chat")
messages = [
    SystemMessage(content="You are a helpful assistant."),
    HumanMessage(content="Explain Big Bang Theory briefly"),
]
chat(messages)
AIMessage(content="  Sure thing! The Big Bang Theory is a scientific theory that explains the origins of the universe. In short, it suggests that the universe began as an infinitely hot and dense point around 13.8 billion years ago and expanded rapidly. This expansion continues to this day, and it's what makes the universe look the way it does.\n\nHere's a brief overview of the key points:\n\n1. The universe started as a singularity, a point of infinite density and temperature.\n2. The singularity expanded rapidly, causing the universe to cool and expand.\n3. As the universe expanded, particles began to form, including protons, neutrons, and electrons.\n4. These particles eventually came together to form atoms, and later, stars and galaxies.\n5. The universe is still expanding today, and the rate of this expansion is accelerating.\n\nThat's the Big Bang Theory in a nutshell! It's a pretty mind-blowing idea when you think about it, and it's supported by a lot of scientific evidence. Do you have any other questions about it?")

Connect these docs programmatically to Claude, VSCode, and more via MCP for real-time answers.
I