-
Notifications
You must be signed in to change notification settings - Fork 94
LLM Connector for Vulnerability Analyser #1215
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
Open
seran
wants to merge
50
commits into
master
Choose a base branch
from
llm-connector
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
50 commits
Select commit
Hold shift + click to select a range
4c66578
llm connector
seran c56e783
config update
seran 7133f7a
Merge branch 'master' into llm-connector
seran e677968
Merge branch 'master' into llm-connector
seran a5f9d62
moving connector to common location
seran 4ef1ddc
clean-up
seran e1d341a
more clean-up
seran 6016a82
Merge branch 'master' into llm-connector
seran 6ed0706
wip: workerpool to handle prompt requests
seran 919d196
working in worker pool
seran 5f6c045
gitignore to ignore target folders
seran 5b2e78c
gitignore to ignore target folders
seran 7bf59e3
wip
seran 2b64f85
Merge branch 'master' into llm-connector
seran e1078dc
minor clean-up
seran b2f33ea
fixes and comments
seran 2941dfd
Merge branch 'master' into llm-connector
seran 63a77e4
clean-up
seran a19b567
clean-up
seran 218d214
Merge branch 'master' into llm-connector
seran 042cc82
Merge branch 'master' into llm-connector
seran 74d1998
clean-up
seran b58271f
Merge branch 'master' into llm-connector
seran b8c9cb4
Merge branch 'master' into llm-connector
seran 88caa97
clean-up
seran 6cd7833
Merge branch 'master' into llm-connector
seran 484de8a
Merge branch 'master' into llm-connector
seran 0433f7c
additional methods
seran 272d7ac
Merge branch 'master' into llm-connector
seran 78f9ee3
Merge branch 'master' into llm-connector
seran b152575
addressing comments
seran ce78ff1
added ollama container to test
seran 3d3526d
more updates
seran 77d2798
Merge branch 'master' into llm-connector
seran 6104227
replaced URL to HttpClientFactory
seran 91fe6b3
clean-up
seran edcb8f9
clean-up
seran 56945e4
more clean-up
seran e4c2f07
almost completed
seran 74bdd77
testing LLM in CI
seran 90ed8dd
Merge branch 'master' into llm-connector
seran 72d2bb3
working commit
seran 3d43824
Merge branch 'master' into llm-connector
seran 0598210
Merge branch 'master' into llm-connector
seran 402ff47
Merge branch 'master' into llm-connector
seran 917775b
updates
seran 52474f4
minor fix
seran 9b9be39
minor fix
seran 836d426
minor change
seran 17230df
Merge branch 'master' into llm-connector
seran File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
core/src/main/kotlin/org/evomaster/core/languagemodel/data/AnsweredPrompt.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package org.evomaster.core.languagemodel.data | ||
|
||
class AnsweredPrompt ( | ||
val prompt: Prompt, | ||
val answer: String, | ||
) { | ||
} |
10 changes: 10 additions & 0 deletions
10
core/src/main/kotlin/org/evomaster/core/languagemodel/data/Prompt.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package org.evomaster.core.languagemodel.data | ||
|
||
import java.util.UUID | ||
|
||
class Prompt( | ||
val id: UUID, | ||
|
||
val prompt: String | ||
) { | ||
} |
30 changes: 30 additions & 0 deletions
30
core/src/main/kotlin/org/evomaster/core/languagemodel/data/ollama/OllamaEndpoints.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package org.evomaster.core.languagemodel.data.ollama | ||
|
||
class OllamaEndpoints { | ||
|
||
companion object { | ||
/** | ||
* API URL to generate a response for a given prompt with a provided model. | ||
*/ | ||
const val GENERATE_ENDPOINT = "/api/generate" | ||
|
||
/** | ||
* API URL to list models that are available locally. | ||
*/ | ||
const val TAGS_ENDPOINT = "/api/tags" | ||
|
||
fun getGenerateEndpoint(serverURL: String): String { | ||
return cleanURL(serverURL) + GENERATE_ENDPOINT | ||
} | ||
|
||
fun getTagEndpoint(serverURL: String): String { | ||
seran marked this conversation as resolved.
Show resolved
Hide resolved
|
||
return cleanURL(serverURL) + TAGS_ENDPOINT | ||
} | ||
|
||
private fun cleanURL(serverURL: String): String { | ||
return if (serverURL.endsWith("/")) serverURL.dropLast(1) else serverURL | ||
} | ||
} | ||
|
||
|
||
} |
17 changes: 17 additions & 0 deletions
17
core/src/main/kotlin/org/evomaster/core/languagemodel/data/ollama/OllamaModel.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package org.evomaster.core.languagemodel.data.ollama | ||
|
||
class OllamaModel { | ||
|
||
val name: String = "" | ||
|
||
val model: String = "" | ||
|
||
val modified_at: String = "" | ||
|
||
val size: Int = 0 | ||
|
||
val digest: String = "" | ||
|
||
val details: OllamaModelDetail = OllamaModelDetail() | ||
|
||
} |
15 changes: 15 additions & 0 deletions
15
core/src/main/kotlin/org/evomaster/core/languagemodel/data/ollama/OllamaModelDetail.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package org.evomaster.core.languagemodel.data.ollama | ||
|
||
class OllamaModelDetail { | ||
val parent_model: String = "" | ||
|
||
val format: String = "" | ||
|
||
val family: String = "" | ||
|
||
val families: List<String> = listOf() | ||
|
||
val parameter_size: String = "" | ||
|
||
val quantization_level: String = "" | ||
} |
5 changes: 5 additions & 0 deletions
5
core/src/main/kotlin/org/evomaster/core/languagemodel/data/ollama/OllamaModelResponse.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package org.evomaster.core.languagemodel.data.ollama | ||
|
||
class OllamaModelResponse { | ||
val models: List<OllamaModel> = listOf() | ||
} |
21 changes: 21 additions & 0 deletions
21
core/src/main/kotlin/org/evomaster/core/languagemodel/data/ollama/OllamaRequest.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package org.evomaster.core.languagemodel.data.ollama | ||
|
||
/** | ||
* DTO to represent the Ollama request schema. | ||
*/ | ||
class OllamaRequest ( | ||
val model: String, | ||
|
||
/** | ||
* Contains the string of the prompt for the language model. | ||
*/ | ||
val prompt: String, | ||
|
||
/** | ||
* False will return the response as a single object; meanwhile, | ||
* True will respond a stream of objects. | ||
*/ | ||
val stream: Boolean = false | ||
) { | ||
|
||
} |
6 changes: 6 additions & 0 deletions
6
core/src/main/kotlin/org/evomaster/core/languagemodel/data/ollama/OllamaRequestVerb.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package org.evomaster.core.languagemodel.data.ollama | ||
|
||
enum class OllamaRequestVerb { | ||
GET, | ||
POST; | ||
} |
37 changes: 37 additions & 0 deletions
37
core/src/main/kotlin/org/evomaster/core/languagemodel/data/ollama/OllamaResponse.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package org.evomaster.core.languagemodel.data.ollama | ||
|
||
/** | ||
* DTO to represent the Ollama response schema. | ||
*/ | ||
class OllamaResponse { | ||
|
||
/** | ||
* Used model name | ||
*/ | ||
val model: String = "" | ||
|
||
val created_at: String = "" | ||
|
||
/** | ||
* Contains the response string for non-stream output | ||
*/ | ||
val response: String = "" | ||
|
||
val done: Boolean = false | ||
|
||
val done_reason: String = "" | ||
|
||
val context: List<Int> = emptyList() | ||
|
||
val total_duration: Int = 0 | ||
|
||
val load_duration: Int = 0 | ||
|
||
val prompt_eval_count: Int = 0 | ||
|
||
val prompt_eval_duration: Int = 0 | ||
|
||
val eval_count: Int = 0 | ||
|
||
val eval_duration: Int = 0 | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.