Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reset default settings to use high_quality and remove truncation #374

Merged
merged 1 commit into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions paperqa/agents/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ def ask(query: str, settings: Settings) -> AnswerResponse:
return get_loop().run_until_complete(
agent_query(
QueryRequest(query=query, settings=settings),
verbosity=settings.verbosity,
agent_type=settings.agent.agent_type,
)
)
Expand Down Expand Up @@ -162,7 +161,7 @@ def main() -> None:
parser.add_argument(
"--settings",
"-s",
default="default",
default="high_quality",
help=(
"Named settings to use. Will search in local, pqa directory, and package"
" last"
Expand Down
9 changes: 2 additions & 7 deletions paperqa/agents/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ async def agent_query(
query: str | QueryRequest,
docs: Docs | None = None,
agent_type: str | type = DEFAULT_AGENT_TYPE,
verbosity: int = 0,
**env_kwargs,
) -> AnswerResponse:
if isinstance(query, str):
Expand All @@ -75,12 +74,8 @@ async def agent_query(

response = await run_agent(docs, query, agent_type, **env_kwargs)
agent_logger.debug(f"agent_response: {response}")
truncation_chars = 1_000_000 if verbosity > 1 else 1500 * (verbosity + 1)
agent_logger.info(
f"[bold blue]Answer: {response.answer.answer[:truncation_chars]}"
f"{'...(truncated)' if len(response.answer.answer) > truncation_chars else ''}"
"[/bold blue]"
)

agent_logger.info(f"[bold blue]Answer: {response.answer.answer}[/bold blue]")

await search_index.add_document(
{
Expand Down