Skip to content
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

fix #11026 model config return #11126

Closed

Conversation

kenwoodjw
Copy link
Contributor

Summary

fix #11026 model config return

Tip

Close issue syntax: Fixes #<issue number> or Resolves #<issue number>, see documentation for more details.

Screenshots

Before: After:
... ...

Checklist

Important

Please review the checklist below before submitting your pull request.

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.
  • I ran dev/reformat(backend) and cd web && npx lint-staged(frontend) to appease the lint gods

@dosubot dosubot bot added size:XS This PR changes 0-9 lines, ignoring generated files. 🐞 bug Something isn't working labels Nov 26, 2024
Signed-off-by: kenwoodjw <[email protected]>
@crazywoola
Copy link
Member

Please run dev/reformat to pass the lint.

else:
app_model_config = (
db.session.query(AppModelConfig).filter(AppModelConfig.id == self.app_model_config_id).first()
)
if app_model_config:
model_config = app_model_config.to_dict()
model_config["model_dict"] = app_model_config.model_dict
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The property is already present in the 'model' object when we call the 'to_dict()' method. It appears that this issue cannot be resolved.

Copy link
Contributor Author

@kenwoodjw kenwoodjw Nov 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand the issue now, as model_config corresponds to model_config_fields, not simple_model_config_fields. Perhaps this approach would work:

simple_model_config_fields = {
    "model": fields.Raw(attribute="model"),
    "pre_prompt": fields.String,
}

What do you think?

@laipz8200
Copy link
Member

image

In fact, we are currently losing the parameters in the completion_params. As you can see, this field only contains a 'stop' now, but the model parameters such as 'temperature' and 'top_p' should be contained in here.

@kenwoodjw
Copy link
Contributor Author

@laipz8200 So the mode_config should return like that

"model_config": {
                "model": {
                    "provider": "deepseek",
                    "name": "deepseek-chat",
                    "mode": "chat",
                    "completion_params": {
                        "stop": [],
                        "top_p": [],
                        "temperature": []
                    }
                },
                "pre_prompt": ""
            }

or simple ?

@laipz8200
Copy link
Member

laipz8200 commented Nov 29, 2024

@laipz8200 So the mode_config should return like that

"model_config": {
                "model": {
                    "provider": "deepseek",
                    "name": "deepseek-chat",
                    "mode": "chat",
                    "completion_params": {
                        "stop": [],
                        "top_p": [],
                        "temperature": []
                    }
                },
                "pre_prompt": ""
            }

or simple ?

Yes, here is the correct structure of completion_params(from the front-end):

image

@kenwoodjw
Copy link
Contributor Author

After my test, I opened the parameter options.
image

Returning the results we desire.
image

image

Signed-off-by: kenwoodjw <[email protected]>
@laipz8200
Copy link
Member

We found that is better to fix it at the frond-end, would you mind checking #11298?

@kenwoodjw
Copy link
Contributor Author

We found that is better to fix it at the frond-end, would you mind checking #11298?

Ok, I will close the PR

@kenwoodjw kenwoodjw closed this Dec 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working size:XS This PR changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Chat conversations (in logs) cannot return the model config correctly
3 participants