json: cleanup test
This commit is contained in:
parent
917b5d2260
commit
ee6166af73
2 changed files with 1 additions and 29 deletions
|
@ -667,7 +667,6 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
string json_schema_to_grammar(const json& schema) {
|
string json_schema_to_grammar(const json& schema) {
|
||||||
SchemaConverter converter(/* fetch_json= */ std::nullopt, /* dotall= */ false);
|
SchemaConverter converter(/* fetch_json= */ std::nullopt, /* dotall= */ false);
|
||||||
auto copy = schema;
|
auto copy = schema;
|
||||||
|
@ -676,23 +675,3 @@ string json_schema_to_grammar(const json& schema) {
|
||||||
converter.check_errors();
|
converter.check_errors();
|
||||||
return converter.format_grammar();
|
return converter.format_grammar();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef LLAMA_BUILD_JSON_SCHEMA_CONVERTER
|
|
||||||
|
|
||||||
int main(int argc, const char** argv) {
|
|
||||||
if (argc != 2) {
|
|
||||||
cerr << "Expected only one argument" << endl;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
string file(argv[1]);
|
|
||||||
string schema;
|
|
||||||
if (file == "-") {
|
|
||||||
schema.append(istreambuf_iterator<char>(cin), istreambuf_iterator<char>());
|
|
||||||
} else {
|
|
||||||
ifstream in(argv[1]);
|
|
||||||
schema.append(istreambuf_iterator<char>(in), istreambuf_iterator<char>());
|
|
||||||
}
|
|
||||||
cout << json_schema_to_grammar(json::parse(schema)).c_str() << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
|
@ -2,17 +2,10 @@
|
||||||
#undef NDEBUG
|
#undef NDEBUG
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "llama.h"
|
#include "../examples/server/json-schema-to-grammar.h"
|
||||||
#include "grammar-parser.h"
|
|
||||||
#include <cstdio>
|
|
||||||
#include <cstdlib>
|
|
||||||
#include <filesystem>
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <istream>
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include "../examples/server/json-schema-to-grammar.h"
|
|
||||||
#include <cassert>
|
|
||||||
#include <regex>
|
#include <regex>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue