Skip to content

GPTStonks Chat CE API 0.0.2

GPTStonks API allows interacting with financial data sources using natural language.

Features

The API provides the following features to its users:

  • Latest news search via DuckDuckGo.
  • Updated financial data via OpenBB: equities, cryptos, ETFs, currencies...
  • General knowledge learned during the training of the LLM, dependable on the model.
  • Fast local deployment with updated Docker images (DockerHub).

Supported AI models

The following models are supported:

  • Llama.cpp optimized models: Llama 2, Mixtral, Zephyr...
  • HuggingFace models, including quantized versions, such as Mixtral GPTQ, Phi-2, etc.
  • Amazon Bedrock LLMs.
  • OpenAI instruct and chat LLMs (e.g., gpt-3.5-turbo-1106 or gpt-4-turbo-preview).
  • Multiple text embedding models on Hugging Face and OpenAI Ada 2 embeddings.
  • Vertex AI LLMs (alpha version).

License: MIT

tokens


GET /tokens/

Get Token

Get the token used to access OpenBB.

Returns: TokenResponse: token for OpenBB.

Responses

200 Successful Response

{
    "openbb": "string"
}
⚠️ This example has been generated automatically from the schema and it is not accurate. Refer to the schema for more information.

Schema of the response body
{
    "properties": {
        "openbb": {
            "type": "string",
            "title": "Openbb"
        }
    },
    "type": "object",
    "required": [
        "openbb"
    ],
    "title": "TokenResponse",
    "description": "Model to define the tokens' endpoint response."
}

POST /tokens/

Update Token

Update the token used to access OpenBB.

Args: token_data (TokenData): Token data information to update the database.

Returns: MessageResponse: message indicating success.

Request body

{
    "openbb": "string"
}
⚠️ This example has been generated automatically from the schema and it is not accurate. Refer to the schema for more information.

Schema of the request body
{
    "properties": {
        "openbb": {
            "type": "string",
            "title": "Openbb"
        }
    },
    "type": "object",
    "required": [
        "openbb"
    ],
    "title": "TokenData",
    "description": "Model to define the list of tokens available."
}

Responses

200 Successful Response

{
    "message": "string"
}
⚠️ This example has been generated automatically from the schema and it is not accurate. Refer to the schema for more information.

Schema of the response body
{
    "properties": {
        "message": {
            "type": "string",
            "title": "Message"
        }
    },
    "type": "object",
    "required": [
        "message"
    ],
    "title": "MessageResponse",
    "description": "Model to define a general response with any custom message."
}
422 Validation Error

{
    "detail": [
        {
            "loc": [
                null
            ],
            "msg": "string",
            "type": "string"
        }
    ]
}
⚠️ This example has been generated automatically from the schema and it is not accurate. Refer to the schema for more information.

Schema of the response body
{
    "properties": {
        "detail": {
            "items": {
                "$ref": "#/components/schemas/ValidationError"
            },
            "type": "array",
            "title": "Detail"
        }
    },
    "type": "object",
    "title": "HTTPValidationError"
}

Endpoints


POST /process_query_async

Process Query Async

Asynchronous endpoint to start processing the given query. The processing runs in the background and the result is eventually returned.

Args: request (Request): FastAPI request object containing the query to be processed. query_in (QueryIn): validated query by the user.

Returns: BaseAgentResponse | DataAgentResponse: the standard response by the API.

Request body

{
    "query": "string"
}
⚠️ This example has been generated automatically from the schema and it is not accurate. Refer to the schema for more information.

Schema of the request body
{
    "properties": {
        "query": {
            "type": "string",
            "title": "Query"
        }
    },
    "type": "object",
    "required": [
        "query"
    ],
    "title": "QueryIn",
    "description": "Model to define the main query parameters."
}

Responses

200 Successful Response
Schema of the response body
{
    "anyOf": [
        {
            "$ref": "#/components/schemas/BaseAgentResponse"
        },
        {
            "$ref": "#/components/schemas/DataAgentResponse"
        }
    ],
    "title": "Response Process Query Async Process Query Async Post"
}
422 Validation Error

{
    "detail": [
        {
            "loc": [
                null
            ],
            "msg": "string",
            "type": "string"
        }
    ]
}
⚠️ This example has been generated automatically from the schema and it is not accurate. Refer to the schema for more information.

Schema of the response body
{
    "properties": {
        "detail": {
            "items": {
                "$ref": "#/components/schemas/ValidationError"
            },
            "type": "array",
            "title": "Detail"
        }
    },
    "type": "object",
    "title": "HTTPValidationError"
}

Schemas

BaseAgentResponse

Name Type
body string
type string

DataAgentResponse

Name Type
body string
result_data Array<>
type string

HTTPValidationError

Name Type
detail Array<Schema(ValidationError)>

MessageResponse

Name Type
message string

QueryIn

Name Type
query string

TokenData

Name Type
openbb string

TokenResponse

Name Type
openbb string

ValidationError

Name Type
loc Array<>
msg string
type string