The DIAL Assistant Service is designed to respond to user queries, like ChatGPT. It is accessible via DIAL API. The service’s distinctive feature is its ability to utilize addons provided in the user request, enhancing its capability to gather and process information.
Upon receiving a user request, the service employs the specified LLM to interpret and respond to the inquiry. Along with user request it instructs the model on how to apply the provided addons to garner additional information. If the model decides to use an addon to seek specific details, the Assistant Service promptly executes this task and channels the acquired data back to the model. This iterative procedure continues, with the model leveraging the addons to assemble more information until a thorough and informed response to the user’s query is generated.
In essence, the DIAL Assistant Service is a versatile tool that combines the power of a given model with the extended capabilities of various addons to deliver comprehensive and accurate answers.
import os
import openai
if __name__ == "__main__":
response = openai.ChatCompletion.create(
api_base=os.environ["OPENAI_API_BASE"],
api_type="azure",
api_version="2023-03-15-preview",
api_key=os.environ["OPENAI_API_KEY"],
engine="assistant",
model="gpt-4",
temperature=0,
timeout=300,
messages=[
{"role": "user", "content": "What's up?"},
],
addons=[
{
"url": "https://<addon-host>/.well-known/ai-plugin.json"
}
],
)
print(response)
This project uses Python>=3.11 and Poetry>=1.6.1 as a dependency manager.
Check out Poetry's documentation on how to install it on your system before proceeding.
To install requirements:
make install
This will install all requirements for running the package, linting, formatting and tests.
As of now, Windows distributions do not include the make tool. To run make commands, the tool can be installed using the following command (since Windows 10):
winget install GnuWin32.Make
For convenience, the tool folder can be added to the PATH environment variable as C:\Program Files (x86)\GnuWin32\bin
.
The command definitions inside Makefile should be cross-platform to keep the development environment setup simple.
Run the development server:
make serve
Copy .env.example to .env and customize it for your environment:
Variable | Default | Description |
---|---|---|
CONFIG_DIR | aidial_assistant/configs | Configuration directory |
LOG_LEVEL | INFO | Log level. Use DEBUG for dev purposes and INFO in prod |
OPENAI_API_BASE | OpenAI API Base | |
WEB_CONCURRENCY | 1 | Number of workers for the server |
TOOLS_SUPPORTING_DEPLOYMENTS | Comma-separated deployment names that support tools in chat completion request |
Run the server in Docker:
make docker_serve
Run the linting before committing:
make lint
To auto-fix formatting issues run:
make format
Run unit tests locally:
make test
To remove the virtual environment and build artifacts:
make clean