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

开启AI提示词插件后,日志没有打印出追加的prompt内容 #1764

Open
yumc2573 opened this issue Feb 14, 2025 · 3 comments
Open

Comments

@yumc2573
Copy link

Why do you need it?

Is your feature request related to a problem? Please describe in details

How could it be?

A clear and concise description of what you want to happen. You can explain more about input of the feature, and output of it.

Other related information

Add any other context or screenshots about the feature request here.

@johnlanni
Copy link
Collaborator

AI观测插件,默认只打印最后一个消息的,可以自己修改AI观测插件的配置,来打印完整消息,可以参考文档:
https://higress.cn/docs/latest/plugins/ai/api-o11y/ai-statistics/?spm=36971b57.2ef5001f.0.0.2a932c1fxxwpP3#%E8%AE%B0%E5%BD%95%E9%97%AE%E9%A2%98%E4%B8%8E%E5%9B%9E%E7%AD%94

  - key: question # 记录问题
    value_source: request_body
    value: [email protected]
    apply_to_log: true

具体是这个配置,这里的 [email protected] 是基于 GJSON 的表达式,可以参考 GJSON 文档:https://github.com/tidwall/gjson/blob/master/SYNTAX.md?spm=36971b57.2ef5001f.0.0.2a932c1fxxwpP3&file=SYNTAX.md

例如,如果希望将所有 role 为 user 的 content 拼成一个数组作为 key,可以写成:messages.@reverse.#(role=="user")#.content

可以用这个工具测试:https://gjson.dev/?spm=36971b57.2ef5001f.0.0.2a932c1fxxwpP3

@yumc2573
Copy link
Author

@johnlanni

AI观测插件,默认只打印最后一个消息的,可以自己修改AI观测插件的配置,来打印完整消息,可以参考文档: https://higress.cn/docs/latest/plugins/ai/api-o11y/ai-statistics/?spm=36971b57.2ef5001f.0.0.2a932c1fxxwpP3#%E8%AE%B0%E5%BD%95%E9%97%AE%E9%A2%98%E4%B8%8E%E5%9B%9E%E7%AD%94

例如,如果希望将所有 role 为 user 的 content 拼成一个数组作为 key,可以写成:messages.@reverse.#(role=="user")#.content

可以用这个工具测试:https://gjson.dev/?spm=36971b57.2ef5001f.0.0.2a932c1fxxwpP3

当前日志:

Image
配置:

Image

Image
我追加的提示词没有打印

@johnlanni
Copy link
Collaborator

johnlanni commented Feb 17, 2025

我上面评论了哈,需要修改question这个attribute的value字段的jsonPath

可以改成:messages.#.content

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants