Altium-archimajor-3d-printe.../.allspice/workflows/03-netlist-ai-example.yml

48 lines
2.7 KiB
YAML

# Python-py-allspice demo repository
# This workflow demonstrates how to use Python and py-allspice to interact with the AllSpice API
# AllSpice Actions documentation: https://learn.allspice.io/docs/actions-cicd
name: Python-py-allspice
on:
push:
issues:
types: [opened, closed, reopened]
jobs:
py-allspice test:
runs-on: ubuntu-latest
steps:
# Check out repository code
- name: "[📚->🖥️] Check out repository code"
uses: actions/checkout@v3
# Installs python requirements from the requirements.txt file
- name: "[🤼->🖥️] Install python requirements"
run: |
pip install -r .allspice/utils/requirements.txt
pip install -r assistant/requirements.txt
# Generate a netlist from Altium .PcbDoc file
# Run the generate_netlist.py script from the .allspice/utils directory
- name: Generate Netlist
run: |
echo -e "repo ${{ github.repository }}"
ALLSPICE_AUTH_TOKEN=${{ github.token }} python .allspice/utils/generate_netlist.py "${{ github.repository }}" "Archimajor.PcbDoc" --allspice_hub_url "${{ github.server_url }}" --output_file Archimajor.pcbdoc.netlist.txt
# Print the netlist file to the terminal
- name: Show Netlist 🔎
run: cat Archimajor.pcbdoc.netlist.txt
# Run an example query against the generated netlist file
- name: Run AI query on netlist - Example 1
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
run: python assistant/OpenAIChatStreamer.py --model "gpt-4o" --prompt "This netlist describes a hierarchical circuit design where components are grouped under specific voltage rails (e.g., 5VCC, 3.3VCC, 3.3VIO) and control signals, with indents indicating the relationships between components such as capacitors, resistors, diodes, and IC pins, showing how they are interconnected within each group. Tell me what nets are connected to the 3.3V source." --included-files Archimajor.pcbdoc.netlist.txt
# Run a second example query against the generated netlist file
- name: Run AI query on netlist - Example 2
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
run: python assistant/OpenAIChatStreamer.py --model "gpt-4o" --prompt "This netlist describes a hierarchical circuit design where components are grouped under specific voltage rails (e.g., 5VCC, 3.3VCC, 3.3VIO) and control signals, with indents indicating the relationships between components such as capacitors, resistors, diodes, and IC pins, showing how they are interconnected within each group. Can you tell me what power source Fan4 is connected to?" --included-files Archimajor.pcbdoc.netlist.txt