mirror of
https://github.com/kennethreitz/instructor.git
synced 2026-06-05 22:50:18 +00:00
Documentation: Update planning-tasks.md (#250)
This commit is contained in:
@@ -41,7 +41,7 @@ class Query(BaseModel):
|
||||
...,
|
||||
description="Question asked using a question answering system",
|
||||
)
|
||||
dependancies: List[int] = Field(
|
||||
dependencies: List[int] = Field(
|
||||
default_factory=list,
|
||||
description="List of sub questions that need to be answered before asking this question",
|
||||
)
|
||||
@@ -94,7 +94,7 @@ def query_planner(question: str) -> QueryPlan:
|
||||
},
|
||||
]
|
||||
|
||||
QueryPlan = client.chat.completions.create(
|
||||
root = client.chat.completions.create(
|
||||
model=PLANNING_MODEL,
|
||||
temperature=0,
|
||||
response_model=QueryPlan,
|
||||
@@ -108,7 +108,7 @@ def query_planner(question: str) -> QueryPlan:
|
||||
plan = query_planner(
|
||||
"What is the difference in populations of Canada and the Jason's home country?"
|
||||
)
|
||||
plan.dict()
|
||||
plan.model_dump()
|
||||
```
|
||||
|
||||
!!! warning "No RAG"
|
||||
@@ -116,19 +116,19 @@ plan.dict()
|
||||
While we build the query plan in this example, we do not propose a method to actually answer the question. You can implement your own answer function that perhaps makes a retrival and calls openai for retrival augmented generation. That step would also make use of function calls but goes beyond the scope of this example.
|
||||
|
||||
```python
|
||||
{'query_graph': [{'dependancies': [],
|
||||
{'query_graph': [{'dependencies': [],
|
||||
'id': 1,
|
||||
'node_type': <QueryType.SINGLE_QUESTION: 'SINGLE'>,
|
||||
'question': "Identify Jason's home country"},
|
||||
{'dependancies': [],
|
||||
{'dependencies': [],
|
||||
'id': 2,
|
||||
'node_type': <QueryType.SINGLE_QUESTION: 'SINGLE'>,
|
||||
'question': 'Find the population of Canada'},
|
||||
{'dependancies': [1],
|
||||
{'dependencies': [1],
|
||||
'id': 3,
|
||||
'node_type': <QueryType.SINGLE_QUESTION: 'SINGLE'>,
|
||||
'question': "Find the population of Jason's home country"},
|
||||
{'dependancies': [2, 3],
|
||||
{'dependencies': [2, 3],
|
||||
'id': 4,
|
||||
'node_type': <QueryType.SINGLE_QUESTION: 'SINGLE'>,
|
||||
'question': 'Calculate the difference in populations between Canada and Jason's home country"}]}
|
||||
|
||||
Reference in New Issue
Block a user