Find answers from the community

s
F
Y
a
P
Updated 2 years ago

Hello

Hello.
I'm working on a project about generating some sentences based on specific documents. Should I use llama_index here? I'm wondering about the difference between purpose of use of llama_index and lang_chain. Since I'm currently doing task about 'text generation', can llama_index only be used for 'Qusetion-Answering' Task?
L
s
11 comments
Llama Index can definitely be used for more than QA, depending on the prompt you give the system. If you have a lot of text and want to generate similar text, I think Llama Index is a good choice.

LangChain is more of a chat-frontend when you need a chatbot (And Llama Index can be used with that as well!)
Thanks for the answer!

According to your answer, if I want to generate some texts with llama-index, then it can be done by using prompt such as "generate a post related to {context}....".

So it would be possible to modify a sentence by referencing a document or embedding stored as an index in llama-index?
Pretty much!

Lets say you had a bunch of poems in an index. Then you could query the index with something like this: index.query("In the style of the existing context, write a poem about snow", similarity_top_k=3)

This is just a simple example though, but I think would work πŸ‘
Thanks! I think when it generates a poem somehow, I can also see the source of the poem by .get_formatted_sources(), right?

By the way, I was thinking of a system to edit essays based on a specific document DB.
Exactly, that function will show which pieces of text were used to build the generated poem

I think that's a super cool idea btw! πŸ’ͺ
If I don't plan on using a chat front-end, then llama will do just fine! Thanks.
Oh, I have a one last question! Does service_context prevent the InvalidRequestError which is occured because of context length? Is this a kind of same role as split text in langchain?
Yea, llama index tries to ensure that everything sent to the LLM is within the max context length. The PromptHelper and ServiceContext objects provide some additional settings for this πŸ‘

https://gpt-index.readthedocs.io/en/latest/guides/primer/usage_pattern.html#customizing-llm-s
Thanks. It really helps me a lot.
Hope you have a nice day πŸ™‚
Glad I could help, have a good one too! πŸ‘‹
Add a reply
Sign up and join the conversation on Discord