Skip to content

Commit 0e87ae2

Browse files
author
ochafik
committed
rm trailing spaces
1 parent f645887 commit 0e87ae2

File tree

5 files changed

+20
-20
lines changed

5 files changed

+20
-20
lines changed

common/minja.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,7 +1009,7 @@ class FilterNode : public TemplateNode {
10091009
throw std::runtime_error("Filter must be a callable: " + filter_value.dump());
10101010
}
10111011
std::string rendered_body = body->render(context);
1012-
1012+
10131013
ArgumentsValue filter_args = {{Value(rendered_body)}, {}};
10141014
auto result = filter_value.call(context, filter_args);
10151015
out << result.to_str();
@@ -1181,7 +1181,7 @@ class UnaryOpExpr : public Expression {
11811181
case Op::Expansion:
11821182
case Op::ExpansionDict:
11831183
throw std::runtime_error("Expansion operator is only supported in function calls and collections");
1184-
1184+
11851185
}
11861186
throw std::runtime_error("Unknown unary operator");
11871187
}

examples/agent/run.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ async def main(
8080
api_key = os.environ.get(provider_info['api_key_env'])
8181

8282
tool_map, tools = await discover_tools(tool_endpoints or [], verbose)
83-
83+
8484
if think:
8585
tools.append({
8686
'type': 'function',

examples/agent/tools/memory.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,33 @@
22
Memory tools that use sqlite-vec as a vector database (combined w/ sqlite-lembed or sqlite-rembed for embeddings).
33
44
Note: it's best to run this in a silo w/:
5-
5+
66
./examples/agent/serve_tools_inside_docker.sh
77
88
# Run w/o other tools:
9-
9+
1010
## Prerequisites:
11-
11+
1212
pip install aiosqlite "fastapi[standard]" sqlite-lembed sqlite-rembed sqlite-vec uvicorn
13-
13+
1414
## Usage w/ sqlite-rembed:
15-
15+
1616
./llama-server --port 8081 -fa -c 0 --embeddings --rope-freq-scale 0.75 \
1717
-hfr nomic-ai/nomic-embed-text-v1.5-GGUF -hff nomic-embed-text-v1.5.Q4_K_M.gguf
1818
MEMORY_SQLITE_DB=memory_rembed.db \
1919
EMBEDDINGS_DIMS=768 \
2020
EMBEDDINGS_ENDPOINT=http://localhost:8081/v1/embeddings \
2121
python examples/agent/tools/memory.py
22-
22+
2323
## Usage w/ sqlite-lembed:
24-
24+
2525
MEMORY_SQLITE_DB=memory_lembed.db \
2626
EMBEDDINGS_DIMS=768 \
2727
EMBEDDINGS_MODEL_FILE=~/Library/Caches/llama.cpp/nomic-embed-text-v1.5.Q4_K_M.gguf \
2828
python examples/agent/tools/memory.py
2929
3030
## Test:
31-
31+
3232
curl -X POST "http://localhost:8000/memorize" -H "Content-Type: application/json" -d '["User is Olivier Chafik", "User is a Software Engineer"]'
3333
curl -X POST "http://localhost:8000/search_memory?text=What%20do%20we%20do%3F"
3434
'''
@@ -65,7 +65,7 @@
6565

6666

6767
async def setup_db(db: aiosqlite.Connection):
68-
68+
6969
await db.enable_load_extension(True)
7070
await db.load_extension(sqlite_vec.loadable_path())
7171
if local:
@@ -75,7 +75,7 @@ async def setup_db(db: aiosqlite.Connection):
7575
await db.enable_load_extension(False)
7676

7777
client_name = 'default'
78-
78+
7979
if local:
8080
await db.execute(f'''
8181
INSERT INTO lembed_models(name, model) VALUES (
@@ -88,7 +88,7 @@ async def setup_db(db: aiosqlite.Connection):
8888
'{client_name}', rembed_client_options('format', 'llamafile', 'url', ?, 'key', ?)
8989
);
9090
''', (embeddings_endpoint, embeddings_api_key))
91-
91+
9292
async def create_vector_index(table_name, text_column, embedding_column):
9393
'''
9494
Create an sqlite-vec virtual table w/ an embedding column
@@ -145,7 +145,7 @@ def search(text: str, top_n: int, columns: list[str] = ['rowid', text_column]):
145145
JOIN {table_name} USING (rowid)
146146
''',
147147
(text, top_n)
148-
)
148+
)
149149
return search
150150

151151
await db.execute('''
@@ -155,9 +155,9 @@ def search(text: str, top_n: int, columns: list[str] = ['rowid', text_column]):
155155
)
156156
''')
157157
facts_search = await create_vector_index('facts', 'content', 'embedding')
158-
158+
159159
await db.commit()
160-
160+
161161
return dict(
162162
facts_search=facts_search,
163163
)
@@ -185,7 +185,7 @@ async def search_memory(text: str, top_n: int = 10):
185185
results = await cursor.fetchall()
186186
cols = [c[0] for c in cursor.description]
187187
return [dict(zip(cols, row)) for row in results]
188-
188+
189189

190190
# This main entry point is just here for easy debugging
191191
if __name__ == '__main__':

examples/server/tests/pytest.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[pytest]
22
markers =
33
slow: marks tests as slow (deselect with '-m "not slow"')
4-
serial
4+
serial

examples/server/tests/unit/test_chat_completion.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ def test_completion_with_required_tool(template_name: str, n_predict: int, tool:
231231
{"role": "user", "content": "Write an example"},
232232
],
233233
"tool_choice": "required",
234-
"tools": [tool],
234+
"tools": [tool],
235235
"parallel_tool_calls": False,
236236
})
237237
assert res.status_code == 200, f"Expected status code 200, got {res.status_code}"

0 commit comments

Comments
 (0)