Skip to content

Commit

Permalink
add a repl with some handy classes instantiated
Browse files Browse the repository at this point in the history
  • Loading branch information
nick committed Aug 21, 2024
1 parent f971df6 commit 090471f
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ops.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ actions:
command: cd container && ops
alias: c
load_secrets: true
repl:
command: rails r scripts/repl
load_secrets: true
shell_expansion: true
options:
environment:
HOMEBREW_PREFIX: $(brew --prefix)
Expand Down
22 changes: 22 additions & 0 deletions scripts/repl
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
puts "Loading REPL in Rails environment..."

chromadb = Chromadb::Client.new
embedder = Embedder.new(model_config: Setting.embedding_model)
chat = Helpers::ModelClientHelper.new(model_config: Setting.chat_model)
neo4j = Neo4j::Driver::GraphDatabase.driver(
ENV.fetch('NEO4J_URL', 'neo4j://localhost:7687'),
Neo4j::Driver::AuthTokens.basic(ENV.fetch('NEO4J_USERNAME', 'neo4j'), ENV.fetch('NEO4J_PASSWORD', 'password'))
)

puts <<~HELP
Available tools:

- chromadb: a ChromaDB client
- embedder: an Embedder instance
- chat: an Ollama client for the chat model
- neo4j: a Neo4j driver
HELP

binding.pry

puts "Exiting REPL..."

0 comments on commit 090471f

Please sign in to comment.