Document metadata returns Fragment object instead of Dict #28027
Unanswered
simadimonyan
asked this question in
Ask Dosu
Replies: 3 comments 14 replies
-
@dosu I use this function in a Telegram bot # AI AGENT BUTTON
@dp.callback_query(F.data == "agent")
async def post_handler(call: CallbackQuery) -> None:
db = Database()
postLink, title, text = Habr.getNews()
docs = [
Document(
page_content=text,
metadata={"id": 1}
)
]
await db.store_data(docs)
await call.message.answer(f"done")
and this to get data. btw I store it into PostgreSQL by PGVector from bs4 import BeautifulSoup
import feedparser
import requests
class Habr:
def getNews():
parser = feedparser.parse("https://habr.com/ru/rss/news/?fl=ru")
title = parser.entries[0].title
postLink = parser.entries[0].link
response = requests.get(postLink)
soup = BeautifulSoup(response.text, 'html.parser')
text = ""
for post in soup.find_all('p'):
text += post.get_text()
return (postLink, title, text) |
Beta Was this translation helpful? Give feedback.
13 replies
-
Opened Issue: #28029 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have agent graph code
I have tools code
I have Database code
When I use Ollama:3.1:8b to answer the question by using RAG tools for searching the data I get
Beta Was this translation helpful? Give feedback.
All reactions