(ctx, query, max_length, top_p, temperature, use_stream_chat)
| 12 | |
| 13 | |
| 14 | def predict(ctx, query, max_length, top_p, temperature, use_stream_chat): |
| 15 | ctx.limit_round() |
| 16 | flag = True |
| 17 | for _, output in infer( |
| 18 | query=query, |
| 19 | history=ctx.history, |
| 20 | max_length=max_length, |
| 21 | top_p=top_p, |
| 22 | temperature=temperature, |
| 23 | use_stream_chat=use_stream_chat |
| 24 | ): |
| 25 | if flag: |
| 26 | ctx.append(query, output) |
| 27 | flag = False |
| 28 | else: |
| 29 | ctx.update_last(query, output) |
| 30 | yield ctx.rh, "" |
| 31 | ctx.refresh_last() |
| 32 | yield ctx.rh, "" |
| 33 | |
| 34 | |
| 35 | def clear_history(ctx): |
nothing calls this directly
no test coverage detected