Skip to content

Quick Start Dandy!

Installation

Just like most python packages you can easily install Dandy using pip.

pip install dandy

Create a Settings File

You can create a dandy_settings.py file in the root of your project with the following contents.

dandy_settings.py
import os
from pathlib import Path

ALLOW_RECORDING_TO_FILE = True

BASE_PATH = Path.resolve(Path(__file__)).parent

LLM_CONFIGS = {
    'DEFAULT': {
        'HOST': os.getenv('OPENAI_HOST', 'https://api.openai.com'),
        'PORT': int(os.getenv('OPENAI_PORT', 443)),
        'API_KEY': os.getenv('OPENAI_API_KEY'),
        'MODEL': 'gpt-4o-mini',
    }
}

Simple LLM Interaction

Once you have Dandy setup and configured, you can easily get started with a simple LLM interaction.

Traceback (most recent call last):
  File "/app/.heroku/python/lib/python3.11/site-packages/markdown_exec/_internal/formatters/python.py", line 89, in _run_python
    exec_python(code, code_block_id, exec_globals)
  File "/app/.heroku/python/lib/python3.11/site-packages/markdown_exec/_internal/formatters/_exec_python.py", line 26, in exec_python
    exec(compiled, exec_globals)  # noqa: S102
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<code block: n1>", line 4, in <module>
    response_intel = Bot().process('What is the capital of Canada?')
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workspace/dandy/bot/bot.py", line 79, in process
    return self.llm.prompt_to_intel(**kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workspace/dandy/llm/service.py", line 67, in prompt_to_intel
    return self._llm_connector.prompt_to_intel(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workspace/dandy/llm/connector.py", line 136, in prompt_to_intel
    response_intel_object = self._request_to_intel()
                            ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workspace/dandy/llm/connector.py", line 156, in _request_to_intel
    self._http_request_to_response_str()
  File "/workspace/dandy/llm/connector.py", line 66, in _http_request_to_response_str
    self.response_str = http_connector.request_to_response(
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workspace/dandy/http/connector.py", line 37, in request_to_response
    raise HttpConnectorRecoverableError(message)
dandy.http.exceptions.HttpConnectorRecoverableError: HttpConnector request failed with status code 400 and the following message "Bad Request" and body text "{"error":{"message":"/chat/completions: Invalid model name passed in model=stratus.smart. Call `/v1/models` to view available models for your key.","type":"None","param":"None","code":"400","provider_specific_fields":{"error":"/chat/completions: Invalid model name passed in model=stratus.smart. Call `/v1/models` to view available models for your key."}}}" after 4 attempts

Start Learning

Wow, that was easy ... we are only beginning to dive into the power of Dandy.

If you have already got the setup process complete you can skip right to the intel tutorial and learn more about how Dandy works.