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

Add ability to specify persona in API request #2302

Merged
merged 12 commits into from
Sep 16, 2024
Merged

Conversation

pablonyx
Copy link
Contributor

@pablonyx pablonyx commented Sep 2, 2024

Allows you to specify a new persona configuration while interacting with Direct QA-related endpoints.

Relevant docs PR: onyx-dot-app/documentation#100

Some tradeoffs

  • Elsewhere in the code, persona is expected to be persisted. In this implementation, we change that assumption and allow personas to be null (for direct QA chat sessions). This shows up most concretely as allowing the name of personas in various places to be null (alternative implementation would have been to set to a default "Configured on fly" name)
  • Alternative implementation would have been to assign a standard "default person" in the DB and persist the requirement that each chat session have a person

Sample curl for local testing

curl -X POST 'http://localhost:8080/query/answer-with-quote' \
-H 'Content-Type: application/json' \
-d '{
  "messages": [
    {
      "message": "What is your goal/ambition?"
    }
  ],
  "persona_config": {
    "name": "Solar Energy Specialist",
    "description": "An expert in solar energy systems and technologies",
    "search_type": "semantic",
    "num_chunks": 5,
    "llm_relevance_filter": true,
    "llm_filter_extraction": true,
    "recency_bias": "auto",
    "llm_model_provider_override": null,
    "llm_model_version_override": null,
    "prompts": [
      {
        "name": "Solar Energy Expert",
        "description": "Prompt for solar energy information",
        "system_prompt": "You are an expert in solar energy systems and technologies.",
        "task_prompt": "Provide detailed and accurate information about solar energy systems, their components, efficiency, and recent advancements.",
        "include_citations": true,
        "datetime_aware": true
      }
    ],
    "document_set_ids": [1, 2],
    "tools": [
      {
        "name": "Search tool",
        "description": "An example tool for demonstration",
        "in_code_tool_id": 1,
        "id": 1,
        "display_name": "Example Tool Display Name"
      }
    ],
    "tool_ids": [],
    "custom_tools_openapi": []
  },
  "persona_id": null,
  "retrieval_options": {
    "filters": {},
    "semantic_identifier": null,
    "semantic_identifier_for_model": null,
    "use_all_docs": true
  },
  "chain_of_thought": true,
  "return_contexts": true
}'```

Copy link

vercel bot commented Sep 2, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
internal-search ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 16, 2024 6:21pm

@pablonyx pablonyx enabled auto-merge September 16, 2024 18:18
@pablonyx pablonyx added this pull request to the merge queue Sep 16, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Sep 16, 2024
@pablonyx pablonyx added this pull request to the merge queue Sep 16, 2024
Merged via the queue into main with commit 2dd3870 Sep 16, 2024
7 checks passed
rajivml pushed a commit to UiPath/danswer that referenced this pull request Oct 2, 2024
* persona

* all prepared excluding configuration

* more sensical model structure

* update tstream

* type updates

* rm

* quick and simple updates

* minor updates

* te

* ensure typing + naming

* remove old todo + rebase update

* remove unnecessary check
rajivml pushed a commit to UiPath/danswer that referenced this pull request Oct 2, 2024
* persona

* all prepared excluding configuration

* more sensical model structure

* update tstream

* type updates

* rm

* quick and simple updates

* minor updates

* te

* ensure typing + naming

* remove old todo + rebase update

* remove unnecessary check
@pablonyx pablonyx deleted the specify_persona_api branch October 17, 2024 23:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants