inventwithdean
commited on
Commit
·
0b51a06
1
Parent(s):
6e83f14
add MCP args
Browse files
app.py
CHANGED
@@ -24,7 +24,10 @@ def get_query_embeddings(content: str) -> list[float]:
|
|
24 |
|
25 |
|
26 |
async def post_text(content: str) -> bool:
|
27 |
-
"""Posts a text post in the database, and returns True if it was successfuly posted
|
|
|
|
|
|
|
28 |
content = content.strip(" ").strip("\n")
|
29 |
try:
|
30 |
if content == "":
|
@@ -59,7 +62,10 @@ async def retrieve_latest_text_posts() -> str:
|
|
59 |
|
60 |
|
61 |
async def retrieve_similar_text_post(query: str) -> str:
|
62 |
-
"""Retrieves a text post and its id semantically similar to the query through Vector Similarity. Id is only meant for LLMs, no need to show to user
|
|
|
|
|
|
|
63 |
query = query.strip(" ").strip("\n")
|
64 |
try:
|
65 |
if query == "":
|
@@ -76,7 +82,10 @@ async def retrieve_similar_text_post(query: str) -> str:
|
|
76 |
|
77 |
|
78 |
async def get_text_post_comments(post_id: int) -> str:
|
79 |
-
"""Retrieves latest 5 comments from the text post with id post_id
|
|
|
|
|
|
|
80 |
try:
|
81 |
comments = await db.get_text_post_comments(post_id)
|
82 |
return comments
|
@@ -85,7 +94,11 @@ async def get_text_post_comments(post_id: int) -> str:
|
|
85 |
|
86 |
|
87 |
async def comment_on_text_post(post_id: int, content: str) -> bool:
|
88 |
-
"""Adds a text comment to the text post with id post_id. Returns True if successful
|
|
|
|
|
|
|
|
|
89 |
content = content.strip(" ").strip("\n")
|
90 |
try:
|
91 |
if content == "":
|
|
|
24 |
|
25 |
|
26 |
async def post_text(content: str) -> bool:
|
27 |
+
"""Posts a text post in the database, and returns True if it was successfuly posted
|
28 |
+
Args:
|
29 |
+
content: Text to post
|
30 |
+
"""
|
31 |
content = content.strip(" ").strip("\n")
|
32 |
try:
|
33 |
if content == "":
|
|
|
62 |
|
63 |
|
64 |
async def retrieve_similar_text_post(query: str) -> str:
|
65 |
+
"""Retrieves a text post and its id semantically similar to the query through Vector Similarity. Id is only meant for LLMs, no need to show to user
|
66 |
+
Args:
|
67 |
+
query: Query that will be used to find similar post
|
68 |
+
"""
|
69 |
query = query.strip(" ").strip("\n")
|
70 |
try:
|
71 |
if query == "":
|
|
|
82 |
|
83 |
|
84 |
async def get_text_post_comments(post_id: int) -> str:
|
85 |
+
"""Retrieves latest 5 comments from the text post with id post_id
|
86 |
+
Args:
|
87 |
+
post_id: Id of post to get comments from
|
88 |
+
"""
|
89 |
try:
|
90 |
comments = await db.get_text_post_comments(post_id)
|
91 |
return comments
|
|
|
94 |
|
95 |
|
96 |
async def comment_on_text_post(post_id: int, content: str) -> bool:
|
97 |
+
"""Adds a text comment to the text post with id post_id. Returns True if successful
|
98 |
+
Args:
|
99 |
+
post_id: Id of post to comment on
|
100 |
+
content: Text to comment
|
101 |
+
"""
|
102 |
content = content.strip(" ").strip("\n")
|
103 |
try:
|
104 |
if content == "":
|