You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to compressed prompt which is in markdown format which contains images and their links or contain any other website link. This is what I have before compression:
I Found a Frog is a story describing
the unique transformation of
a Tadpole into a frog. It is fun,
educational, and just may have you
catching a Tadpole so you and your
child can see it for
yourself
Published by
Monkey Pen Ltd
Illustrated by
www.maaillustrations.com
Please share our books with your friends and
family to support our mission. Thank you
![Image 1](./IFOUNDAFROGFreeChildrensBookByMonkeyPen_page_19_image_1.png)
My mother just chuckled when I yelled out,
�I found a frog on my bed.�
Now, she knew that I would eventually find one
but she let me discover a wonder of Nature
that many people miss.
I am glad she did.
![Image 1](./IFOUNDAFROGFreeChildrensBookByMonkeyPen_page_5_image_1.png)
![Image 2](./IFOUNDAFROGFreeChildrensBookByMonkeyPen_page_5_image_2.png)
I Found a Frog is a story describing the unique
transformation of a Tadpole into a frog. It
is fun, educational, and just may have you
catching a Tadpole so you and your child can
see it for yourself
Published by Monkey Pen Ltd
![Image 1](./IFOUNDAFROGFreeChildrensBookByMonkeyPen_page_2_image_1.png)
I asked what she meant and
she just said that I would have to
wait and see, but to watch my fish carefully.
![Image 1](./IFOUNDAFROGFreeChildrensBookByMonkeyPen_page_11_image_1.png)
![Image 2](./IFOUNDAFROGFreeChildrensBookByMonkeyPen_page_11_image_2.png)
Dear Supporter,
Thank you for downloading our children's books.
Monkey Pen's Vision is to provide thousands of free children's
books to young readers around the globe.
Please share our books with your friends and family to
support our mission. Thank you
Please make a donation on Patreon to support
Monkey Pens Free Book Project:
"![Image 1](./IFOUNDAFROGFreeChildrensBookByMonkeyPen_page_3_image_1.png) "
After we talked about my catching
some of the fish I saw, and
the responsibility of having a pet, she agreed.
![Image 1](./IFOUNDAFROGFreeChildrensBookByMonkeyPen_page_7_image_1.png)
![Image 2](./IFOUNDAFROGFreeChildrensBookByMonkeyPen_page_7_image_2.png)
This is what I got After Compression: ['Found a Frog story transformation Tadpole into frog fun educational catching Tadpole Published by Monkey Pen Ltd Illustrated by.maaillustrations share books friends family support mission Thank you[Image 1]/IFOUNDAFROGFreeChildrensBookByMonkeyPen_page_19_image_1.png mother chuckled found frog on bed.� knew find let discover wonder Nature glad did[Image 1]/IFOUNDAFROGFreeChildrensBookByMonkeyPen_page_5_image_1.png[Image 2]_page_5_image_2.png Found a Frog story transformation Tadpole into frog fun educational catching Tadpole Published Monkey Pen Ltd[Image 1]/IFOUNDAFROGFreeChildrensBookByMonkeyPen_page_2_image_1.png']["asked she said wait see watch fish 1/IFOUNDAFROGFreeChildrensBookByMonkeyPen_page_11_image_1.png 2]_page_11_image_2.png Supporter downloading children's books Monkey Pen's Vision provide thousands free children's books young readers share books friends family support mission make donation Patreon support Monkey Pens Free Book Project 1]/IFOUNDAFROGFreeChildrensBookByMonkeyPen_page_3_image_1.png talked catching fish responsibility pet she agreed 1/IFOUNDAFROGFreeChildrensBookByMonkeyPen_page_7_image_1.png 2]_page_7_image_2.png"]
As you can see the compressed prompt is not structed and all the links are broken. This is my code:
class ContextCompressor:
def __init__(self):
self.logger = LogManager(__name__).get_logger()
self.llm_lingua = PromptCompressor(
# model_name="microsoft/llmlingua-2-bert-base-multilingual-cased-meetingbank",
model_name="microsoft/llmlingua-2-xlm-roberta-large-meetingbank",
model_config={"revision": "main"},
use_llmlingua2=True,
device_map="cpu",
)
self.model_name = "llama3.2:1b"
def compress_query_prompt(self,retrieved_content,query):
demonstration_str = retrieved_content
instruction = '''Write a high-quality answer for the given question using only the provided search results. Do not ignore any entity related to user otherwise you will be penalized .Maintain the relevance and accuracy of the information while ensuring the response is concise and clear. Include ALL URLs.
Do not summarize or change any image url or image detail. Give it as it is otherwise you will be penalized.
Extract and include any URLs from the context only that are directly related to the user's query. Ensure the URLs are clickable and clearly linked in the response appropriately.
Always provide all relevant image or media URLs from the context in your response. Ensure that these URLs are only those provided from the context and are relevant to the user's query. If there are multiple relevant image or media links, include all of them in the response.Provide URLs as well as in the response if possible, and answer as an associate from talking to the user
Generate Output in a markdown format.
'''
question = query
compressed_prompt = self.llm_lingua.compress_prompt(
context=[str(demonstration_str)],
instruction=str(instruction),
question=str(question),
context_budget="+600",
token=['[',']','!','.']
)
return str(compressed_prompt['compressed_prompt_list'])
As you can see images are not in proper format.
Even links are broken(www.maaillustrations.com) in compressed prompts.
is there something I am missing or this feature is not supported by repo.
please suggest me how to fix it.
The text was updated successfully, but these errors were encountered:
Describe the issue
I want to compressed prompt which is in markdown format which contains images and their links or contain any other website link.
This is what I have before compression:
This is what I got After Compression:
['Found a Frog story transformation Tadpole into frog fun educational catching Tadpole Published by Monkey Pen Ltd Illustrated by.maaillustrations share books friends family support mission Thank you[Image 1]/IFOUNDAFROGFreeChildrensBookByMonkeyPen_page_19_image_1.png mother chuckled found frog on bed.� knew find let discover wonder Nature glad did[Image 1]/IFOUNDAFROGFreeChildrensBookByMonkeyPen_page_5_image_1.png[Image 2]_page_5_image_2.png Found a Frog story transformation Tadpole into frog fun educational catching Tadpole Published Monkey Pen Ltd[Image 1]/IFOUNDAFROGFreeChildrensBookByMonkeyPen_page_2_image_1.png']["asked she said wait see watch fish 1/IFOUNDAFROGFreeChildrensBookByMonkeyPen_page_11_image_1.png 2]_page_11_image_2.png Supporter downloading children's books Monkey Pen's Vision provide thousands free children's books young readers share books friends family support mission make donation Patreon support Monkey Pens Free Book Project 1]/IFOUNDAFROGFreeChildrensBookByMonkeyPen_page_3_image_1.png talked catching fish responsibility pet she agreed 1/IFOUNDAFROGFreeChildrensBookByMonkeyPen_page_7_image_1.png 2]_page_7_image_2.png"]
As you can see the compressed prompt is not structed and all the links are broken.
This is my code:
As you can see images are not in proper format.
Even links are broken(www.maaillustrations.com) in compressed prompts.
is there something I am missing or this feature is not supported by repo.
please suggest me how to fix it.
The text was updated successfully, but these errors were encountered: