os.environ["OPENAI_API_KEY"] = "sk-" import nest_asyncio nest_asyncio.apply() from llama_index import SimpleDirectoryReader documents = SimpleDirectoryReader(input_dir='rag_data_dir').load_data() from services.dense_pack.base import DenseXRetrievalPack from llama_index.llms import OpenAI from llama_index.text_splitter import SentenceSplitter dense_pack = DenseXRetrievalPack( documents, proposition_llm=OpenAI(model="gpt-3.5-turbo", max_tokens=750), query_llm=OpenAI(model="gpt-3.5-turbo", max_tokens=256), text_splitter=SentenceSplitter(chunk_size=1024), ) dense_query_engine = dense_pack.query_engine
AttributeError: 'OpenAI' object has no attribute 'apredict'
when running on python 3.10.x2023-08-15 22:10:48 sqlalchemy.exc.ProgrammingError: (pymysql.err.ProgrammingError) (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT player_name, player_position\nFROM players\nJOIN clubs ON players.player_cl' at line 6") 2023-08-15 22:10:48 [SQL: SELECT COUNT(*) AS num_players 2023-08-15 22:10:48 FROM players 2023-08-15 22:10:48 JOIN clubs ON players.player_club_id = clubs.club_id 2023-08-15 22:10:48 WHERE clubs.club_name = 'Arsenal FC'; 2023-08-15 22:10:48 2023-08-15 22:10:48 SELECT player_name, player_position 2023-08-15 22:10:48 FROM players 2023-08-15 22:10:48 JOIN clubs ON players.player_club_id = clubs.club_id 2023-08-15 22:10:48 WHERE clubs.club_name = 'Arsenal FC' 2023-08-15 22:10:48 LIMIT 5;] 2023-08-15 22:10:48 (Background on this error at: https://sqlalche.me/e/20/f405) 2023-08-15 22:10:48 192.168.112.5 - - [15/Aug/2023 15:10:48] "POST /chat HTTP/1.0" 500 -
sql_engine = get_sql_engine(env) sql_database = SQLDatabase(sql_engine) builder = SQLContextContainerBuilder(sql_database) context_builder = builder.build_context_container() service_context = ServiceContext.from_defaults(llm=api.llm) index = GPTSQLStructStoreIndex([], sql_database=sql_database, sql_context_container=context_builder, service_context=service_context)
sqlalchemy.exc.ProgrammingError: (pymysql.err.ProgrammingError) (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Given an input question, first create a syntactically correct mysql query to run' at line 1") [SQL: Given an input question, first create a syntactically correct mysql query to run, then look at the results of the query and return the answer. You can order the results by a relevant column to return the most interesting examples in the database. Never query for all the columns from a specific table, only ask for a few relevant columns given the question. Pay attention to use only the column names that you can see in the schema description. Be careful to not query for columns that do not exist. Pay attention to which column is in which table. Also, qualify column names with the table name when needed. Use the following format: Question: Question here SQLQuery: SQL Query to run] (Background on this error at: https://sqlalche.me/e/20/f405) >>> response = query_engine.query("Which club play in England Premier League?"