Skip to content

Fix issues in CI pipeline #33

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

Closed
wants to merge 22 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
85aa2c0
apply scalafmt to all source files to test CI pipeline
phelps-sg Jun 18, 2023
a7442b7
apply scalafmt to all sbt files to test CI pipeline
phelps-sg Jun 18, 2023
637eda0
fixes #34
phelps-sg Jun 18, 2023
8453801
add crossScalaVersions setting - fixes #34
phelps-sg Jun 18, 2023
f75ca60
use JDK v9 as required by StackWalker (see #35)
phelps-sg Jun 18, 2023
ad328e5
Revert "use JDK v9 as required by StackWalker (see #35)"
phelps-sg Jun 18, 2023
e8d0f37
use JDK 11 asStackWalker required JDK >=9 (see #35)
phelps-sg Jun 18, 2023
2ffb1e2
move JsonUtil.StringDoubleMapFormat and JsonUtil.StringStringMapForma…
phelps-sg Jun 18, 2023
556dfe7
apply crossScalaVersions setting to guice module
phelps-sg Jun 18, 2023
4996cb1
clean build
phelps-sg Jun 18, 2023
cb2a91e
bump 2.13.10 to 2.13.11 in optional build
phelps-sg Jun 18, 2023
4cb6f1b
clean build in 'Build & Test'
phelps-sg Jun 18, 2023
fd484f0
fixes #37
phelps-sg Jun 18, 2023
f85d8ce
fixes #38
phelps-sg Jun 18, 2023
2be727c
use CI env var for scala version in Upload coverage report
phelps-sg Jun 18, 2023
6420245
upload entire coverage report directory, and remove coverage threshol…
phelps-sg Jun 18, 2023
0f1258a
remove commented out section
phelps-sg Jun 18, 2023
f5ac124
Revert "remove commented out section"
phelps-sg Jun 18, 2023
0cf5fa8
Revert "upload entire coverage report directory, and remove coverage …
phelps-sg Jun 18, 2023
614ac85
upload entire coverage report directory, and remove coverage threshol…
phelps-sg Jun 18, 2023
07c36b6
remove coverage requirement from ready to merge
phelps-sg Jun 18, 2023
e970182
fixes #29
phelps-sg Jun 15, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 35 additions & 41 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
name: CI
on:
pull_request:
branches: [ main, '**' ]
branches: [ master, '**' ]
push:
branches: [ main ]
branches: [ master ]

jobs:
validate:
Expand All @@ -32,7 +32,7 @@ jobs:
strategy:
fail-fast: true
matrix:
scala: [ '2.12.15', '2.13.10', '3.2.2' ]
scala: [ '2.12.15', '2.13.11', '3.2.2' ]

steps:
- uses: actions/checkout@v3
Expand All @@ -41,23 +41,17 @@ jobs:
uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: '8'
java-version: '11'
cache: 'sbt'

- name: Build & Test
run: sbt ++${{ matrix.scala }} testWithCoverage

- name: Upload coverage report (Cobertura)
uses: actions/[email protected]
with:
name: cobertura.xml
path: ${{github.workspace}}/target/scala-2.13/coverage-report/cobertura.xml
run: sbt ++${{ matrix.scala }} clean testWithCoverage

- name: Upload coverage report (HTML)
- name: Upload coverage report (all)
uses: actions/[email protected]
with:
name: scoverage-report-html
path: ${{github.workspace}}/target/scala-2.13/scoverage-report/
name: coverage-report-${{ matrix.scala }}
path: ${{github.workspace}}/target/scala-${{ matrix.scala }}/coverage-report

optional-build:
name: Build (Optional)
Expand All @@ -70,12 +64,12 @@ jobs:
matrix:
distribution: [ 'corretto' ]
jdk: [ '11' ]
scala: [ '2.12.15', '2.13.10', '3.2.2' ]
scala: [ '2.12.15', '2.13.11', '3.2.2' ]
experimental: [ false ]
include:
- jdk: '17'
distribution: 'corretto'
scala: '2.13.10'
scala: '2.13.11'
experimental: true

steps:
Expand All @@ -90,35 +84,35 @@ jobs:
cache: 'sbt'

- name: Perform Build / Test
run: sbt ++${{ matrix.scala }} compile test

coverage:
name: Coverage Report
if: ${{ github.event.pull_request }}
needs: [ build ]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
name: cobertura.xml

- name: Analyzing coverage report
uses: 5monkeys/cobertura-action@master
with:
path: cobertura.xml
only_changed_files: true
fail_below_threshold: true
show_missing: true
show_line: true
show_branch: true
show_class_names: true
link_missing_lines: true
minimum_coverage: 75
run: sbt ++${{ matrix.scala }} clean compile test

# coverage:
# name: Coverage Report
# if: ${{ github.event.pull_request }}
# needs: [ build ]
# runs-on: ubuntu-latest
# steps:
# - uses: actions/download-artifact@v3
# with:
# name: cobertura.xml
#
# - name: Analyzing coverage report
# uses: 5monkeys/cobertura-action@master
# with:
# path: cobertura.xml
# only_changed_files: true
# fail_below_threshold: true
# show_missing: true
# show_line: true
# show_branch: true
# show_class_names: true
# link_missing_lines: true
# minimum_coverage: 75

ready-to-merge:
name: Ready to Merge
if: ${{ github.event.pull_request }}
needs: [ optional-build, coverage ]
needs: [ optional-build ]
runs-on: ubuntu-latest
steps:
- run: echo 'Ready to merge.'
6 changes: 5 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,30 @@ import sbt.Keys.test
val scala212 = "2.12.18"
val scala213 = "2.13.11"
val scala3 = "3.2.2"
lazy val supportedScalaVersions = List(scala212, scala213, scala3)

ThisBuild / organization := "io.cequence"
ThisBuild / scalaVersion := scala212
ThisBuild / version := "0.4.0"
ThisBuild / isSnapshot := false

lazy val core = (project in file("openai-core"))
.settings(crossScalaVersions := supportedScalaVersions)

lazy val client = (project in file("openai-client"))
.dependsOn(core)
.aggregate(core)
.settings(crossScalaVersions := supportedScalaVersions)

lazy val client_stream = (project in file("openai-client-stream"))
.dependsOn(client)
.aggregate(client)
.settings(crossScalaVersions := supportedScalaVersions)

lazy val guice = (project in file("openai-guice"))
.dependsOn(client)
.aggregate(client_stream)
.settings(crossScalaVersions := supportedScalaVersions)

// POM settings for Sonatype
ThisBuild / homepage := Some(
Expand Down Expand Up @@ -86,7 +91,6 @@ addCommandAlias(
).mkString(";")
)


inThisBuild(
List(
scalacOptions += "-Ywarn-unused",
Expand Down
4 changes: 2 additions & 2 deletions openai-client-stream/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ description := "Stream support for the OpenAI Scala client."
val akkaHttpVersion = "10.5.0-M1" // TODO: migrate to 10.5.1

libraryDependencies ++= Seq(
"com.typesafe.akka" %% "akka-http" % akkaHttpVersion // JSON WS Streaming
)
"com.typesafe.akka" %% "akka-http" % akkaHttpVersion // JSON WS Streaming
)
Original file line number Diff line number Diff line change
Expand Up @@ -2,53 +2,74 @@ package io.cequence.openaiscala.service

import akka.NotUsed
import akka.stream.scaladsl.Source
import io.cequence.openaiscala.domain.{FunctionSpec, MessageSpec}
import io.cequence.openaiscala.domain.response.{ChatCompletionChunkResponse, ChatCompletionResponse, FineTuneEvent, TextCompletionResponse}
import io.cequence.openaiscala.domain.settings.{CreateChatCompletionSettings, CreateCompletionSettings}

import scala.concurrent.Future
import io.cequence.openaiscala.domain.MessageSpec
import io.cequence.openaiscala.domain.response.{
ChatCompletionChunkResponse,
FineTuneEvent,
TextCompletionResponse
}
import io.cequence.openaiscala.domain.settings.{
CreateChatCompletionSettings,
CreateCompletionSettings
}

trait OpenAIServiceStreamedExtra extends OpenAIServiceConsts {

/**
* Creates a completion for the provided prompt and parameters with streamed results.
*
* @param prompt The prompt(s) to generate completions for, encoded as a string, array of strings, array of tokens, or array of token arrays.
Note that <|endoftext|> is the document separator that the model sees during training,
so if a prompt is not specified the model will generate as if from the beginning of a new document.
* @param settings
* @return text completion response as a stream (source)
*
* @see <a href="https://beta.openai.com/docs/api-reference/completions/create">OpenAI Doc</a>
*/
/** Creates a completion for the provided prompt and parameters with streamed
* results.
*
* @param prompt
* The prompt(s) to generate completions for, encoded as a string, array of
* strings, array of tokens, or array of token arrays. Note that
* <|endoftext|> is the document separator that the model sees during
* training, so if a prompt is not specified the model will generate as if
* from the beginning of a new document.
* @param settings
* @return
* text completion response as a stream (source)
*
* @see
* <a
* href="https://beta.openai.com/docs/api-reference/completions/create">OpenAI
* Doc</a>
*/
def createCompletionStreamed(
prompt: String,
settings: CreateCompletionSettings = DefaultSettings.CreateCompletion
prompt: String,
settings: CreateCompletionSettings = DefaultSettings.CreateCompletion
): Source[TextCompletionResponse, NotUsed]

/**
* Creates a completion for the chat message(s) with streamed results.
*
* @param messages A list of messages comprising the conversation so far.
* @param settings
* @return chat completion response
*
* @see <a href="https://platform.openai.com/docs/api-reference/chat/create">OpenAI Doc</a>
*/
/** Creates a completion for the chat message(s) with streamed results.
*
* @param messages
* A list of messages comprising the conversation so far.
* @param settings
* @return
* chat completion response
*
* @see
* <a
* href="https://platform.openai.com/docs/api-reference/chat/create">OpenAI
* Doc</a>
*/
def createChatCompletionStreamed(
messages: Seq[MessageSpec],
settings: CreateChatCompletionSettings = DefaultSettings.CreateChatCompletion
messages: Seq[MessageSpec],
settings: CreateChatCompletionSettings =
DefaultSettings.CreateChatCompletion
): Source[ChatCompletionChunkResponse, NotUsed]

/**
* Get fine-grained status updates for a fine-tune job with streamed results.
*
* @param fineTuneId The ID of the fine-tune job to get events for.
* @return fine tune events or None if not found as a stream (source)
*
* @see <a href="https://beta.openai.com/docs/api-reference/fine-tunes/events">OpenAI Doc</a>
*/
/** Get fine-grained status updates for a fine-tune job with streamed results.
*
* @param fineTuneId
* The ID of the fine-tune job to get events for.
* @return
* fine tune events or None if not found as a stream (source)
*
* @see
* <a
* href="https://beta.openai.com/docs/api-reference/fine-tunes/events">OpenAI
* Doc</a>
*/
def listFineTuneEventsStreamed(
fineTuneId: String
fineTuneId: String
): Source[FineTuneEvent, NotUsed]
}
Loading