Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
ollama
Commits
9e1406e4
"references/vscode:/vscode.git/clone" did not exist on "ca012d39c6ba265091d9373c8ca00157b933d3e9"
Commit
9e1406e4
authored
Dec 09, 2023
by
Jeffrey Morgan
Browse files
Don't expose model information in `/api/generate`
parent
b74580c9
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
21 deletions
+13
-21
api/types.go
api/types.go
+0
-10
server/images.go
server/images.go
+6
-2
server/routes.go
server/routes.go
+7
-9
No files found.
api/types.go
View file @
9e1406e4
...
@@ -203,22 +203,12 @@ type GenerateResponse struct {
...
@@ -203,22 +203,12 @@ type GenerateResponse struct {
CreatedAt
time
.
Time
`json:"created_at"`
CreatedAt
time
.
Time
`json:"created_at"`
Response
string
`json:"response"`
Response
string
`json:"response"`
ModelConfiguration
ModelConfiguration
`json:"model_configuration"`
Done
bool
`json:"done"`
Done
bool
`json:"done"`
Context
[]
int
`json:"context,omitempty"`
Context
[]
int
`json:"context,omitempty"`
Metrics
Metrics
}
}
type
ModelConfiguration
struct
{
ModelFormat
string
`json:"model_format"`
ModelFamily
string
`json:"model_family"`
ModelFamilies
[]
string
`json:"model_families"`
ModelType
string
`json:"model_type"`
FileType
string
`json:"file_type"`
}
func
(
m
*
Metrics
)
Summary
()
{
func
(
m
*
Metrics
)
Summary
()
{
if
m
.
TotalDuration
>
0
{
if
m
.
TotalDuration
>
0
{
fmt
.
Fprintf
(
os
.
Stderr
,
"total duration: %v
\n
"
,
m
.
TotalDuration
)
fmt
.
Fprintf
(
os
.
Stderr
,
"total duration: %v
\n
"
,
m
.
TotalDuration
)
...
...
server/images.go
View file @
9e1406e4
...
@@ -146,12 +146,16 @@ type ManifestV2 struct {
...
@@ -146,12 +146,16 @@ type ManifestV2 struct {
}
}
type
ConfigV2
struct
{
type
ConfigV2
struct
{
ModelFormat
string
`json:"model_format"`
ModelFamily
string
`json:"model_family"`
ModelFamilies
[]
string
`json:"model_families"`
ModelType
string
`json:"model_type"`
FileType
string
`json:"file_type"`
// required by spec
// required by spec
Architecture
string
`json:"architecture"`
Architecture
string
`json:"architecture"`
OS
string
`json:"os"`
OS
string
`json:"os"`
RootFS
RootFS
`json:"rootfs"`
RootFS
RootFS
`json:"rootfs"`
api
.
ModelConfiguration
}
}
func
(
c
*
ConfigV2
)
SetModelFormat
(
format
string
)
{
func
(
c
*
ConfigV2
)
SetModelFormat
(
format
string
)
{
...
...
server/routes.go
View file @
9e1406e4
...
@@ -201,7 +201,6 @@ func GenerateHandler(c *gin.Context) {
...
@@ -201,7 +201,6 @@ func GenerateHandler(c *gin.Context) {
c
.
JSON
(
http
.
StatusOK
,
api
.
GenerateResponse
{
c
.
JSON
(
http
.
StatusOK
,
api
.
GenerateResponse
{
CreatedAt
:
time
.
Now
()
.
UTC
(),
CreatedAt
:
time
.
Now
()
.
UTC
(),
Model
:
req
.
Model
,
Model
:
req
.
Model
,
ModelConfiguration
:
model
.
Config
.
ModelConfiguration
,
Done
:
true
})
Done
:
true
})
return
return
}
}
...
@@ -262,7 +261,6 @@ func GenerateHandler(c *gin.Context) {
...
@@ -262,7 +261,6 @@ func GenerateHandler(c *gin.Context) {
resp
:=
api
.
GenerateResponse
{
resp
:=
api
.
GenerateResponse
{
Model
:
r
.
Model
,
Model
:
r
.
Model
,
ModelConfiguration
:
model
.
Config
.
ModelConfiguration
,
CreatedAt
:
r
.
CreatedAt
,
CreatedAt
:
r
.
CreatedAt
,
Done
:
r
.
Done
,
Done
:
r
.
Done
,
Response
:
r
.
Content
,
Response
:
r
.
Content
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment