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
Copy Markdown

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
Copy Markdown

pingcap-cla-assistant bot commented Dec 22, 2025

CLA assistant check
All committers have signed the CLA.

Copy link
Copy Markdown
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.

Comment thread examples/rag/src/models.py Outdated
text: str = Field(sa_type=Text)

# table user_chart stores info of users
class Users(TableModel, table=True):
Copy link
Copy Markdown
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.

Comment thread examples/rag/src/models.py Outdated
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
Copy Markdown
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 thread examples/rag/src/utils.py Outdated
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
Copy Markdown
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')

Comment thread examples/.DS_Store
Copy link
Copy Markdown
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
Copy Markdown
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!

Comment thread examples/rag/README.md Outdated
"model": "gemma3:4b",
"prompt": "Hello, Who are you?"
}'
git clone https://github.com/cindywxw1/Intramind.git
Copy link
Copy Markdown
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

Comment thread examples/rag/README.md Outdated
@@ -1,89 +1,66 @@
# RAG Example
# Intramind
Copy link
Copy Markdown
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
Copy Markdown
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