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

functional base persona creation #1792

Closed
wants to merge 8 commits into from
Closed

functional base persona creation #1792

wants to merge 8 commits into from

Conversation

pablonyx
Copy link
Contributor

@pablonyx pablonyx commented Jul 9, 2024

Allows you to specify a new persona while interacting with the /send-message endpoint.

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

Tested with

  • Search Tool
  • LLM Override
  • Various search types
  • Custom Tool
  • Custom document set

Possible modifications

  • (addressed) Enable isolated endpoint? As in, no need to pass current chat session ID (
  • (discussed) Name-based selection for thigs like document sets? Currently ID-based, which should be fine for an API user
  • Handling of storing chat session in the database? Just don't save?

Samples

Note: you must have enterprise features enabled.

ENABLE_PAID_ENTERPRISE_EDITION_FEATURES=True

1. Basic query with persona config

curl -X POST 'http://localhost:8080/query/answer-with-quote' \
-H 'Content-Type: application/json' \
-d '{
  "messages": [
    {
      "message": "Which docs do I have?"
    }
  ],
  "persona_config": {
    "name": "Test Persona",
    "description": "A test persona for renewable energy topics",
    "search_type": "hybrid",
    "num_chunks": 5,
    "llm_relevance_filter": true,
    "llm_filter_extraction": true,
    "llm_model_provider_override": null,
    "llm_model_version_override": null,
    "starter_messages": null,
    "default_persona": false,
    "is_visible": true,
    "display_priority": 1,
    "deleted": false,
    "is_public": true,
    "prompts": [
      {
        "name": "Renewable Energy Expert",
        "description": "Prompt for renewable energy information",
        "system_prompt": "You are an expert in renewable energy.",
        "task_prompt": "Provide up-to-date information on the latest developments, technologies, and trends in the renewable energy sector.",
        "include_citations": true,
        "datetime_aware": true
      }
    ],
    "document_sets": [{"id": 1}, {"id": 2}],
    "tools": [
      {
        "name": "Search tool",
        "description": "An example tool for demonstration",
        "in_code_tool_id": 1,
        "id": 1,
        "display_name": "Example Tool Display Name"
      }
    ]
  },
  "persona_id": null,
  "retrieval_options": {
    "filters": [],
    "semantic_identifier": null,
    "semantic_identifier_for_model": null,
    "use_all_docs": true
  },
  "chain_of_thought": false,
  "return_contexts": false
}'

2. Query with no recency bias

curl -X POST 'http://localhost:8080/query/answer-with-quote' \
-H 'Content-Type: application/json' \
-d '{
  "messages": [
    {
      "message": "Tell me about the latest developments in solar energy"
    }
  ],
  "persona_config": {
    "name": "Test Persona",
    "description": "A test persona for renewable energy topics",
    "search_type": "hybrid",
    "num_chunks": 5,
    "llm_relevance_filter": true,
    "llm_filter_extraction": true,
    "recency_bias": "no_decay",
    "llm_model_provider_override": null,
    "llm_model_version_override": null,
    "starter_messages": null,
    "default_persona": false,
    "is_visible": true,
    "display_priority": 1,
    "deleted": false,
    "is_public": true,
    "prompts": [
      {
        "name": "Renewable Energy Expert",
        "description": "Prompt for renewable energy information",
        "system_prompt": "You are an expert in renewable energy.",
        "task_prompt": "Provide up-to-date information on the latest developments, technologies, and trends in the renewable energy sector.",
        "include_citations": true,
        "datetime_aware": true
      }
    ],
    "document_sets": [],
    "tools": []
  },
  "persona_id": null,
  "retrieval_options": {
    "filters": [],
    "semantic_identifier": null,
    "semantic_identifier_for_model": null,
    "use_all_docs": true
  },
  "chain_of_thought": false,
  "return_contexts": false
}'

3. Query with GPT-4 model override

curl -X POST 'http://localhost:8080/query/answer-with-quote' \
-H 'Content-Type: application/json' \
-d '{
  "messages": [
    {
      "message": "Tell me about the latest developments in solar energy"
    }
  ],
  "persona_config": {
    "name": "Test Persona",
    "description": "A test persona for renewable energy topics",
    "search_type": "hybrid",
    "num_chunks": 5,
    "llm_relevance_filter": true,
    "llm_filter_extraction": true,
    "recency_bias": "base_decay",
    "llm_model_provider_override": "open",
    "llm_model_version_override": "gpt-4",
    "starter_messages": null,
    "default_persona": false,
    "is_visible": true,
    "display_priority": 1,
    "deleted": false,
    "is_public": true,
    "prompts": [
      {
        "name": "Renewable Energy Expert",
        "description": "Prompt for renewable energy information",
        "system_prompt": "You are an expert in renewable energy.",
        "task_prompt": "Provide up-to-date information on the latest developments, technologies, and trends in the renewable energy sector.",
        "include_citations": true,
        "datetime_aware": true
      }
    ],
    "document_sets": [],
    "tools": []
  },
  "persona_id": null,
  "retrieval_options": {
    "filters": [],
    "semantic_identifier": null,
    "semantic_identifier_for_model": null,
    "use_all_docs": true
  },
  "chain_of_thought": false,
  "return_contexts": false
}'

4. Query with persona ID instead of config

curl -X POST 'http://localhost:8080/query/answer-with-quote' \
-H 'Content-Type: application/json' \
-d '{
  "messages": [
    {
      "message": "Tell me about the latest developments in solar energy"
    }
  ],
  "persona_id": 0,
  "retrieval_options": {
    "filters": [],
    "semantic_identifier": null,
    "semantic_identifier_for_model": null,
    "use_all_docs": true
  },
  "chain_of_thought": false,
  "return_contexts": false
}'

Copy link

vercel bot commented Jul 9, 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 2, 2024 8:51pm

@pablonyx
Copy link
Contributor Author

pablonyx commented Jul 9, 2024

Document sets + Search Tool

curl -X POST 'http://localhost:8080/chat/send-message' \
-H 'Content-Type: application/json' \
-d '{
  "persona_config": {
    "name": "Test Persona",
    "description": "A test persona for renewable energy topics",
    "search_type": "keyword",
    "num_chunks": 5,
    "llm_relevance_filter": true,
    "llm_filter_extraction": true,
    "llm_model_provider_override": "open",
    "llm_model_version_override": "gpt-3.5-turbo",
    "starter_messages": null,
    "default_persona": false,
    "is_visible": true,
    "display_priority": 1,
    "deleted": false,
    "is_public": true,
    "prompts": [
      {
        "name": "Renewable Energy Expert",
        "description": "Prompt for renewable energy information",
        "system_prompt": "You are an expert in renewable energy.",
        "task_prompt": "Provide up-to-date information on the latest developments, technologies, and trends in the renewable energy sector.",
        "include_citations": true,
        "datetime_aware": true
      }
    ],
    "document_sets": [{"id": 1}, {"id": 2}],
    "tools": [
      {
        "name": "Search tool",
        "description": "An example tool for demonstration",
        "in_code_tool_id": 1,
        "id": 1,
        "display_name": "Example Tool Display Name"
      }
    ]
  },
  "chat_session_id": 1,
  "parent_message_id": null,
  "message": "Which docs do I have?",
  "file_descriptors": [],
  "prompt_id": 1,
  "retrieval_options": {
    "filters": [],
    "semantic_identifier": null,
    "semantic_identifier_for_model": null,
    "use_all_docs": true
  },
  "query_override": null,
  "llm_override": null,
  "alternate_assistant_id": null,
  "use_existing_user_message": false
}'

Non LLM override

curl -X POST 'http://localhost:8080/chat/send-message' \
-H 'Content-Type: application/json' \
-d '{
  "persona_config": {
    "name": "Test Persona",
    "description": "A test persona for renewable energy topics",
    "search_type": "keyword",
    "num_chunks": 5,
    "llm_relevance_filter": true,
    "llm_filter_extraction": true,
    "llm_model_provider_override": null,
    "llm_model_version_override": null,
    "starter_messages": null,
    "default_persona": false,
    "is_visible": true,
    "display_priority": 1,
    "deleted": false,
    "is_public": true,
    "prompts": [
      {
        "name": "Renewable Energy Expert",
        "description": "Prompt for renewable energy information",
        "system_prompt": "You are an expert in renewable energy.",
        "task_prompt": "Provide up-to-date information on the latest developments, technologies, and trends in the renewable energy sector.",
        "include_citations": true,
        "datetime_aware": true
      }
    ],
    "document_sets": [{"id": 1}, {"id": 2}],
    "tools": [
      {
        "name": "Search tool",
        "description": "An example tool for demonstration",
        "in_code_tool_id": 1,
        "id": 1,
        "display_name": "Example Tool Display Name"
      }
    ]
  },
  "chat_session_id": 1,
  "parent_message_id": null,
  "message": "Which docs do I have?",
  "file_descriptors": [],
  "prompt_id": 1,
  "retrieval_options": {
    "filters": [],
    "semantic_identifier": null,
    "semantic_identifier_for_model": null,
    "use_all_docs": true
  },
  "query_override": null,
  "llm_override": null,
  "alternate_assistant_id": null,
  "use_existing_user_message": false
}'

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.

1 participant