Kevin Hu
		
	commited on
		
		
					Commit 
							
							·
						
						4740a3f
	
1
								Parent(s):
							
							845357b
								
fix QWenSeq2txt bug (#2245)
Browse files### What problem does this PR solve?
#2243
### Type of change
- [x] Bug Fix (non-breaking change which fixes an issue)
- api/apps/llm_app.py +1 -1
- rag/llm/sequence2txt_model.py +1 -1
    	
        api/apps/llm_app.py
    CHANGED
    
    | @@ -43,7 +43,7 @@ def set_api_key(): | |
| 43 | 
             
                chat_passed, embd_passed, rerank_passed = False, False, False
         | 
| 44 | 
             
                factory = req["llm_factory"]
         | 
| 45 | 
             
                msg = ""
         | 
| 46 | 
            -
                for llm in LLMService.query(fid=factory):
         | 
| 47 | 
             
                    if not embd_passed and llm.model_type == LLMType.EMBEDDING.value:
         | 
| 48 | 
             
                        mdl = EmbeddingModel[factory](
         | 
| 49 | 
             
                            req["api_key"], llm.llm_name, base_url=req.get("base_url"))
         | 
|  | |
| 43 | 
             
                chat_passed, embd_passed, rerank_passed = False, False, False
         | 
| 44 | 
             
                factory = req["llm_factory"]
         | 
| 45 | 
             
                msg = ""
         | 
| 46 | 
            +
                for llm in LLMService.query(fid=factory)[:3]:
         | 
| 47 | 
             
                    if not embd_passed and llm.model_type == LLMType.EMBEDDING.value:
         | 
| 48 | 
             
                        mdl = EmbeddingModel[factory](
         | 
| 49 | 
             
                            req["api_key"], llm.llm_name, base_url=req.get("base_url"))
         | 
    	
        rag/llm/sequence2txt_model.py
    CHANGED
    
    | @@ -71,7 +71,7 @@ class QWenSeq2txt(Base): | |
| 71 | 
             
                    ans = ""
         | 
| 72 | 
             
                    if result.status_code == HTTPStatus.OK:
         | 
| 73 | 
             
                        for sentence in result.get_sentence():
         | 
| 74 | 
            -
                            ans +=  | 
| 75 | 
             
                        return ans, num_tokens_from_string(ans)
         | 
| 76 |  | 
| 77 | 
             
                    return "**ERROR**: " + result.message, 0
         | 
|  | |
| 71 | 
             
                    ans = ""
         | 
| 72 | 
             
                    if result.status_code == HTTPStatus.OK:
         | 
| 73 | 
             
                        for sentence in result.get_sentence():
         | 
| 74 | 
            +
                            ans += sentence.text.decode('utf-8') + '\n'
         | 
| 75 | 
             
                        return ans, num_tokens_from_string(ans)
         | 
| 76 |  | 
| 77 | 
             
                    return "**ERROR**: " + result.message, 0
         |