Skip to content
Projects

LYiHub/liars-bar-llm

View on GitHub

LYiHub/liars-bar-llm has 671 GitHub stars and 122 forks. GitHot measured 0 stars in 24 hours. Last checked 2026-11-15 09:04 UTC. Last push 2025-03-07.

How these counts are measured

Measured star growth

in 24h
0
in 7 days
Collecting history
in 15 days
Collecting history
in 1 month
Collecting history

Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.

About

一个由大语言模型驱动的AI版骗子酒馆对战框架

Developer Tools

README.md

Original

Liars Bar LLM

一个由大语言模型驱动的AI版骗子酒馆对战框架

文件结构

程序主要分为两部分,游戏主体和分析工具

游戏主体

game.py 骗子酒馆游戏主程序

player.py 参与游戏的LLM智能体

game_record.py 用于保存和提取游戏记录

llm_client.py 用于配置模型接口和发起LLM请求

multi_game_runner.py 用于批量运行多轮游戏

分析工具

game_analyze.py 用于统计所有对局数据

player_matchup_analyze.py 用于提取互为对手的AI间的对局记录进行分析

json_convert.py 用于将json游戏记录转为可读文本

配置

使用conda环境配置相应依赖包:

pip install openai

本项目的API配置在llm_client.py中。

本项目利用了New API https://github.com/Calcium-Ion/new-api?tab=readme-ov-file 配置了统一的接口调用格式。使用时需自行配置相应模型的API接口。

也可以采用类似的API管理项目One API https://github.com/songquanpeng/one-api 实现统一的接口调用。

使用方法

运行

完成项目配置后,在game.py和multi_game_runner.py主程序入口的player_configs中设置正确的模型名称

运行单局游戏:

python game.py

运行多局游戏:

python multi_game_runner.py -n 10

在-n后指定你希望运行的游戏局数,默认为10局

分析

游戏记录会以json形式保存在目录下的game_records文件夹中

将json文件转为可读性更强的文本格式,转换后的文件会保存在目录下的converted_game_records文件夹中

python json_convert.py

提取所有游戏中AI之间两两对决的对局,转换后的文件会保存在目录下的matchup_records文件夹中

python player_matchup_analyze.py

统计并打印所有的对局数据

python game_analyze.py

Demo

项目已将 DeepSeek-R1、o3-mini、Gemini-2-flash-thinking、Claude-3.7-Sonnet 四个模型作为玩家运行了50局,记录存放在demo_records文件夹中。

已知问题

模型在出牌和质疑阶段的输出可能不稳定,当输出无法满足游戏规定时,会自动重试。如果多次因为输出问题中断运行,可在player.py的choose_cards_to_play和decide_challenge中增加调用大模型的重试次数,或修改prompt文件夹中的play_card_prompt_template.txt和challenge_prompt_template.txt提示词强化对输出格式的限制(可能对模型的推理能力有一定影响)。