">[Bittensor](https://bittensor.com/) is a mining network, similar to Bitcoin, that includes built-in incentives designed to encourage miners to contribute compute + knowledge.\n",
">\n",
">`NIBittensorLLM` is developed by [Neural Internet](https://neuralinternet.ai/), powered by `Bittensor`.\n",
">This LLM showcases true potential of decentralized AI by giving you the best response(s) from the `Bittensor protocol`, which consist of various AI models such as `OpenAI`, `LLaMA2` etc.\n",
"Users can view their logs, requests, and API keys on the [Validator Endpoint Frontend](https://api.neuralinternet.ai/). However, changes to the configuration are currently prohibited; otherwise, the user's queries will be blocked.\n",
"If you encounter any difficulties or have any questions, please feel free to reach out to our developer on [GitHub](https://github.com/Kunj-2206), [Discord](https://discordapp.com/users/683542109248159777) or join our discord server for latest update and queries [Neural Internet](https://discord.gg/neuralinternet).\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Different Parameter and response handling for NIBittensorLLM "
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import langchain\n",
"from langchain.llms import NIBittensorLLM\n",
"import json\n",
"from pprint import pprint\n",
"\n",
"langchain.debug = True\n",
"\n",
"# System parameter in NIBittensorLLM is optional but you can set whatever you want to perform with model\n",
"llm_sys = NIBittensorLLM(\n",
" system_prompt=\"Your task is to determine response based on user prompt.Explain me like I am technical lead of a project\"\n",
")\n",
"sys_resp = llm_sys(\n",
" \"What is bittensor and What are the potential benifits of decentralized AI?\"\n",
")\n",
"print(f\"Response provided by LLM with system prompt set is : {sys_resp}\")\n",
"\n",
"# The top_responses parameter can give multiple responses based on its parameter value\n",
"# This below code retrive top 10 miner's response all the response are in format of json\n",
"\n",
"# Json response structure is\n",
"\"\"\" {\n",
" \"choices\": [\n",
" {\"index\": Bittensor's Metagraph index number,\n",
" \"uid\": Unique Identifier of a miner,\n",
" \"responder_hotkey\": Hotkey of a miner,\n",
" \"message\":{\"role\":\"assistant\",\"content\": Contains actual response},\n",
" \"response_ms\": Time in millisecond required to fetch response from a miner} \n",
"prefix = \"\"\"Answer prompt based on LLM if there is need to search something then use internet and observe internet result and give accurate reply of user questions also try to use authenticated sources\"\"\"\n",