Skip to content

UTC fix and use LLM APIs to generate challenges & posts - #376

Merged
loleg merged 27 commits into
dribdat:mainfrom
loleg:prompt-challenge
Jul 21, 2024
Merged

loleg merged 27 commits into
dribdat:mainfrom
loleg:prompt-challenge

Conversation

@loleg

@loleg loleg commented Dec 7, 2023 •

Copy link
Copy Markdown
Collaborator

This PR adds AI magic pixie dust (details below) and updates the way UTC times are handled throughout the project. Thanks to Miguel Grinberg for guidance.

Further technical improvements include:

  • A new Copy option in the admin events menu allows quick duplication of events.
  • The project/challenge switcher only appears on challenges.
  • Log and Post screen has been slightly revised.
  • Projects start at level 1, not 5, when event starts.
  • Modal dialog to avoid duplicate Post submissions.

Incubating feature: LLM support

Let's jump on that AI bandwagon! When creating a project, you can tick a checkbox to generate your challenge from the Title and Summary. OpenAI compatible endpoints (e.g. Hugging Face), and proxies like LiteLLM and Ollama are supported. New settings you can use to set up your site:

  • LLM_API_KEY - (required) an API key of your LLM provider
  • LLM_BASE_URL - if left blank, this uses the production OpenAI endpoint
  • LLM_MODEL - defaults to "gpt-3.5-turbo"

The flow is inspired by Wagtail AI, datasette-chatgpt-plugin and a CKAN discussion thread. Ideas of further LLM applications welcome in our 💬 discussions

Example generated project:

Example

@codecov

codecov Bot commented Dec 7, 2023 •

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 60.41667% with 19 lines in your changes are missing coverage. Please review.

Project coverage is 62.89%. Comparing base (a1b2e12) to head (d36c4ef).
Report is 7 commits behind head on main.

Files Patch % Lines
dribdat/apigenerate.py 43.33% 17 Missing ⚠️
dribdat/apipackage.py 50.00% 1 Missing ⚠️
dribdat/public/project.py 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #376      +/-   ##
==========================================
- Coverage   62.95%   62.89%   -0.07%     
==========================================
  Files          42       43       +1     
  Lines        4681     4719      +38     
==========================================
+ Hits         2947     2968      +21     
- Misses       1734     1751      +17     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@loleg loleg changed the title Support for OpenAI API Use LLM APIs to generate a challenge (WIP) Dec 22, 2023
@loleg

loleg commented Dec 22, 2023

Copy link
Copy Markdown
Collaborator Author

This is very much a fun/exploration branch for now. I'm not sure how much sense this makes, or if the LLM functionality is even in the right place. And it needs a background worker to do properly (Which would also be useful on the global Sync btw)

@loleg loleg closed this Feb 29, 2024
@loleg loleg reopened this Mar 2, 2024
@loleg loleg closed this Mar 15, 2024
loleg added 7 commits July 12, 2024 16:42
  - Updating rpds-py (0.18.1 -> 0.19.0)
  - Updating certifi (2024.6.2 -> 2024.7.4)
  - Updating setuptools (70.2.0 -> 70.3.0)
  - Installing annotated-types (0.7.0)
  - Updating botocore (1.34.137 -> 1.34.143)
  - Installing pydantic-core (2.20.1)
  - Updating jsonschema (4.22.0 -> 4.23.0)
  - Installing pydantic (2.8.2)
  - Updating validators (0.29.0 -> 0.32.0)
  - Updating boto3 (1.34.137 -> 1.34.143)
  - Updating coverage (7.5.4 -> 7.6.0)
  - Installing flask-openapi3 (3.1.3)
@loleg loleg reopened this Jul 12, 2024
@loleg loleg changed the title Use LLM APIs to generate a challenge (WIP) Use LLM APIs to generate a challenge Jul 17, 2024
@loleg loleg changed the title Use LLM APIs to generate a challenge Use LLM APIs to generate challenges & posts Jul 17, 2024
@loleg loleg changed the title Use LLM APIs to generate challenges & posts UTC fix and use LLM APIs to generate challenges & posts Jul 21, 2024
@loleg

loleg commented Jul 21, 2024

Copy link
Copy Markdown
Collaborator Author

Tested in sandbox

@loleg
loleg merged commit 15cc0fb into dribdat:main Jul 21, 2024
@loleg loleg mentioned this pull request Sep 6, 2024
@loleg loleg mentioned this pull request Oct 18, 2024
@loleg
loleg deleted the prompt-challenge branch December 30, 2024 19:56
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