Find answers from the community

Home
Members
Tungdepzai
T
Tungdepzai
Offline, last seen 4 months ago
Joined September 25, 2024
Hey, Im trying ReAct agent + gpt-4 vs llama2-7b. Both are the same code, only difference is the llm, any idea why llama2 is going on an endless loop instead of reasoning like gpt?
8 comments
V
T
Hey, im trying to setup react agent with llama2 but I keep get this error, can someone help?:

code:

selected_model = "ToolBench/ToolLLaMA-2-7b-v2" SYSTEM_PROMPT = """You are an AI assistant that answers questions in a friendly manner, based on the given source documents. Here are some rules you always follow: - Generate human readable output, avoid creating output with gibberish text. - Generate only the requested output, don't include any other language before or after the requested output. """ from llama_index.prompts import PromptTemplate query_wrapper_prompt = PromptTemplate( "[INST]<<SYS>>\n" + SYSTEM_PROMPT + "<</SYS>>\n\n{query_str}[/INST] " ) from llama_index.llms import HuggingFaceLLM import torch llm = HuggingFaceLLM( tokenizer={"return_token_type_ids": False}, context_window=4096, max_new_tokens=2048, generate_kwargs={"temperature": 0.0, "do_sample": False}, query_wrapper_prompt=query_wrapper_prompt, tokenizer_name=selected_model, model_name=selected_model, device_map="auto", tokenizer_kwargs={"max_length": 2000}, model_kwargs={"torch_dtype": torch.float16, "load_in_8bit": True, "use_auth_token": "XXXXX"}, ) from llama_index.agent import ReActAgent context_agent = ReActAgent.from_tools( tools=tools, max_function_calls=len(tools), llm=llm, verbose=True, system_prompt=plug.prompt, ) response = context_agent.chat(data)
16 comments
T
L
T
Tungdepzai
·

Agent

Hey, Im using OpenAIAgent.from_tools(), just wondering if I can do the same thing with llama2?
3 comments
L
T
I just updated to latest llama_index version and suddenly got error from this line: response = context_agent.stream_chat("HI", chat_history=[]), this didn't happen with previous versions, am I missing something? 🤔
5 comments
L
T
is there any update on agent tool's "return_direct"? I'm kinda blocked 😵‍💫
1 comment
L
Hey, I have a custom tool that returns in json format but the agent keep converting its output to natural language in response, how can I keep the json in the response.
Tool output: { "title": " Orders by Status", "names": ["Cancelled", "Shipped", "Shipped and Delivered"], "amount": [3, 14, 6] }
response: Here's a visualization of the of orders by status: - Cancelled: 3 orders - Shipped: 14 orders - Shipped and Delivered: 6 orders
5 comments
L
a
T
Hey, I'm trying to combine a keyword retriever along witha vector retriever as a tool for the agent. The setup I have uses bm25 which loads documents from mongodb but with big dataset it becomes overloaded, is there any way to fix this? pls help
9 comments
T
L
T
Tungdepzai
·

Bm25

is there any way to filter by metadata or document field when retrieving with bm25retriever from MongoDocumentStore? Please help
5 comments
T
L
hey, I have a big list of documents and Im trying to do VectorStoreIndex.from_documents on it but the embeddings generation takes very long, how can I fix this, thanks
6 comments
L
T
T
yes, I did look at this reader. The issue is that the file saved in mongodb is not saved as is but rather split into chunks (by GridFS), so m not sure if it would work.
2 comments
T
W
T
Tungdepzai
·

Table

Please help, I'm following this guide: https://docs.llamaindex.ai/en/stable/understanding/putting_it_all_together/structured_data.html#building-our-table-index
The table name saved into sqlite is 647f3c5170b47d535c175523/salesforceclimatedatasample but it keeps querying into salesforceclimatedatasample , llama_index version is 0.9.21, how do I fix this
4 comments
L
T
I was using mongoengine with the old llamaindex fine but running llamaindex-cli upgrade-file <file_path> gave this error, please help.
pydantic==1.10.8
llama-index==0.10.7
9 comments
L
T
hey all, is there any update on agent tool's "return_direct"?
1 comment
L
T
Tungdepzai
·

SQL

Using SQLTableRetrieverQueryEngine, Im following this demo: https://docs.llamaindex.ai/en/stable/examples/index_structs/struct_indices/SQLIndexDemo.html
the problem is I have to pass the exact keyword for the value, for example 'How many orders with status cancelled?' doesnt work but 'How many orders with status Cancelled?' works.
How can I improve/make it more generic
4 comments
T
W
there is data in chroma db itself but docstore.docs prints nothing, I tried VectorStoreIndex.from_documents too, same result. Im using chroma PersistentClient btw, very weird 🤔
7 comments
T
L
hey, is there any way to improve query of tabular data from vector index, more info here
29 comments
S
L
r
T
hey, I'm using use_async to build index from a lot of documents but it gives me Rate limit reached for text-embedding-ada-002 no matter how I adjust batch size. Changing to use_async = false fixes this but makes it very very slow and batch size dont apply when use_async = false for some reason. How can I embed a lot of documents quickly while without getting rate limit error? thank you!
3 comments
T
T
hey, I have a big list of documents and Im trying to do VectorStoreIndex.from_documents on it but the embeddings generation takes very long, how can I fix this, thanks
8 comments
T
W
L
Hey can someone please help me real quick, agent uses tools normally when model is gpt-4 but it never use tools when I use gpt-3.5-turbo-0613:
llm = OpenAI(model="")
context_agent = OpenAIAgent.from_tools(
qa_prompt=qa_prompt,
tools=tools,
max_function_calls=3,
llm=llm,
verbose=True,
)
I thought gpt-3.5-turbo-0613 should have function calling features, why does this happen? Thanks
6 comments
T
T
L
https://gpt-index.readthedocs.io/en/stable/examples/agent/openai_agent_context_retrieval.html#use-uber-10-q-as-context-use-calculator-as-tool
I am using ContextRetrieverOpenAIAgent from this example, I want to get context injection from different chunks of data from my index. The first example uses query engine tools and 2nd one uses retriever for this. How do they differ and which one should I use, thank you.
1 comment
L
Hey guys, I am trying to count total token used by an agent, completion, prompt, embedding,.... Using total_llm_token_count + total_embedding_token_count doesnt give accurate outcome.
2 comments
T
L
Hey guys, can someone help me, please. I am trying to make the ContextRetrieverOpenAIAgent use my tool, the tool is basically:
def draw_bar_graph(self, title, x_label, y_label, x_data, y_data): plt.bar(x_data, y_data) plt.title(title) plt.xlabel(x_label) plt.ylabel(y_label) image_name = str(uuid.uuid4()) image_path = os.path.join('src/assets', f'{image_name}.png') plt.savefig(image_path, format='png') return f"{image_name}.png"
How can I make the agent automatically give the parameters from queries like "draw a graph of world population growth in 2010"?
I have been messing with qa prompt and the tool it self to describe to the agent what to do but it does not give correct parameters.
3 comments
T
L
https://gpt-index.readthedocs.io/en/latest/examples/agent/openai_agent.html#our-slightly-better-openaiagent-implementation
Hey guys, in this document I'm reading, how can I combine the agent with index context and my chat history?
5 comments
T
L