模型调用接口查找数据

from langchain.chains import APIChain
from langchain_community.llms.ollama import Ollama

llm = Ollama(model="qwen:7b")

api_docs = """
BASE URL: https://api.python.langchain.com

API Documentation:

The API endpoint /en/latest/langchain_api_reference.html/{name} Used to find information about a country. All URL parameters are listed below;
    -name:Name of country -Ex: italy, france
    
The API endpoint /v3.1/currency/{currency} Uesd to find information about a region. All URL parameters are listed below;
    -currency:3 letter currency. Example: USD, COP
    
Woo! This is my documentation
"""
limit_to_domains=["https://api.python.langchain.com"]
chain_new = APIChain.from_llm_and_api_docs(llm, api_docs, limit_to_domains=limit_to_domains, verbose=True)

chain_new.run("可以告诉我 module-langchain.hub 的信息吗?")

 

posted @ 2024-04-08 16:00  林**  阅读(33)  评论(0编辑  收藏  举报