wkok / openai-clojure

Clojure functions to drive the OpenAI API
https://cljdoc.org/d/net.clojars.wkok/openai-clojure
MIT License
208 stars 28 forks source link

Namespace "Martian.encoders" not found #58

Closed nsadeh closed 7 months ago

nsadeh commented 7 months ago

Hello, I am using openai-clojure version 0.16.0. When I evaluate my project with Cider, I get the following errors:

  1. first evaluation after jacking in: com.fasterxml.jackson.core.StreamWriteConstraints
  2. second evaluation after the previous one: no such variable json/encode
  3. third and after: namespace "martian.encoders" not found

Attached is my project.clj:

(defproject voting-records "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :url "http://example.com/FIXME"
  :license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0"
            :url "https://www.eclipse.org/legal/epl-2.0/"}
  :dependencies [[org.clojure/clojure "1.11.1"]
                 [environ "1.2.0"]
                 [com.cognitect.aws/api "0.8.686"]
                 [com.cognitect.aws/endpoints "1.1.12.504"]
                 [com.cognitect.aws/s3 "848.2.1413.0"]
                 [io.pinecone/pinecone-client "0.7.2"]
                 [com.taoensso/carmine  "3.3.2"]
                 [org.clojure/data.xml "0.2.0-alpha8"]
                 [cheshire "5.13.0"]
                 [org.apache.opennlp/opennlp-tools "2.3.2"]
                 [org.apache.pdfbox/pdfbox "3.0.1"]
                 [org.apache.pdfbox/io "3.0.0-alpha3"]
                 [com.brunobonacci/mulog-adv-console "0.9.0"]
                 [net.clojars.wkok/openai-clojure "0.16.0"]]
  :main ^:skip-aot voting-records.core
  :target-path "target/%s"
  :aliases {"kaocha" ["run" "-m" "kaocha.runner"]}
  :profiles {:uberjar {:aot :all
                       :jvm-opts ["-Dclojure.compiler.direct-linking=true"]}
             :test {:dependencies [[lambdaisland/kaocha "1.87.1366"]
                                   [org.clojure/test.check "0.9.0"]]}})
nsadeh commented 7 months ago

this happens even if I just import the package, like so

(ns my-namespace.llm
  (:require
   [wkok.openai-clojure.api :as llm-api]))
nsadeh commented 7 months ago

I narrowed this down to a user error: I used Cheshire 5.13.0, which doesn't exist. The reason I used it is because it's currently on the front page of Cheshire as per the screenshots, but isn't a release. Screenshot 2024-04-08 at 10 47 49 PM Screenshot 2024-04-08 at 10 48 05 PM

wkok commented 7 months ago

All sorted now? Can we close this?

nsadeh commented 7 months ago

Yes, hopefully this is useful for posterity because it's an easy error to make.