From ae0cc04625d590cc3a722d80adef64a3281bcc72 Mon Sep 17 00:00:00 2001 From: J2-D2-3PO <188380414+J2-D2-3PO@users.noreply.github.com> Date: Thu, 21 Nov 2024 15:03:16 -0700 Subject: [PATCH] Missed adding the updated toml and the action --- .github/workflows/generate-llms.yaml | 47 ++++++++++++++++++++++++++++ pyproject.toml | 4 +++ 2 files changed, 51 insertions(+) create mode 100644 .github/workflows/generate-llms.yaml diff --git a/.github/workflows/generate-llms.yaml b/.github/workflows/generate-llms.yaml new file mode 100644 index 000000000000..f9ccb3ec1bd5 --- /dev/null +++ b/.github/workflows/generate-llms.yaml @@ -0,0 +1,47 @@ +name: Generate llms.txt + +on: + push: + branches: + - pr-3045-gh-action # Adjust if your default branch has a different name + +jobs: + generate-llms: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.x' # Specify the required Python version + + # Step 3: Install Hatch + - name: Install Hatch + run: pip install hatch + + # Step 4: Install dependencies for docs + - name: Install documentation dependencies + run: hatch env create llmspy + + # Step 5: Run the script + - name: Generate llms.txt + run: hatch run llmspy python weave/docs/scripts/generate-llmstxt.py + + # Step 6: Verify generated file (optional) + - name: Check if llms.txt exists + run: | + if [ ! -f weave/docs/static/llms.txt ]; then + echo "Error: llms.txt was not generated." + exit 1 + fi + - name: Commit and push changes + run: | + git config user.name "llms.py GitHub Actions Bot" + git config user.email "actions@github.com" + git add weave/docs/static/llms.txt + git diff-index --quiet HEAD || git commit -m "Auto-generate llms.txt" + git push origin test-llmspy-action + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/pyproject.toml b/pyproject.toml index 5d5db9f1bc4e..6c6caae8e01d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -52,6 +52,7 @@ anthropic = ["anthropic>=0.18.0"] cerebras = ["cerebras-cloud-sdk"] cohere = ["cohere>=5.9.1,<5.9.3"] dspy = ["dspy>=0.1.5", "litellm<=1.49.1"] +llmspy = ["PyYAML>=6.0"] google_ai_studio = ["google-generativeai>=0.8.3"] groq = ["groq>=0.9.0"] instructor = ["instructor>=1.4.3"] @@ -134,6 +135,9 @@ exclude = [ "weave/clear_cache.py", ] +[tool.hatch.envs.llmspy] +dependencies = ["PyYAML>=6.0"] + [tool.pytest.ini_options] filterwarnings = [