R2R
R2R copied to clipboard
AttributeError: 'list' object has no attribute 'items'
Describe the bug A clear and concise description of what the bug is.
To Reproduce Steps to reproduce the behavior:
- Go to R2R_Application
- Run pnpm start
[email protected] start next start
▲ Next.js 14.2.5
- Local: http://localhost:3000
✓ Starting... ⚠ "next start" does not work with "output: standalone" configuration. Use "node .next/standalone/server.js" instead. ✓ Ready in 203ms 4. Upload *.pdf document 5. See error
(r2r-py3.11) (base)
- 'underscore_attrs_are_private' has been removed warnings.warn(message, UserWarning) 2024-09-11 13:14:40,815 - INFO - core.base.providers.embedding - Initializing EmbeddingProvider with config extra_fields={} provider='ollama' base_model='mxbai-embed-large' base_dimension=1024 rerank_model=None rerank_dimension=None rerank_transformer_type=None batch_size=128 prefixes=None add_title_as_prefix=True concurrent_request_limit=2 max_retries=2 initial_backoff=1.0 max_backoff=60.0. 2024-09-11 13:14:40,815 - INFO - core.providers.embeddings.ollama - Using Ollama API base URL: http://127.0.0.1:11434 2024-09-11 13:14:40,845 - INFO - core.base.providers.llm - Initializing CompletionProvider with config: extra_fields={} provider='litellm' generation_config=GenerationConfig(model='ollama/llama3.1', temperature=0.1, top_p=1.0, max_tokens_to_sample=1024, stream=False, functions=None, tools=None, add_generation_kwargs={}, api_base=None) concurrent_request_limit=1 max_retries=2 initial_backoff=1.0 max_backoff=60.0 2024-09-11 13:14:40,855 - INFO - core.base.providers.database - Initializing DatabaseProvider with config extra_fields={} provider='postgres' user=None password=None host=None port=None db_name=None vecs_collection=None. 2024-09-11 13:14:40,855 - INFO - core.providers.database.vector - Using TCP connection 2024-09-11 13:14:40,872 - INFO - core.providers.database.vector - Successfully initialized PGVectorDB with collection: sb_vec_db 2024-09-11 13:14:40,874 - INFO - core.base.providers.prompt - Initializing PromptProvider with config extra_fields={} provider='r2r' default_system_name='default_system' default_task_name='default_rag' file_path=None. 2024-09-11 13:14:40,875 - INFO - core.providers.prompts.r2r_prompts - Created table prompts 2024-09-11 13:14:40,875 - INFO - core.providers.prompts.r2r_prompts - Loading prompts from <path_to>/core/providers/prompts/defaults 2024-09-11 13:14:40,889 - INFO - core.providers.auth.r2r_auth - Default admin user already exists. 2024-09-11 13:14:40,889 - WARNING - core.providers.parsing.unstructured_parsing - Excluded parsers are not supported by the unstructured parsing provider. 2024-09-11 13:14:41,608 - INFO - core.main.assembly.factory - Initializing PostgresFileProvider 2024-09-11 13:14:41,609 - INFO - core.providers.file.postgres - Created table file_storage External Ollama instance detected and responsive. R2R now runs on port 7272 by default! [INFO] 🪓 -- 2024-09-11 13:14:43,587 - ------------------------------------------ [INFO] 🪓 -- 2024-09-11 13:14:43,587 - STARTING HATCHET... [INFO] 🪓 -- 2024-09-11 13:14:43,592 - starting runner... INFO: Started server process [66303] INFO: Waiting for application startup. INFO: Application startup complete. INFO: Uvicorn running on http://0.0.0.0:7272 (Press CTRL+C to quit) INFO: 127.0.0.1:42220 - "POST /v2/login HTTP/1.1" 200 OK INFO: 127.0.0.1:42220 - "OPTIONS /v2/app_settings HTTP/1.1" 200 OK cc 2024-09-11 13:15:05,610 - ERROR - core.main.api.base_router - Error in base endpoint app_settings() -
'list' object has no attribute 'items' Traceback (most recent call last): File "<path_to>/core/main/api/base_router.py", line 51, in wrapper results = await func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "<path_to>/core/main/api/management_router.py", line 220, in app_settings return await self.service.app_settings() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "<path_to>/core/telemetry/telemetry_decorator.py", line 17, in async_wrapper result = await func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "<path_to>/core/main/services/management_service.py", line 194, in app_settings name: prompt.dict() for name, prompt in prompts.items() ^^^^^^^^^^^^^ AttributeError: 'list' object has no attribute 'items' INFO: 127.0.0.1:42230 - "GET /v2/app_settings HTTP/1.1" 500 Internal Server Error INFO: 127.0.0.1:42230 - "GET /v2/health HTTP/1.1" 200 OK INFO: 127.0.0.1:42220 - "OPTIONS /v2/logs?run_type_filter=&max_runs=1000 HTTP/1.1" 200 OK INFO: 127.0.0.1:42230 - "GET /v2/health HTTP/1.1" 200 OK INFO: 127.0.0.1:42220 - "OPTIONS /v2/server_stats HTTP/1.1" 200 OK INFO: 127.0.0.1:42230 - "GET /v2/server_stats HTTP/1.1" 200 OK INFO: 127.0.0.1:42238 - "GET /v2/logs?run_type_filter=&max_runs=1000 HTTP/1.1" 200 OK INFO: 127.0.0.1:42230 - "GET /v2/server_stats HTTP/1.1" 200 OK INFO: 127.0.0.1:42230 - "OPTIONS /v2/documents_overview HTTP/1.1" 200 OK INFO: 127.0.0.1:42238 - "GET /v2/documents_overview HTTP/1.1" 200 OK INFO: 127.0.0.1:40744 - "OPTIONS /v2/ingest_files HTTP/1.1" 200 OK 2024-09-11 13:15:23,847 - INFO - core.main.api.ingestion_router - No chunking config override provided. Using default. INFO: 127.0.0.1:40754 - "POST /v2/ingest_files HTTP/1.1" 200 OK INFO: 127.0.0.1:40754 - "GET /v2/documents_overview HTTP/1.1" 200 OK [INFO] 🪓 -- 2024-09-11 13:15:24,629 - rx: start step run: dc44d36c-3cbf-458d-b230-95d59dc97176/ingest-file:parse_file [INFO] 🪓 -- 2024-09-11 13:15:24,630 - run: start step: ingest-file:parse_file/dc44d36c-3cbf-458d-b230-95d59dc97176 2024-09-11 13:15:24,638 - INFO - core.providers.parsing.unstructured_parsing - Parsing DocumentType.PDF: 4d2ccd42-2a7a-500b-8a03-fbb7d941f328 with unstructured 2024-09-11 13:15:24,638 - INFO - core.providers.parsing.unstructured_parsing - Using local unstructured to parse document 4d2ccd42-2a7a-500b-8a03-fbb7d941f328 2024-09-11 13:15:29,132 - INFO - core.pipes.ingestion.vector_storage_pipe - Successful ingestion for document_id: 4d2ccd42-2a7a-500b-8a03-fbb7d941f328, with vector: 12 [INFO] 🪓 -- 2024-09-11 13:15:29,133 - finished step run: ingest-file:parse_file/dc44d36c-3cbf-458d-b230-95d59dc97176
Expected behavior Ingest/Chunk Document
Desktop (please complete the following information):
- OS:Ubuntu 24.04
Additional context Any chance of a complete/all functions and features for use with both PostgreSQL and neo4j r2r.toml for sole use with ollama at all? Would be great to know all customizations for Ollama were correct moving forward.
Not sure if it's the correct solution, but I changed some code from line 186 in managment_service.py to the following and it now seems to be functioning:
@telemetry_event("AppSettings") async def app_settings(self, *args: Any, **kwargs: Any): prompts = self.providers.prompt.get_all_prompts() print(f"Type of prompts: {type(prompts)}") print(f"Prompts content: {prompts}") config_toml = self.config.to_toml() config_dict = toml.loads(config_toml)
if isinstance(prompts, list):
prompts_dict = {prompt.name: prompt for prompt in prompts}
else:
prompts_dict = prompts
return {
"config": config_dict,
"prompts": {
name: prompt.dict() for name, prompt in prompts_dict.items()
},
}
investigating now and will push a hotfix shortly.