With this syntax, the LangStream CLI downloads the file and stores it in the java/lib folder.
Add a .gitignore rule to avoid committing the jar file to your git repository.
This is a sample .gitignore file to put at the root of your application directory in order to not commit the jar file to your git repository:
java/lib/*
Querying a JDBC datasource
You can query a JDBC datasource using the "query" or the "query-vector-db" agent in your pipeline.
pipeline: - name:"lookup-related-documents"type:"query-vector-db"configuration:datasource:"JdbcDatasource" query: "SELECT text FROM documents ORDER BY cosine_similarity(embeddings_vector, CAST(? as FLOAT ARRAY)) DESC LIMIT 5"
fields: - "value.question_embeddings"
As usual you can use the '?' symbol as a placeholder for the fields that you specify in the "query" section. The syntax for performing an Approximate Nearest Neighbor search is specific to the database you are using, in the example above we are using the HerdDB syntax.
Special assets for JDBC datasources
You can automatically manage the tables on your JDBC datasource using the "jdbc-table" asset type.
You can specify any number of statements in the "create-statements" and in the "delete-statements" sections, for instance to create indexes or other objects.
Writing to a JDBC datasource
Use the "vector-db-sink" agent with the following parameters to write to a JDBC database:
Set the table-name to the name of the table you want to write to. Define the fields in the "fields" list. This works similarly to the 'compute' agent, and you can use the same syntax to define the fields. It is important that you tag the fields that are part of the primary key of the table with "primary-key: true". This is needed to correctly manage upserts and deletion from the table.