Comments (4)
Here is a way to reproduce your original schema using Pyvespa:
the_struct = Struct(name="answer", fields=[
Field(name="folder_ids", type="array<string>"),
Field(name="likes", type="int"),
Field(name="dislikes", type="int"),
Field(name="retriever_name", type="string"),
Field(name="reader_name", type="string"),
Field(name="passage_id", type="string"),
Field(name="user_ids_likes", type="array<string>"),
Field(name="user_ids_dislikes", type="array<string>"),
])
the_field = Field(name="answers", type="array<answer>", indexing=["summary", "index"])
schema = Schema(name="schema", document=Document())
schema.add_fields(the_field)
schema.document.add_structs(the_struct)
print(schema.schema_to_text)
This produces the following
schema schema {
document schema {
field answers type array<answer> {
indexing: summary | index
}
struct answer {
field folder_ids type array<string> {
}
field likes type int {
}
field dislikes type int {
}
field retriever_name type string {
}
field reader_name type string {
}
field passage_id type string {
}
field user_ids_likes type array<string> {
}
field user_ids_dislikes type array<string> {
}
}
}
}
StructField actually belongs to a normal Field, not a Struct. Here is an example:
the_struct = Struct(name="answer", fields=[
Field(name="foo", type="int"),
])
the_field = Field(name="answers",
type="array<answer>",
indexing=["summary", "index"],
struct_fields=[StructField(name="foo", indexing=["attribute"], attribute=["fast-search"])]
)
schema = Schema(name="schema", document=Document())
schema.add_fields(the_field)
schema.document.add_structs(the_struct)
print(schema.schema_to_text)
Output:
schema schema {
document schema {
field answers type array<answer> {
indexing: summary | index
struct-field foo {
indexing: attribute
attribute {
fast-search
}
}
}
struct answer {
field foo type int {
}
}
}
}
Hope this helps. Reach out if anything is unclear.
from pyvespa.
How are you adding the Struct and Field to the Schema? Could you provide a minimal code example to reproduce the error?
from pyvespa.
Hey @tmaregge
Already shared above, but basically like this:
Struct(name="answer", fields=[
StructField(name="folder_ids", type="array<string>", indexing=["summary", "index"]),
StructField(name="likes", type="int", indexing=["summary", "index"]),
StructField(name="dislikes", type="int", indexing=["summary", "index"]),
StructField(name="retriever_name", type="string", indexing=["summary", "index"]),
StructField(name="reader_name", type="string", indexing=["summary", "index"]),
StructField(name="passage_id", type="string", indexing=["summary", "index"]),
StructField(name="user_ids_likes", type="array<string>", indexing=["summary", "index"]),
StructField(name="user_ids_dislikes", type="array<string>", indexing=["summary", "index"]),
]),
Field(name="answers", type="array<answer>", indexing=["summary", "index"]),
from pyvespa.
Thank you @tmaregge. I was able to fully reproduce my schema using pyvespa.
Closing this.
from pyvespa.
Related Issues (20)
- How does Vespa handle ColBERT type queries? HOT 1
- Expose URL in VespaDocker
- Fix windows-compatibility of `VespaCloud()._vespa_auth_login`
- Add OS and python-version matrix for unit tests
- ModuleNotFoundError: No module named 'termios'" error after pyvespa version 0.40.0 in Windows
- Pin `requests`-version HOT 1
- Support document expiry using pyvespa
- Improve docs on TokenAuth - both deployment and connect HOT 1
- Possible bug in VespaAsync/Vespa.asyncio HOT 3
- Add example usage to `VespaAsync`docstring HOT 1
- Unable to access termios submodule on Windows HOT 1
- CI: Fix and add back `scaling_personal_assistants`-notebook to tests HOT 1
- Add compression support HOT 1
- Configure workflows for running actions on PR from forks HOT 1
- Consider custom JSON-library
- Add compression support for feed and query (post)
- Notebook batch updates - simplify auth HOT 1
- Add support for configuring tuning/persearch threads
- Fix/update langchain links in notebooks
- Ensure notebooks-cloud integration tests run on current pyvespa-version HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyvespa.