You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# The ObjectBox Store represents a database; keep it around...
77
51
store = objectbox.Store(model=model)
78
52
79
-
#Open the box of "Person" entity. This can be called many times but you can also pass the variable around
53
+
#Get a box for the "Person" entity; a Box is the main interaction point with objects and the database.
80
54
box = store.box(Person)
81
55
82
56
person = Person()
@@ -88,65 +62,46 @@ box.put(person) # Update
88
62
box.remove(person) # Delete
89
63
```
90
64
91
-
Additionally, see the [TaskList example app](https://github.com/objectbox/objectbox-python/tree/main/example). After checking out this repository to run the example:
65
+
Getting started
66
+
---------------
67
+
Latest version: 4.0.0a0 (2024-05-15)
68
+
69
+
To install or update the latest version of ObjectBox, run this:
70
+
71
+
```bash
72
+
pip install --upgrade --pre objectbox # "--pre" because you want to get the 4.0.0 alpha version
92
73
```
93
-
// Set up virtual environment, download ObjectBox libraries
94
-
make depend
74
+
Now you are ready to use ObjectBox in your Python project.
95
75
96
-
// Activate virtual environment...
97
-
// ...on Linux
98
-
source .venv/bin/activate
99
-
// ...on Windows
100
-
.venv\Scripts\activate
76
+
Head over to the **[ObjectBox documentation](https://docs.objectbox.io)**
77
+
and learn how to setup your first entity classes.
101
78
102
-
// Run the example
103
-
python3 -m example
79
+
### Examples
104
80
105
-
// Once done, leave the virtual environment
106
-
deactivate
107
-
```
81
+
Do you prefer to dive right into working examples?
82
+
We have you covered in the [example](example/) folder.
83
+
It comes with a task list application and a vector search example using cities.
84
+
Additionally, for AI enthusiasts, we provide an "ollama" example,
85
+
which integrates a local LLM (via [ollama](https://ollama.com))
86
+
with ObjectBox to manage and search embeddings effectively.
108
87
109
-
For more information and code examples, see the tests folder. The docs for other languages may also help you understand the basics.
Copy file name to clipboardExpand all lines: example/README.md
+20-4Lines changed: 20 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -1,14 +1,29 @@
1
1
# ObjectBox-Python Examples
2
2
3
-
The following examples are available from this repository.
3
+
This directory contains a couple of examples that demonstrate capabilities of ObjectBox using the Python API.
4
+
5
+
As we are currently short before releasing 4.0 version, please install the pre-release version of `objectbox` from PyPI via `pip`; for example, on UN*X-flavour platforms:
6
+
7
+
```shell
8
+
cd example # assuming you are in project root dir
9
+
python3 -m venv venv
10
+
source venv/bin/activate
11
+
pip install --pre objectbox
12
+
```
13
+
14
+
The following examples are available from this directory:
15
+
16
+
-`tasks`: CRUD Application Example (see below for details)
17
+
-`vectorsearch-cities`: VectorSearch Application Example (see below for details)
18
+
-`ollama`: LLM + VectorSearch Embeddings Script Example (See [ollama/README.md](./ollama/README.md) for details)
19
+
4
20
5
21
## Application Example: Tasks
6
22
7
23
This is our classic Tasks application using a CLI.
8
24
9
25
```
10
-
cd example
11
-
python -m tasks
26
+
$ python -m tasks
12
27
13
28
Welcome to the ObjectBox tasks-list app example. Type help or ? for a list of commands.
14
29
> new buy oat
@@ -36,7 +51,8 @@ This example application starts with a pre-defined set of capital cities and the
36
51
It allows to search for nearest neighbors of a city (`city_neighbors`) or by coordinates (`neighbors`) as well as adding more locations (`add`).
37
52
38
53
```
39
-
python -m vectorsearch-cities
54
+
$ python -m vectorsearch-cities
55
+
40
56
Welcome to the ObjectBox vectorsearch-cities example. Type help or ? for a list of commands.
0 commit comments