Skip to content

Commit 31e4692

Browse files
Merge pull request #30 from lucaromagnoli/feat/add-models
Feat/add models
2 parents b9e156f + 8009efb commit 31e4692

File tree

13 files changed

+378
-296
lines changed

13 files changed

+378
-296
lines changed

.github/workflows/ci.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ on:
1818

1919
jobs:
2020
build-and-test:
21+
if: github.event_name != 'push' || !startsWith(github.ref, 'refs/tags/')
2122
runs-on: ${{ matrix.os }}
2223
strategy:
2324
fail-fast: false
@@ -115,6 +116,22 @@ jobs:
115116
echo "Running CI-safe tests (excluding integration tests)..."
116117
./tests/llmcpp_tests "~[integration]" --reporter compact
117118
119+
# Code quality checks (only on PRs to main/develop)
120+
- name: Check formatting (Linux only)
121+
if: matrix.os == 'ubuntu-22.04' && github.event_name == 'pull_request'
122+
run: |
123+
sudo apt-get update
124+
sudo apt-get install -y clang-format
125+
find include src tests -name "*.h" -o -name "*.hpp" -o -name "*.cpp" -o -name "*.c" | xargs clang-format --dry-run --style=file
126+
127+
- name: Run static analysis (Linux only)
128+
if: matrix.os == 'ubuntu-22.04' && github.event_name == 'pull_request'
129+
run: |
130+
sudo apt-get update
131+
sudo apt-get install -y cppcheck
132+
cppcheck --enable=warning --inline-suppr --suppress=missingIncludeSystem --suppress=useInitializationList --suppress=unusedParameter --error-exitcode=0 -I include/ src/ include/
133+
continue-on-error: true
134+
118135
- name: Upload build artifacts
119136
if: failure()
120137
uses: actions/upload-artifact@v4

.github/workflows/code-quality.yml

Lines changed: 0 additions & 54 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 60 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,63 @@ env:
99
CMAKE_VERSION: '3.22'
1010

1111
jobs:
12+
check-open-prs:
13+
runs-on: ubuntu-latest
14+
outputs:
15+
has_open_prs: ${{ steps.check.outputs.has_open_prs }}
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
20+
- name: Check for open PRs
21+
id: check
22+
run: |
23+
# Check if there are any open PRs targeting main or develop
24+
OPEN_PRS=$(gh pr list --state open --base main --base develop --json number --jq 'length')
25+
if [ "$OPEN_PRS" -gt 0 ]; then
26+
echo "has_open_prs=true" >> $GITHUB_OUTPUT
27+
echo "⚠️ Found $OPEN_PRS open PR(s). Skipping release to avoid duplicates."
28+
echo "Release will run after PR is merged."
29+
else
30+
echo "has_open_prs=false" >> $GITHUB_OUTPUT
31+
echo "✅ No open PRs found. Proceeding with release."
32+
fi
33+
env:
34+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35+
36+
check-ci-status:
37+
needs: check-open-prs
38+
if: needs.check-open-prs.outputs.has_open_prs == 'false'
39+
runs-on: ubuntu-latest
40+
outputs:
41+
ci_passed: ${{ steps.check.outputs.ci_passed }}
42+
steps:
43+
- name: Checkout code
44+
uses: actions/checkout@v4
45+
46+
- name: Check if CI has already passed
47+
id: check
48+
run: |
49+
# Get the commit SHA
50+
COMMIT_SHA="${{ github.sha }}"
51+
echo "Checking CI status for commit: $COMMIT_SHA"
52+
53+
# Check if there's a successful CI run for this commit
54+
CI_STATUS=$(gh api repos/${{ github.repository }}/commits/$COMMIT_SHA/status --jq '.statuses[] | select(.context == "CI") | .state' 2>/dev/null || echo "unknown")
55+
56+
if [ "$CI_STATUS" = "success" ]; then
57+
echo "ci_passed=true" >> $GITHUB_OUTPUT
58+
echo "✅ CI has already passed for this commit. Skipping build-and-test."
59+
else
60+
echo "ci_passed=false" >> $GITHUB_OUTPUT
61+
echo "⚠️ CI has not passed yet or status unknown. Running build-and-test."
62+
fi
63+
env:
64+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
65+
1266
validate-version:
67+
needs: [check-open-prs, check-ci-status]
68+
if: needs.check-open-prs.outputs.has_open_prs == 'false'
1369
runs-on: ubuntu-latest
1470
outputs:
1571
version: ${{ steps.extract.outputs.version }}
@@ -80,7 +136,8 @@ jobs:
80136
echo "✅ Changelog validation passed: version $VERSION found in CHANGELOG.md"
81137
82138
build-and-test:
83-
needs: validate-version
139+
needs: [check-open-prs, check-ci-status, validate-version]
140+
if: needs.check-open-prs.outputs.has_open_prs == 'false' && needs.check-ci-status.outputs.ci_passed == 'false'
84141
strategy:
85142
matrix:
86143
os: [ubuntu-latest, windows-latest]
@@ -184,7 +241,8 @@ jobs:
184241
retention-days: 30
185242

186243
create-release:
187-
needs: [validate-version, build-and-test]
244+
needs: [check-open-prs, check-ci-status, validate-version, build-and-test]
245+
if: needs.check-open-prs.outputs.has_open_prs == 'false'
188246
runs-on: ubuntu-latest
189247
permissions:
190248
contents: write

CHANGELOG.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,39 @@
44

55

66

7+
## [1.0.17] - 2025-07-13
8+
9+
### Fixed
10+
- add explicit condition to skip CI on tag pushes
11+
12+
## [1.0.16] - 2025-07-13
13+
14+
### Fixed
15+
- add checkout step to check-open-prs job in release workflow
16+
17+
## [1.0.15] - 2025-07-13
18+
19+
### Build
20+
- do not run CI workflow on version tags (only release workflow runs on tags)
21+
- optimize workflows - merge code quality into CI and skip release on open PRs
22+
23+
## [1.0.14] - 2025-07-13
24+
25+
### Fixed
26+
- correct GPT-4.5 model status - it's a current preview model, not deprecated
27+
- update tests to use correct GPT-4.5 model string (gpt-4.5-preview)
28+
- implement parameter filtering for reasoning models (O-series)
29+
30+
### Documentation
31+
- update README to clarify model enum usage and remove recommendation references
32+
33+
### Maintenance
34+
- remove duplicate release-workflow.sh script
35+
36+
### Other
37+
- Merge pull request #29 from lucaromagnoli/feat/release-test
38+
- Remove getRecommendedModel and related tests, clean up OpenAI model enum logic
39+
740
## [1.0.13] - 2025-07-13
841

942
### Changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cmake_minimum_required(VERSION 3.22)
22

3-
project(llmcpp VERSION 1.0.13 LANGUAGES CXX)
3+
project(llmcpp VERSION 1.0.17 LANGUAGES CXX)
44

55
# Set version variables for easier access
66
set(LLMCPP_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})

README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,32 @@ int main() {
119119
}
120120
```
121121

122+
---
123+
124+
### Model Enum: Type-Safe Model Selection
125+
126+
llmcpp provides a strongly-typed `OpenAI::Model` enum for selecting models safely and with IDE autocompletion. Example usage:
127+
128+
```cpp
129+
// Use any supported model from the enum
130+
auto response = client.sendRequest(OpenAI::Model::O3, "What's new in the O3 model?");
131+
auto response2 = client.sendRequest(OpenAI::Model::GPT_4_1_Mini, "Summarize this text.");
132+
```
133+
134+
**Available models:**
135+
- O3, O3_Mini
136+
- O1, O1_Mini, O1_Preview, O1_Pro
137+
- O4_Mini, O4_Mini_Deep_Research
138+
- GPT_4_1, GPT_4_1_Mini, GPT_4_1_Nano
139+
- GPT_4o, GPT_4o_Mini
140+
- GPT_4_5 (preview)
141+
- GPT_3_5_Turbo (legacy)
142+
- Custom (for custom/unknown model names)
143+
144+
> **Note:** Model recommendations change frequently. For the latest guidance on which model to use for your use case (reasoning, coding, cost, etc.), consult the [OpenAI model documentation](https://platform.openai.com/docs/models) or your provider's docs. The library no longer provides a built-in recommendation function.
145+
146+
---
147+
122148
## CMake Integration
123149

124150
### After install (recommended)

include/openai/OpenAIClient.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@ class OpenAIClient : public LLMClient {
130130
static std::string modelToString(OpenAI::Model model);
131131
static OpenAI::Model stringToModel(const std::string& modelStr);
132132
static std::vector<OpenAI::Model> getAvailableModelEnums();
133-
static OpenAI::Model getRecommendedModelEnum(const std::string& useCase);
134133

135134
private:
136135
/**

0 commit comments

Comments
 (0)