Sign In
Free Sign Up
  • English
  • Español
  • 简体中文
  • Deutsch
  • 日本語
Sign In
Free Sign Up
  • English
  • Español
  • 简体中文
  • Deutsch
  • 日本語

MyScaleDB x Dify: Building AI Apps Easily and Cost-Effectively

If you want to build AI applications quickly, Dify offers an efficient solution. If you’re looking for a vector database optimized for handling and retrieving vector data within Dify for your AI application, MyScaleDB (opens new window) is your best option. The SQL vector database MyScaleDB has been successfully integrated into Dify (opens new window), supporting vector retrieval, full-text search, and hybrid search. Developers can now leverage MyScaleDB’s powerful SQL capabilities and vector search functionalities while easily orchestrating and debugging prompts through Dify’s intuitive interface to create intelligent chatbots, text generation, and other AI applications. This integration simplifies AI application development and enhances engagement, injecting vitality and creativity into the AI community.

# What is Dify?

Dify (opens new window) is a next-generation open-source large language model (LLM) application development platform designed to help developers build and operate AI applications more easily and quickly.

It has the following key features and capabilities:

  • Visual Prompt Orchestration: Through interface-based prompt writing and debugging, developers can quickly create AI applications.
  • Dataset Management: Supports uploading and managing enterprise knowledge bases or product documents to build AI applications based on domain-specific knowledge.
  • API Integration: Provides user-friendly APIs that can be easily integrated into existing systems.
  • Out-of-the-Box Web Apps: Provides ready-to-use web application interfaces and supports further development.
  • Multi-Model Support: Integrates various large language models, such as the OpenAI GPT series and Claude, allowing developers to choose and compare models.
  • Low-Code Development: Provides a visual interface, enabling non-technical users to create and optimize AI applications.
  • Operations and Analytics Tools: Includes features like data labeling and log analysis to help continuously improve the performance of AI applications.

Dify is designed to make AI application development as simple as using cloud computing services, allowing developers to quickly turn their ideas into practical AI applications without delving into the underlying technical details. It is suitable for building various AI applications, such as intelligent chatbots, knowledge-base-powered Q&A systems, and text-generation tools.

# What is MyScaleDB?

MyScaleDB is an open-source, high-performance SQL vector database (opens new window) built on ClickHouse. It is fully compatible with SQL and supports vector search, filtered search, and SQL-vector joint queries. MyScaleDB unifies SQL databases, data warehouses, vector databases, and full-text search engines, providing efficient multi-modal data management.

In terms of LLM application observability, MyScaleDB excels at storing massive agent execution log data. MyScaleDB Telemetry collects and analyzes disparate data while RAG (Retrieval-Augmented Generation) systems run on MyScaleDB, providing valuable insights into this data. This helps users optimize agent workflows, tune models, and continuously improve the system's reliability and performance based on the data analysis.

Moreover, MyScaleDB is explicitly designed to build and scale AI applications. It helps developers efficiently create and expand AI applications using familiar SQL while ensuring powerful data processing capabilities. MyScaleDB is suitable for AI application scenarios that require handling large-scale vector data and performing complex queries in combination with structured data.

Boost Your AI App Efficiency now
Sign up for free to benefit from 150+ QPS with 5,000,000 vectors
Free Trial
Explore our product

# How to Use MyScaleDB in Dify

With a solid understanding of how Dify enhances AI application development and the foundational capabilities it offers, coupled with MyScaleDB’s robust features for managing large-scale vector data and optimizing AI application performance, let’s now explore integrating MyScaleDB within Dify to enhance functionality and scalability further:

# Create a MyScaleDB Cluster

Dify supports both the open-source MyScaleDB and the enterprise-level MyScale Cloud (opens new window). If you prefer the open-source version of MyScaleDB, you can skip this section. For MyScale Cloud, visit https://console.MyScaleDB.com (opens new window), register, log in, and click the "New Cluster" button in the top right corner to create your MyScale Cluster.

Creat cluster

After entering the Cluster name, click the "Next" button and wait for the cluster to finish starting up.

Start cluster

Click the "Actions" button on the right side of the cluster. Then select "Connection Details" from the pop-up list. Record the host/port/username/password information from the "Python" tab. This information will be used to configure Dify's access to the MyScale Cluster.

Cluster connection

# Configure and Run Dify

To integrate MyScale with Dify, begin by deploying Dify.

Refer to the official documentation (opens new window) for detailed instructions.

Before starting Dify with docker-compose, ensure you modify the .env file and fill in the MyScale-related configurations:

  • Set VECTOR_STORE to MyScale
VECTOR_STORE=MyScale
  • If you are using MyScale Cloud, adjust the relevant configurations (you can leave MyScale_DATABASE unchanged) based on the details obtained from the MyScale Cloud web page. If you are using the open-source MyScaleDB, no changes are needed for the following configurations:
MyScale_HOST=MyScale
MyScale_PORT=8123
MyScale_USER=default
MyScale_PASSWORD=
MyScale_DATABASE=dify
  • If you need to support multiple languages, such as Chinese documents, please refer to the MyScale official documentation (opens new window) to configure the MyScale_FTS_PARAMS parameter. For example, to use the Chinese tokenizer, use the following SQL to create a full-text index in MyScale (assuming the text information is in the column named "text" in the MyScale table):
ALTER TABLE [table_name] ADD INDEX text_idx text
TYPE fts('{"text":{"tokenizer":{"type":"chinese",
"case_sensitive":false}}}');

Accordingly, modify MyScale_FTS_PARAMS as:

MyScale_FTS_PARAMS='{"text":{"tokenizer":{"type":"chinese",
"case_sensitive":false}}}'
  • After making these modifications, start Dify as follows:
docker compose up -d

When using Dify knowledge base (opens new window) function, users have the option to integrate MyScaleDB, which supports vector retrieval, full-text retrieval, and hybrid retrieval methods. And then, users can select one of these retrieval methods when creating the knowledge base (opens new window).

Join Our Newsletter

# Benefits for Developers

Dify and MyScaleDB together offer a comprehensive suite of tools and capabilities designed to enhance the developer experience. Below are some key benefits for developers utilizing these platforms:

# Easily Start to Develop Your AI Applications

Dify creates a low-code development environment that streamlines the development process with intuitive visual tools and a range of pre-built features. This empowers both developers and non-technical users to actively engage in creating and optimizing AI applications.

Concurrently, MyScaleDB’s full SQL compatibility enables developers to leverage familiar SQL syntax for tasks such as vector search, filtered search, and SQL-vector joint queries, eliminating the need to master complex new tools or frameworks. Moreover, MyScaleDB offers a unified platform for managing and processing structured data, vector data, text, and other data types, thereby simplifying the overall development process. This combined approach significantly lowers the learning curve associated with AI application development and operation, enabling rapid deployment and scalability of AI solutions

# High Performance and Scalability

Dify has included a high-quality Retrieval-Augmented Generation (RAG) engine, which can effectively improve the accuracy and response speed of knowledge-based AI applications. Dify is designed to support rapid application scaling, allowing users to easily expand the scale and functionality of AI applications as business needs grow. Dify also provides features like prompt engineering, context management, log analysis, and data annotation to help users continuously optimize their AI applications.

MyScaleDB leverages advanced OLAP database architecture and its self-developed MSTG vector algorithm to not only easily scale applications but also ensure fast vector search. MyScaleDB Telemetry provides functionality similar to LangSmith for improving the observability and evaluation of LLM applications. By seamlessly integrating with LangChain Callbacks, it captures detailed trace data and stores it in MyScaleDB, facilitating problem diagnosis, performance optimization, and understanding application behavior.

# Cost-Effective

Dify has integrated with various vector databases, allowing users to choose the appropriate underlying database based on their needs. As the only SQL vector database integrated with Dify, MyScaleDB not only provides vector search, full-text search, and hybrid search in the same database without the need for additional Elasticsearch, but also has a significant advantage in basic retrieval performance when processing large-scale data, compared to other specialized vector databases like Weaviate and Qdrant.

MyScale Benchmark

# Looking Ahead

Looking to the future, MyScaleDB and Dify will continue to deepen their collaboration, jointly exploring more innovative AI application directions. We believe that this strong partnership will bring more convenient and efficient tools to developers, driving the widespread application of AI technology in various fields.

MyScaleDB will also remain committed to innovating and developing high-performance vector databases, continuously improving our technical capabilities and service levels, and injecting more vitality and momentum into the open-source community and the AI ecosystem. Let's join hands and move forward, driving the arrival of the AI era and creating a smarter, more convenient future.

In subsequent articles, we will showcase how to easily build AI applications using MyScaleDB and Dify. If you would like to continue discussing or share your use cases of MyScaleDB and Dify, feel free to contact us on Discord (opens new window).

Keep Reading
images
Understanding Vector Indexing: A Comprehensive Guide

In our ongoing exploration of advanced RAG, we've covered the core principles and applications of this powerful technique. Now, we turn our attention to a crucial component that underpins the efficie ...

Start building your Al projects with MyScale today

Free Trial
Contact Us