📚/knowledge

Discover our public embeddings hosted on Swarm network.

Ask a question to Brian

POST https://api.brianknows.org/api/v0/agent/knowledge

Allows you to send a prompt to Brian and receive a textual response along with the resources used to.

Headers

NameTypeDescription

x-brian-api-key*

String

Brian API key.

Content-Type*

application/json

Body content type.

Request Body

NameTypeDescription

prompt*

String

Prompt used to generate the response.

kb

String

Knowledge box where you want to search information.

Response
{
  "result": {
    "input": "what is uniswap",
    "chat_history": [],
    "context": [
      {
        "pageContent": "...",
        "metadata": {
          "description": "...",
          "language": "...",
          "source": "...",
          "title": "..."
        }
      },
      ...
    ],
    "answer": "..."
  }
}

Requesting information

curl -XPOST "https://api.brianknows.org/api/v0/agent/knowledge" -H "Content-Type: application/json" -H "x-brian-api-key: API_KEY" -d '{"prompt": "What is Uniswap?"}'
{
  "result": {
    "input": "what is uniswap",
    "chat_history": [],
    "context": [
      {
        "pageContent": "Overview | Uniswap",
        "metadata": {
          "description": "Code",
          "language": "en",
          "source": "https://docs.uniswap.org/concepts/governance/overview",
          "title": "Overview | Uniswap"
        }
      },
      {
        "pageContent": "Glossary | Uniswap",
        "metadata": {
          "description": "Automated Market Maker",
          "language": "en",
          "source": "https://docs.uniswap.org/concepts/glossary",
          "title": "Glossary | Uniswap"
        }
      },
      {
        "pageContent": "Glossary | Uniswap",
        "metadata": {
          "description": "- UNI: An ERC-20 token that designates the weight of a user's voting rights. The more UNI a user has in their wallet, the more weight their delegation or vote on a proposal holds.",
          "language": "en",
          "source": "https://docs.uniswap.org/concepts/governance/glossary",
          "title": "Glossary | Uniswap"
        }
      },
      {
        "pageContent": "The Uniswap Protocol | Uniswap",
        "metadata": {
          "description": "Introduction",
          "language": "en",
          "source": "https://docs.uniswap.org/concepts/uniswap-protocol",
          "title": "The Uniswap Protocol | Uniswap"
        }
      }
    ],
    "answer": "Uniswap is a decentralized exchange (DEX) protocol built on the Ethereum blockchain that allows users to trade various ERC-20 tokens directly from their wallets without the need for an intermediary. It uses an automated market-making (AMM) model rather than a traditional order book, which facilitates liquidity provision and trading.\n\n\"\n\n### Key Features of Uniswap\n\n1. **Automated Market Making**:\n   - Uniswap employs liquidity pools instead of order books. Users can trade tokens by simply interacting with these pools, where prices are determined algorithmically based on the quantity of tokens in each pool.\n\n2. **Liquidity Pools**:\n   - Anyone can provide liquidity to Uniswap by depositing a pair of tokens into a pool. In return, liquidity providers earn a share of the trading fees generated by that pool, proportional to their contribution.\n\n3. **Smart Contracts**:\n   - All operations on Uniswap are handled by smart contracts on the Ethereum blockchain. This ensures that transactions are trustless and automated, making the process transparent and secure.\n\n4. **Permissionless and Composability**:\n   - Uniswap is permissionless, allowing anyone to create trading pairs and participate in the liquidity pools. Additionally, the protocol can integrate with other DeFi applications, enhancing its functionality and reach.\n\n5. **Token Swaps**:\n   - Users can swap one ERC-20 token for another seamlessly, with the protocol automatically calculating the optimal exchange rate based on the current liquidity in the pools.\n\n\"\n\n### Technical Architecture\n\n- Uniswap operates based on a mathematical formula known as the constant product formula (x * y = k). Here, x and y represent the quantities of two tokens in the pool, and k is a constant. This model ensures that the product of the quantities of the tokens remains unchanged during swaps.\n\n- Each liquidity pool holds reserves of two tokens and allows for trades between these tokens. The protocol dynamically adjusts the price through the reserves, reflecting supply and demand in real time.\n\n- Users can interact with Uniswap through its interface or programmatically using the [Uniswap SDK](https://uniswap.org/docs/v2/SDK/introduction/) or [Uniswap's smart contracts](https://github.com/Uniswap/uniswap-v2-core).\n\n\"\n\n### Governance\n\nUniswap operates under a decentralized governance model, where UNI token holders can propose and vote on changes to the protocol. This empowers the community to influence the future development and direction of Uniswap, ensuring it evolves in alignment with user interests.\n\n\"\n\n### Conclusion\n\nIn summary, Uniswap has revolutionized the way decentralized finance operates by providing a robust, user-friendly platform for token swapping and liquidity provisioning. Its AMM model stands out as an innovative approach to trading on the Ethereum blockchain, fostering growth and development in the DeFi sector.\n\nFor a deeper understanding, you can refer to [The Uniswap Protocol](https://uniswap.org/docs/v2/) and [Uniswap's Glossary](https://uniswap.org/docs/v2/glossary/)."
  }
}e

Last updated