Commit fa2f095b authored by Jeffrey Morgan's avatar Jeffrey Morgan
Browse files

fix model name returned by `/api/generate` being different than the model name provided

parent 045b855d
...@@ -545,7 +545,6 @@ type prediction struct { ...@@ -545,7 +545,6 @@ type prediction struct {
const maxBufferSize = 512 * format.KiloByte const maxBufferSize = 512 * format.KiloByte
type PredictOpts struct { type PredictOpts struct {
Model string
Prompt string Prompt string
Format string Format string
CheckpointStart time.Time CheckpointStart time.Time
...@@ -553,7 +552,6 @@ type PredictOpts struct { ...@@ -553,7 +552,6 @@ type PredictOpts struct {
} }
type PredictResult struct { type PredictResult struct {
Model string
CreatedAt time.Time CreatedAt time.Time
TotalDuration time.Duration TotalDuration time.Duration
LoadDuration time.Duration LoadDuration time.Duration
...@@ -651,7 +649,6 @@ func (llm *llama) Predict(ctx context.Context, predict PredictOpts, fn func(Pred ...@@ -651,7 +649,6 @@ func (llm *llama) Predict(ctx context.Context, predict PredictOpts, fn func(Pred
if p.Content != "" { if p.Content != "" {
fn(PredictResult{ fn(PredictResult{
Model: predict.Model,
CreatedAt: time.Now().UTC(), CreatedAt: time.Now().UTC(),
Content: p.Content, Content: p.Content,
}) })
...@@ -659,7 +656,6 @@ func (llm *llama) Predict(ctx context.Context, predict PredictOpts, fn func(Pred ...@@ -659,7 +656,6 @@ func (llm *llama) Predict(ctx context.Context, predict PredictOpts, fn func(Pred
if p.Stop { if p.Stop {
fn(PredictResult{ fn(PredictResult{
Model: predict.Model,
CreatedAt: time.Now().UTC(), CreatedAt: time.Now().UTC(),
TotalDuration: time.Since(predict.CheckpointStart), TotalDuration: time.Since(predict.CheckpointStart),
......
...@@ -260,7 +260,7 @@ func GenerateHandler(c *gin.Context) { ...@@ -260,7 +260,7 @@ func GenerateHandler(c *gin.Context) {
} }
resp := api.GenerateResponse{ resp := api.GenerateResponse{
Model: r.Model, Model: req.Model,
CreatedAt: r.CreatedAt, CreatedAt: r.CreatedAt,
Done: r.Done, Done: r.Done,
Response: r.Content, Response: r.Content,
...@@ -288,7 +288,6 @@ func GenerateHandler(c *gin.Context) { ...@@ -288,7 +288,6 @@ func GenerateHandler(c *gin.Context) {
// Start prediction // Start prediction
predictReq := llm.PredictOpts{ predictReq := llm.PredictOpts{
Model: model.Name,
Prompt: prompt, Prompt: prompt,
Format: req.Format, Format: req.Format,
CheckpointStart: checkpointStart, CheckpointStart: checkpointStart,
...@@ -985,7 +984,7 @@ func ChatHandler(c *gin.Context) { ...@@ -985,7 +984,7 @@ func ChatHandler(c *gin.Context) {
loaded.expireTimer.Reset(sessionDuration) loaded.expireTimer.Reset(sessionDuration)
resp := api.ChatResponse{ resp := api.ChatResponse{
Model: r.Model, Model: req.Model,
CreatedAt: r.CreatedAt, CreatedAt: r.CreatedAt,
Done: r.Done, Done: r.Done,
Metrics: api.Metrics{ Metrics: api.Metrics{
...@@ -1007,7 +1006,6 @@ func ChatHandler(c *gin.Context) { ...@@ -1007,7 +1006,6 @@ func ChatHandler(c *gin.Context) {
// Start prediction // Start prediction
predictReq := llm.PredictOpts{ predictReq := llm.PredictOpts{
Model: model.Name,
Prompt: prompt, Prompt: prompt,
Format: req.Format, Format: req.Format,
CheckpointStart: checkpointStart, CheckpointStart: checkpointStart,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment