mirror of
				https://github.com/infiniflow/ragflow.git
				synced 2025-11-04 03:39:41 +00:00 
			
		
		
		
	Fix: change ollama default num_ctx. (#6395)
### What problem does this PR solve? #6163 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
		
							parent
							
								
									85480f6292
								
							
						
					
					
						commit
						a2a4bfe3e3
					
				@ -50,26 +50,29 @@ class CategorizeParam(GenerateParam):
 | 
			
		||||
        for c, desc in self.category_description.items():
 | 
			
		||||
            if desc.get("description"):
 | 
			
		||||
                descriptions.append(
 | 
			
		||||
                    "--------------------\nCategory: {}\nDescription: {}\n".format(c, desc["description"]))
 | 
			
		||||
                    "\nCategory: {}\nDescription: {}".format(c, desc["description"]))
 | 
			
		||||
 | 
			
		||||
        self.prompt = """
 | 
			
		||||
        You're a text classifier. You need to categorize the user’s questions into {} categories, 
 | 
			
		||||
        namely: {}
 | 
			
		||||
        Here's description of each category:
 | 
			
		||||
        {}
 | 
			
		||||
Role: You're a text classifier. 
 | 
			
		||||
Task: You need to categorize the user’s questions into {} categories, namely: {}
 | 
			
		||||
 | 
			
		||||
        You could learn from the following examples:
 | 
			
		||||
        {}
 | 
			
		||||
        You could learn from the above examples.
 | 
			
		||||
        Just mention the category names, no need for any additional words.
 | 
			
		||||
Here's description of each category:
 | 
			
		||||
{}
 | 
			
		||||
 | 
			
		||||
        ---- Real Data ----
 | 
			
		||||
        {}
 | 
			
		||||
You could learn from the following examples:
 | 
			
		||||
{}
 | 
			
		||||
You could learn from the above examples.
 | 
			
		||||
 | 
			
		||||
Requirements:
 | 
			
		||||
- Just mention the category names, no need for any additional words.
 | 
			
		||||
 | 
			
		||||
---- Real Data ----
 | 
			
		||||
USER: {}\n
 | 
			
		||||
        """.format(
 | 
			
		||||
            len(self.category_description.keys()),
 | 
			
		||||
            "/".join(list(self.category_description.keys())),
 | 
			
		||||
            "\n".join(descriptions),
 | 
			
		||||
            "- ".join(cate_lines),
 | 
			
		||||
            "\n\n- ".join(cate_lines),
 | 
			
		||||
            chat_hist
 | 
			
		||||
        )
 | 
			
		||||
        return self.prompt
 | 
			
		||||
 | 
			
		||||
@ -441,7 +441,9 @@ class OllamaChat(Base):
 | 
			
		||||
        if "max_tokens" in gen_conf:
 | 
			
		||||
            del gen_conf["max_tokens"]
 | 
			
		||||
        try:
 | 
			
		||||
            options = {}
 | 
			
		||||
            options = {
 | 
			
		||||
                "num_ctx": 32768
 | 
			
		||||
            }
 | 
			
		||||
            if "temperature" in gen_conf:
 | 
			
		||||
                options["temperature"] = gen_conf["temperature"]
 | 
			
		||||
            if "max_tokens" in gen_conf:
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user