[go: nahoru, domu]

Skip to content

Commit

Permalink
made sure the selected_documents match the final output
Browse files Browse the repository at this point in the history
  • Loading branch information
lhr0909 committed Dec 30, 2021
1 parent 56e1e2e commit 07b7cce
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 4 deletions.
1 change: 1 addition & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ python-dotenv = "*"
boto3 = "*"
jwcrypto = "*"
pydantic = "*"
regex = "*"

[dev-packages]
autopep8 = "*"
Expand Down
82 changes: 81 additions & 1 deletion Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions functions/api/better_answers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def handler(event: Dict[str, Any], context) -> Dict[str, Any]:
},
}

prompt = better_answers_prompt(
prompt, idx = better_answers_prompt(
input.model,
input.max_tokens,
input.question,
Expand Down Expand Up @@ -98,7 +98,7 @@ def handler(event: Dict[str, Any], context) -> Dict[str, Any]:
model=completion_response.get('model'),
prompt=prompt if input.return_prompt else None,
search_model=input.search_model,
selected_documents=[SearchDocument(**d.dict(exclude={'metadata'})) if not input.return_metadata else d for d in selected_documents],
selected_documents=[SearchDocument(**d.dict(exclude={'metadata'})) if not input.return_metadata else d for d in selected_documents[idx:]],
)

return {
Expand Down
2 changes: 1 addition & 1 deletion functions/api/better_answers/prompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ def better_answers_prompt(
i += 1
prompt = combined_prompt(example_context_prompt, question, selected_documents[i:])

return prompt
return prompt, i

0 comments on commit 07b7cce

Please sign in to comment.