code: # Just runs .complete to make sure the LLM is listening
  from llama_index.llms import Ollama
  from pathlib import Path
  import qdrant_client
  from llama_index import (
      VectorStoreIndex,
      ServiceContext,
      download_loader,
  )
  from llama_index.llms import Ollama
  from llama_index.storage.storage_context import StorageContext
  from llama_index.vector_stores.qdrant import QdrantVectorStore
  
  
  JSONReader = download_loader("JSONReader")
  loader = JSONReader()
  
  class Ollama_model:
      def __init__(self, model="mistral"):
          self.llm = Ollama(model=model)
          self.documents = loader.load_data(Path('./data/tinytweets.json'))
          self.client = qdrant_client.QdrantClient(
              path="./qdrant_data"
          )
          self.vector_store = QdrantVectorStore(client=self.client, collection_name="tweets")
          self.storage_context = StorageContext.from_defaults(vector_store=self.vector_store)
          self.service_context = ServiceContext.from_defaults(llm=self.llm,embed_model="local")
          self.index = VectorStoreIndex.from_documents(self.documents,service_context=self.service_context,storage_context=self.storage_context)
          self.query_engine = self.index.as_query_engine()
  
      def get_answer(self, input):        
          response = self.query_engine.query(input)
          return response
  
      def change_dataset(self, name, filename):
          print(filename)
          self.documents = loader.load_data(Path('./uploads/'+filename))
          self.vector_store = QdrantVectorStore(client=self.client, collection_name=name)
          self.storage_context = StorageContext.from_defaults(vector_store=self.vector_store)
          self.index = VectorStoreIndex.from_documents(self.documents,service_context=self.service_context,storage_context=self.storage_context)
          self.query_engine = self.index.as_query_engine()
  
  
apis: llama_index.VectorStoreIndex.from_documents llama_index.vector_stores.qdrant.QdrantVectorStore llama_index.ServiceContext.from_defaults llama_index.storage.storage_context.StorageContext.from_defaults llama_index.llms.Ollama llama_index.download_loader
extract_api: [((406, 435), 'llama_index.download_loader', 'download_loader', (['"""JSONReader"""'], {}), "('JSONReader')\n", (421, 435), False, 'from llama_index import VectorStoreIndex, ServiceContext, download_loader\n'), ((539, 558), 'llama_index.llms.Ollama', 'Ollama', ([], {'model': 'model'}), '(model=model)\n', (545, 558), False, 'from llama_index.llms import Ollama\n'), ((655, 703), 'qdrant_client.QdrantClient', 'qdrant_client.QdrantClient', ([], {'path': '"""./qdrant_data"""'}), "(path='./qdrant_data')\n", (681, 703), False, 'import qdrant_client\n'), ((754, 817), 'llama_index.vector_stores.qdrant.QdrantVectorStore', 'QdrantVectorStore', ([], {'client': 'self.client', 'collection_name': '"""tweets"""'}), "(client=self.client, collection_name='tweets')\n", (771, 817), False, 'from llama_index.vector_stores.qdrant import QdrantVectorStore\n'), ((849, 909), 'llama_index.storage.storage_context.StorageContext.from_defaults', 'StorageContext.from_defaults', ([], {'vector_store': 'self.vector_store'}), '(vector_store=self.vector_store)\n', (877, 909), False, 'from llama_index.storage.storage_context import StorageContext\n'), ((941, 1004), 'llama_index.ServiceContext.from_defaults', 'ServiceContext.from_defaults', ([], {'llm': 'self.llm', 'embed_model': '"""local"""'}), "(llm=self.llm, embed_model='local')\n", (969, 1004), False, 'from llama_index import VectorStoreIndex, ServiceContext, download_loader\n'), ((1025, 1153), 'llama_index.VectorStoreIndex.from_documents', 'VectorStoreIndex.from_documents', (['self.documents'], {'service_context': 'self.service_context', 'storage_context': 'self.storage_context'}), '(self.documents, service_context=self.\n    service_context, storage_context=self.storage_context)\n', (1056, 1153), False, 'from llama_index import VectorStoreIndex, ServiceContext, download_loader\n'), ((1490, 1549), 'llama_index.vector_stores.qdrant.QdrantVectorStore', 'QdrantVectorStore', ([], {'client': 'self.client', 'collection_name': 'name'}), '(client=self.client, collection_name=name)\n', (1507, 1549), False, 'from llama_index.vector_stores.qdrant import QdrantVectorStore\n'), ((1581, 1641), 'llama_index.storage.storage_context.StorageContext.from_defaults', 'StorageContext.from_defaults', ([], {'vector_store': 'self.vector_store'}), '(vector_store=self.vector_store)\n', (1609, 1641), False, 'from llama_index.storage.storage_context import StorageContext\n'), ((1663, 1791), 'llama_index.VectorStoreIndex.from_documents', 'VectorStoreIndex.from_documents', (['self.documents'], {'service_context': 'self.service_context', 'storage_context': 'self.storage_context'}), '(self.documents, service_context=self.\n    service_context, storage_context=self.storage_context)\n', (1694, 1791), False, 'from llama_index import VectorStoreIndex, ServiceContext, download_loader\n'), ((601, 631), 'pathlib.Path', 'Path', (['"""./data/tinytweets.json"""'], {}), "('./data/tinytweets.json')\n", (605, 631), False, 'from pathlib import Path\n'), ((1433, 1462), 'pathlib.Path', 'Path', (["('./uploads/' + filename)"], {}), "('./uploads/' + filename)\n", (1437, 1462), False, 'from pathlib import Path\n')]