footer-main.html
Chat Completions
Generates a response for the given chat conversation.
POST /api/chat-completion
Authorizations:
authorizationrequired

Bearer authentication header of the form Bearer <token>, where <token> is your API key.

Body:
messagesrequired

A list of messages comprising the conversation so far. Each message must consist of 2 components (see the example on the right side):

  • content: the contents of the message in this turn of conversation.
  • role: the role of the speaker in this turn of conversation. After the (optional) system message, user and assistant roles should alternate with user then assistant, ending in user.

stream

Determines whether or not to incrementally stream the response with server-sent events with content-type: text/event-stream. Default to False.

Response:
chatId

Chat's id

content

Neyman AI's response to the user query in markdown format

querySummary

Summary of the user's query

relatedQueries

3 related queries

sources

Sources used to answer the user's query

tickers

Tickers related to the user's query

widgets

Widgets related to the user's query

cURL
Python
import requests

url = "https://neyman.ai/api/chat-completion"

payload = {
    "messages": [
        {
            "role": "system",
            "content": "Be precise and concise."
        },
        {
            "role": "user",
            "content": "What is the current price of AAPL?"
        }
    ],
    "stream": False,
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.request("POST", url, json=payload, headers=headers)

print(response.text)
 


Response
{
  "chatId": "hKCTD489rN",
  "content": "The current price of Apple stock is $222.78.",
  "querySummary": "Apple Stock Price",
  "relatedQueries": [
    "What is Apple's stock price today?",
    "How has Apple stock performed this year?",
    "What are Apple's stock predictions for next quarter?"
  ],
  "sources": [
    {
      "link": "https://finnhub.io/docs/api",
      "shortURL": "finnhub.io",
      "snippet": "Comprehensive stock API for realtime market data, global company fundamentals, economic data, and alternative data...",
      "title": "Finnhub API Documentation",
      "websiteName": "Finnhub"
    },
    {
      "link": "https://investor.apple.com/stock-price/default.aspx",
      "shortURL": "apple.com",
      "snippet": "Stock Quote: NASDAQ: AAPL · Day's Open224.78 · Closing Price222.78 · Volume54.7M · Intraday High225.63 · Intraday Low221.41.",
      "title": "Stock Price - Apple Investor Relations",
      "websiteName": "Apple"
    }
  ],
  "tickers": [
    {
      "link": "https://neyman.ai/AAPL/overview",
      "priceCurrency": "USD",
      "reportingCurrency": "USD",
      "ticker": "AAPL"
    }
  ],
  "widgets": ["https://neyman.ai/widget?ticker=AAPL&which=historical-price"]
}
 

NOBODY DOES IT BETTER!

READY TO BRING THE POWER OF GEN AI TO YOUR PLATFORM ?

Contact us