diff --git a/examples/agent/fastify-requirements.txt b/examples/agent/fastify-requirements.txt
index abd7fe8d1..286041174 100644
--- a/examples/agent/fastify-requirements.txt
+++ b/examples/agent/fastify-requirements.txt
@@ -2,4 +2,4 @@ fastapi[all]
pydantic
sse-starlette
uvicorn[all]
-typer[all]
\ No newline at end of file
+typer[all]
diff --git a/examples/agent/requirements.txt b/examples/agent/requirements.txt
index 01aab7cae..6ff121e93 100644
--- a/examples/agent/requirements.txt
+++ b/examples/agent/requirements.txt
@@ -5,4 +5,4 @@ pydantic
requests
sse-starlette
uvicorn[all]
-typer[all]
\ No newline at end of file
+typer[all]
diff --git a/examples/agent/run_sandboxed_tools.sh b/examples/agent/run_sandboxed_tools.sh
index 5dbe19246..2fde29568 100755
--- a/examples/agent/run_sandboxed_tools.sh
+++ b/examples/agent/run_sandboxed_tools.sh
@@ -71,4 +71,4 @@ docker run \
--mount "type=bind,source=$( realpath "$script_folder" ),target=/src,readonly" \
--mount "type=bind,source=$( realpath "$DATA_DIR" ),target=/data" \
-p "$PORT:$PORT" \
- -it "$LLAMA_IMAGE_NAME"
\ No newline at end of file
+ -it "$LLAMA_IMAGE_NAME"
diff --git a/examples/openai/api.py b/examples/openai/api.py
index 8f74cf99f..2de0ea686 100644
--- a/examples/openai/api.py
+++ b/examples/openai/api.py
@@ -87,4 +87,4 @@ class ChatCompletionResponse(BaseModel):
choices: list[Choice]
usage: Usage
system_fingerprint: str
- error: Optional[CompletionError] = None
\ No newline at end of file
+ error: Optional[CompletionError] = None
diff --git a/examples/openai/llama_cpp_server_api.py b/examples/openai/llama_cpp_server_api.py
index d7cd08c44..db934919d 100644
--- a/examples/openai/llama_cpp_server_api.py
+++ b/examples/openai/llama_cpp_server_api.py
@@ -9,4 +9,4 @@ class LlamaCppServerCompletionRequest(LlamaCppParams):
cache_prompt: Optional[bool] = None
grammar: Optional[str] = None
- json_schema: Optional[Json] = None
\ No newline at end of file
+ json_schema: Optional[Json] = None
diff --git a/examples/openai/prompt1.txt b/examples/openai/prompt1.txt
deleted file mode 100644
index afae47380..000000000
--- a/examples/openai/prompt1.txt
+++ /dev/null
@@ -1,43 +0,0 @@
-<|im_start|>system
-Role:
- You are a function calling AI agent with self-recursion.
- You can call only one function at a time and analyse data you get from function response.
- You are provided with function signatures within XML tags.
- The current date is: March 25, 2024.
-
-Objective:
- You may use agentic frameworks for reasoning and planning to help with user query.
- Please call a function and wait for function results to be provided to you in the next iteration.
- Don't make assumptions about what values to plug into function arguments.
- Once you have called a function, results will be fed back to you within XML tags.
- Don't make assumptions about tool results if XML tags are not present since function hasn't been executed yet.
- Analyze the data once you get the results and call another function.
- At each iteration please continue adding the your analysis to previous summary.
- Your final response should directly answer the user query with an anlysis or summary of the results of function calls.
-
-Tools:
- Here are the available tools:
-
- {"type":"function","function":{"name":"get_current_weather","description":"Get the current weather","parameters":{"type":"object","properties":{"location":{"type":"string","description":"The city and state, e.g. San Francisco, CA"},"format":{"type":"string","enum":["celsius","fahrenheit"],"description":"The temperature unit to use. Infer this from the users location."}},"required":["location","format"]}}}
- {"type":"function","function":{"name":"get_n_day_weather_forecast","description":"Get an N-day weather forecast","parameters":{"type":"object","properties":{"location":{"type":"string","description":"The city and state, e.g. San Francisco, CA"},"format":{"type":"string","enum":["celsius","fahrenheit"],"description":"The temperature unit to use. Infer this from the users location."},"num_days":{"type":"integer","description":"The number of days to forecast"}},"required":["location","format","num_days"]}}}
-
- If the provided function signatures doesn't have the function you must call, you may write executable python code in markdown syntax and call code_interpreter() function as follows:
-
- {"arguments": {"code_markdown": , "name": "code_interpreter"}}
-
- Make sure that the json object above with code markdown block is parseable with json.loads() and the XML block with XML ElementTree.
-
-Instructions:
- At the very first turn you don't have so you shouldn't not make up the results.
- Please keep a running summary with analysis of previous function results and summaries from previous iterations.
- Do not stop calling functions until the task has been accomplished or you've reached max iteration of 10.
- Calling multiple functions at once can overload the system and increase cost so call one function at a time please.
- If you plan to continue with analysis, always call another function.
- For each function call return a valid json object (using doulbe quotes) with function name and arguments within XML tags as follows:
-
- {"arguments": , "name": }
-
-<|im_end|>
-<|im_start|>user
-what is the weather going to be like in San Francisco and Glasgow over the next 4 days (temperature in celsius for both)<|im_end|>
-<|im_start|>assistant
\ No newline at end of file
diff --git a/examples/openai/requirements.txt b/examples/openai/requirements.txt
index b092bf19f..368dacf9a 100644
--- a/examples/openai/requirements.txt
+++ b/examples/openai/requirements.txt
@@ -4,4 +4,4 @@ jinja2
pydantic
sse-starlette
uvicorn[all]
-typer[all]
\ No newline at end of file
+typer[all]
diff --git a/examples/openai/server.py b/examples/openai/server.py
index 21e69fa92..7bacc55b4 100644
--- a/examples/openai/server.py
+++ b/examples/openai/server.py
@@ -139,7 +139,7 @@ def main(
messages = chat_request.messages
prompt = chat_handler.render_prompt(messages)
-
+
if verbose:
sys.stderr.write(f'\n# REQUEST:\n\n{chat_request.model_dump_json(indent=2)}\n\n')
# sys.stderr.write(f'\n# MESSAGES:\n\n{TypeAdapter(list[Message]).dump_json(messages)}\n\n')
diff --git a/examples/openai/test_chat_handlers.py b/examples/openai/test_chat_handlers.py
index 7d4c89c87..50b39f47c 100644
--- a/examples/openai/test_chat_handlers.py
+++ b/examples/openai/test_chat_handlers.py
@@ -202,14 +202,14 @@ if __name__ == "__main__":
ch = get_chat_handler(args, parallel_calls=True, tool_style=style)
print(f'\n### {model_name} / {style.name} / {tool_situation}\n')
-
+
print(f'\nPrompt:\n\n```js\n{ch.render_prompt(TEST_MESSAGES_THOUGHT)}\n```\n')
print(f'\nOutput format prompt:\n\n```json\n{ch.output_format_prompt.content}\n```\n')
print(f'\nGrammar:\n\n```js\n{ch.grammar}\n```\n')
-
+
# if model_name == 'hermes_2_pro_mistral':
# print("Skipping hermes_2_pro_mistral")
# continue
@@ -233,38 +233,3 @@ if __name__ == "__main__":
print(f'{f}\n\n')
assert not failures
- # test_templates([
- # Message(**{
- # "role": "user",
- # "name": None,
- # "tool_call_id": None,
- # "content": "What is the sum of 2535 squared and 32222000403 then multiplied by one and a half. What's a third of the result?",
- # "tool_calls": None
- # }),
- # Message(**{
- # "role": "assistant",
- # # "name": None,
- # "tool_call_id": None,
- # "content": "?",
- # "tool_calls": [
- # {
- # # "id": "call_531873",
- # "type": "function",
- # "function": {
- # "name": TOOL_NAME,
- # "arguments": {
- # "a": 2535,
- # "b": 32222000403
- # }
- # }
- # }
- # ]
- # }),
- # Message(**{
- # "role": "tool",
- # "name": TOOL_NAME,
- # "tool_call_id": "call_531873",
- # "content": "32222002938",
- # "tool_calls": None
- # })
- # ])
diff --git a/gguf-py/examples/reader.py b/gguf-py/examples/reader.py
index 62e0769da..aaebe05d5 100644
--- a/gguf-py/examples/reader.py
+++ b/gguf-py/examples/reader.py
@@ -3,7 +3,6 @@ import sys
from pathlib import Path
from gguf.gguf_reader import GGUFReader
-
sys.path.insert(0, str(Path(__file__).parent.parent))
diff --git a/gguf-py/gguf/gguf_reader.py b/gguf-py/gguf/gguf_reader.py
index 33afac552..3500c7613 100644
--- a/gguf-py/gguf/gguf_reader.py
+++ b/gguf-py/gguf/gguf_reader.py
@@ -50,6 +50,7 @@ class ReaderField(NamedTuple):
types: list[GGUFValueType] = []
+
class ReaderTensor(NamedTuple):
name: str
tensor_type: GGMLQuantizationType