Tongyi Qwen은 Alibaba의 Damo Academy에서 개발한 대규모 언어 모델입니다. 자연어 이해 및 의미 분석을 통해 사용자의 의도를 파악할 수 있으며, 자연어로 입력된 사용자의 요청을 기반으로 다양한 도메인과 작업에서 서비스와 지원을 제공합니다. 명확하고 상세한 지침을 제공함으로써 기대에 더 부합하는 결과를 얻을 수 있습니다.

설정하기

# Install the package
pip install -qU  langchain-community dashscope
# Get a new token: https://help.aliyun.com/document_detail/611472.html?spm=a2c4g.2399481.0.0
from getpass import getpass

DASHSCOPE_API_KEY = getpass()
 ········
import os

os.environ["DASHSCOPE_API_KEY"] = DASHSCOPE_API_KEY
from langchain_community.llms import Tongyi
Tongyi().invoke("What NFL team won the Super Bowl in the year Justin Bieber was born?")
'Justin Bieber was born on March 1, 1994. The Super Bowl that took place in the same year was Super Bowl XXVIII, which was played on January 30, 1994. The winner of that Super Bowl was the Dallas Cowboys, who defeated the Buffalo Bills with a score of 30-13.'

chain에서 사용하기

from langchain_core.prompts import PromptTemplate
llm = Tongyi()
template = """Question: {question}

Answer: Let's think step by step."""

prompt = PromptTemplate.from_template(template)
chain = prompt | llm
question = "What NFL team won the Super Bowl in the year Justin Bieber was born?"

chain.invoke({"question": question})
'Justin Bieber was born on March 1, 1994. The Super Bowl that took place in the same calendar year was Super Bowl XXVIII, which was played on January 30, 1994. The winner of Super Bowl XXVIII was the Dallas Cowboys, who defeated the Buffalo Bills with a score of 30-13.'

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