R2R icon indicating copy to clipboard operation
R2R copied to clipboard

set completion stream = true will cause embedding with ollama fail

Open huashiyiqike opened this issue 6 months ago • 0 comments

Describe the bug the stream option of completion is causing embedding error when using ollama for embedding, don't know if this is an ollama problem or a r2r bug.

To Reproduce in custom.toml [completion] [completion.generation_config] model = "ollama/phi4-mini:latest" temperature = 0.7 top_p = 0.9 max_tokens_to_sample = 1024 stream = false # set this to true will cause the error add_generation_kwargs = {}

[embedding] provider = "ollama" base_model = "bge-m3:latest" base_dimension = 1024 batch_size = 32 add_title_as_prefix = true concurrent_request_limit = 32

Desktop (please complete the following information):

  • Version both latest version

Additional context 2r-1 | 2025-04-03 15:07:19 - ERROR - Error in base endpoint create_document() - 500: Error during ingestion: 'AsyncStream' object has no attribute 'dict' r2r-1 | Traceback (most recent call last): r2r-1 | File "/app/core/main/orchestration/simple/ingestion_workflow.py", line 85, in ingest_files r2r-1 | await service.augment_document_info(document_info, extractions) r2r-1 | File "/app/core/main/services/ingestion_service.py", line 311, in augment_document_info r2r-1 | response = await self.providers.llm.aget_completion( r2r-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ r2r-1 | File "/app/core/base/providers/llm.py", line 152, in aget_completion r2r-1 | return LLMChatCompletion(**response.dict()) r2r-1 | ^^^^^^^^^^^^^ r2r-1 | AttributeError: 'AsyncStream' object has no attribute 'dict' r2r-1 | r2r-1 | The above exception was the direct cause of the following exception: r2r-1 | r2r-1 | Traceback (most recent call last): r2r-1 | File "/app/core/main/api/v3/base_router.py", line 51, in wrapper r2r-1 | func_result = await func(*args, **kwargs) r2r-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ r2r-1 | File "/app/core/main/api/v3/documents_router.py", line 569, in create_document r2r-1 | await simple_ingestor"ingest-files" r2r-1 | File "/app/core/main/orchestration/simple/ingestion_workflow.py", line 250, in ingest_files r2r-1 | raise HTTPException( r2r-1 | fastapi.exceptions.HTTPException: 500: Error during ingestion: 'AsyncStream' object has no attribute 'dict'

huashiyiqike avatar Apr 03 '25 15:04 huashiyiqike