mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-22 22:58:13 +00:00
Refactor knowledge configuration parameters in CrewAI
- Renamed `limit` to `results_limit` in `KnowledgeConfig`, `query_knowledge`, and `query` methods for consistency and clarity. - Updated related documentation to reflect the new parameter name, ensuring users understand the configuration options for knowledge retrieval.
This commit is contained in:
@@ -163,7 +163,7 @@ You can configure the knowledge configuration for the crew or agent.
|
|||||||
```python Code
|
```python Code
|
||||||
from crewai.knowledge.knowledge_config import KnowledgeConfig
|
from crewai.knowledge.knowledge_config import KnowledgeConfig
|
||||||
|
|
||||||
knowledge_config = KnowledgeConfig(limit=10, score_threshold=0.5)
|
knowledge_config = KnowledgeConfig(results_limit=10, score_threshold=0.5)
|
||||||
|
|
||||||
agent = Agent(
|
agent = Agent(
|
||||||
...
|
...
|
||||||
@@ -172,7 +172,7 @@ agent = Agent(
|
|||||||
```
|
```
|
||||||
|
|
||||||
<Tip>
|
<Tip>
|
||||||
limit: is the number of relevant documents to return. Default is 3.
|
results_limit: is the number of relevant documents to return. Default is 3.
|
||||||
score_threshold: is the minimum score for a document to be considered relevant. Default is 0.35.
|
score_threshold: is the minimum score for a document to be considered relevant. Default is 0.35.
|
||||||
</Tip>
|
</Tip>
|
||||||
|
|
||||||
|
|||||||
@@ -1135,11 +1135,11 @@ class Crew(BaseModel):
|
|||||||
return result
|
return result
|
||||||
|
|
||||||
def query_knowledge(
|
def query_knowledge(
|
||||||
self, query: List[str], limit: int = 3, score_threshold: float = 0.35
|
self, query: List[str], results_limit: int = 3, score_threshold: float = 0.35
|
||||||
) -> Union[List[Dict[str, Any]], None]:
|
) -> Union[List[Dict[str, Any]], None]:
|
||||||
if self.knowledge:
|
if self.knowledge:
|
||||||
return self.knowledge.query(
|
return self.knowledge.query(
|
||||||
query, limit=limit, score_threshold=score_threshold
|
query, results_limit=results_limit, score_threshold=score_threshold
|
||||||
)
|
)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ class Knowledge(BaseModel):
|
|||||||
self._add_sources()
|
self._add_sources()
|
||||||
|
|
||||||
def query(
|
def query(
|
||||||
self, query: List[str], limit: int = 3, score_threshold: float = 0.35
|
self, query: List[str], results_limit: int = 3, score_threshold: float = 0.35
|
||||||
) -> List[Dict[str, Any]]:
|
) -> List[Dict[str, Any]]:
|
||||||
"""
|
"""
|
||||||
Query across all knowledge sources to find the most relevant information.
|
Query across all knowledge sources to find the most relevant information.
|
||||||
@@ -58,7 +58,7 @@ class Knowledge(BaseModel):
|
|||||||
|
|
||||||
results = self.storage.search(
|
results = self.storage.search(
|
||||||
query,
|
query,
|
||||||
limit,
|
limit=results_limit,
|
||||||
score_threshold=score_threshold,
|
score_threshold=score_threshold,
|
||||||
)
|
)
|
||||||
return results
|
return results
|
||||||
|
|||||||
@@ -2,5 +2,5 @@ from pydantic import BaseModel
|
|||||||
|
|
||||||
|
|
||||||
class KnowledgeConfig(BaseModel):
|
class KnowledgeConfig(BaseModel):
|
||||||
limit: int = 3
|
results_limit: int = 3
|
||||||
score_threshold: float = 0.35
|
score_threshold: float = 0.35
|
||||||
|
|||||||
Reference in New Issue
Block a user