Skip to content

feat: upgraded rag model from ollama to chatgpt#256

Open
yk-chenyang wants to merge 3 commits intopingcap:mainfrom
yk-chenyang:feature/openai-ver-rag
Open

feat: upgraded rag model from ollama to chatgpt#256
yk-chenyang wants to merge 3 commits intopingcap:mainfrom
yk-chenyang:feature/openai-ver-rag

Conversation

@yk-chenyang
Copy link

Under guidance of Mr. Hao Huo (@github.com/sykp241095), Cindy Wang (@github.com/cindywxw1) and I built an RAG-driven AI Chatbot that used OpenAI's LLM models. We would love to contribute to PingCAP's amazing community, so we would like to update the RAG example in PyTiDB's repo with our new OpenAI models. Hope everyone will enjoy this new example and get to enjoy the capability of PyTiDB!

@pingcap-cla-assistant
Copy link

pingcap-cla-assistant bot commented Dec 22, 2025

CLA assistant check
All committers have signed the CLA.

Copy link
Member

@Mini256 Mini256 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do not replace the existing example, add a new exmaple instead. For example: examples/chatbot_with_rag.

text: str = Field(sa_type=Text)

# table user_chart stores info of users
class Users(TableModel, table=True):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
class Users(TableModel, table=True):
class User(TableModel, table=True):

Table Model class names can use singular forms.

document_name: str = Field(sa_type=Text)

# table chat_history that stores the references to chat sessions of all users. Each row stores info of a session that chat_message represents
class ChatHistory(TableModel, table=True):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
class ChatHistory(TableModel, table=True):
class Chat(TableModel, table=True):

ChatHistory -> Chat Would be better?

Comment on lines 39 to 40
ch_table = db.create_table(schema=ChatHistory, if_exists='skip')
cm_table = db.create_table(schema=ChatMessage, if_exists='skip')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ch_table = db.create_table(schema=ChatHistory, if_exists='skip')
cm_table = db.create_table(schema=ChatMessage, if_exists='skip')
chat_table = db.create_table(schema=ChatHistory, if_exists='skip')
message_table = db.create_table(schema=ChatMessage, if_exists='skip')

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid commit .DS_Store to git repo

Copy link
Member

@Mini256 Mini256 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Thanks for your contribution!

"model": "gemma3:4b",
"prompt": "Hello, Who are you?"
}'
git clone https://github.com/cindywxw1/Intramind.git
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
git clone https://github.com/cindywxw1/Intramind.git
git clone https://github.com/pingcap/pytidb.git
cd examples/chatbot_with_rag

@@ -1,89 +1,66 @@
# RAG Example
# Intramind
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Intramind
# Chatbot with RAG

using a general name would be better.

@yk-chenyang
Copy link
Author

@Mini256 Thank you for your comments! I've updated commits accordingly. Please check again to see if this can be finalized, and I'll be here if there're any further modifications to be made.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants