OK… great example i was working on a sub directory by importing folders and content as reference and the ai in the api will understand if u put the correct coding like i made this real quick for an example. is not working but can make it work
“”"
import json
def import_documents(file_path):
with open(file_path, ‘r’) as file:
documents = json.load(file)
return documents
def compare_documents(article, documents):
matching_documents =
# Split the article into chunks of characters up to 1000
article_chunks = [article[i:i+1000] for i in range(0, len(article), 1000)]
for document in documents:
for chunk in article_chunks:
if chunk in document:
matching_documents.append(document)
break
return matching_documents# Example usage
file_path = ‘documents.json’ # Replace with the actual file path
article = “This is the article content.” # Replace with your article content
documents = import_documents(file_path)
matching_docs = compare_documents(article, documents)
Output the matching documents
for doc in matching_docs:
print(doc)
this is an example of the same thing but with the abilities to use outside Resorces and u just add to it dud ur not giving any information other than trying to raddle off ideas **"import json
def import_documents(file_path):
with open(file_path, ‘r’) as file:
documents = json.load(file)
return documents
def compare_documents(content, documents):
matching_documents =
# Split the content into chunks of characters up to 1000
content_chunks = [content[i:i+1000] for i in range(0, len(content), 1000)]
for document in documents:
for chunk in content_chunks:
if chunk in document:
matching_documents.append(document)
break
return matching_documents
def import_external_document(file_path):
with open(file_path, ‘r’) as file:
document = file.read()
return document
def analyze_blog_pages(blog_pages, documents):
matching_docs =
for page in blog_pages:
matching_page_docs = compare_documents(page, documents)
matching_docs.extend(matching_page_docs)
if len(matching_docs) > 0:
break
return matching_docs
Example usage
file_path = ‘documents.json’ # Replace with the actual file path
external_doc_path = ‘external_document.txt’ # Replace with the actual external document file path
documents = import_documents(file_path)
external_doc = import_external_document(external_doc_path)
Example blog pages
blog_pages = [
“This is the content of the first blog page. It has some information related to the topic.”,
“The second blog page continues the discussion with more details and examples.”,
“On the third blog page, we dive deeper into the subject matter and provide insights from experts.”
]
matching_docs = analyze_blog_pages(blog_pages, documents)
matching_external_docs = compare_documents(external_doc, documents)
Output the matching documents
print(“Matching documents from blog pages:”)
for doc in matching_docs:
print(doc)
print(“\nMatching documents from the external document:”)
for ext_doc in matching_external_docs:
print(ext_doc)
“”
Summary
each problem has to be handled different there not all the same
** trial error, dude it worked when i put my correct information in but not in all cases it in which requires editing and trying diffrent things in diffrent ways. it’s all trial and error, I’m working off my head u can ask ChatGPT if u don’t know very useful tool.