GithubHelp home page GithubHelp logo

Comments (9)

haonan-li avatar haonan-li commented on September 22, 2024

We are working on it and will update soon.

from openfactverification.

pselvana avatar pselvana commented on September 22, 2024

A quick hack is replacing the following in GPTClient.py:

            self.client = OpenAI(api_key=openai_dict["key"])

with:

            self.client = OpenAI(
                api_key="not-needed", base_url="http://localhost:1234/v1"
            )

If you dockerized it and are running on mac then you can use docker.for.mac.localhost instead of localhost.

Hacky Dockerfile in the root folder if that is helpful --- you would have to update the secret_dict.template Serper API value as well:

FROM python:3.9.16-bullseye
RUN apt-get update && apt-get install -y vim
ADD . / OpenFactVerification/
WORKDIR /OpenFactVerification
RUN cp /OpenFactVerification/factcheck/config/secret_dict.template /OpenFactVerification/factcheck/config/secret_dict.py
RUN pip install -r requirements.txt
RUN python -m nltk.downloader punkt

EXPOSE 2024
ENTRYPOINT [ "python", "webapp.py" ]

I'm thinking of connecting an additional evidence crawler to get around needing Serper: https://github.com/searxng/searxng

from openfactverification.

shuther avatar shuther commented on September 22, 2024

Yes that is a good start; ideally it is a variable for the docker that we can adapt in the .env file. For the search api, it is definitely something interesting to leverage https://docs.searxng.org/dev/search_api.html

from openfactverification.

haonan-li avatar haonan-li commented on September 22, 2024

The openai compatible endoints is supported in v0.0.2 see #8.
Docs will be updated soon.

from openfactverification.

shuther avatar shuther commented on September 22, 2024

so it is possible to switch between openai and anthropic; could we use ollama or anything else (so change the base url?)

from openfactverification.

HanXudong avatar HanXudong commented on September 22, 2024

so it is possible to switch between openai and anthropic; could we use ollama or anything else (so change the base url?)

The short answer is Yes.

  1. Export base URL and key
export ANTHROPIC_API_KEY=... # this is required only if you want to replace openai with anthropic
export LOCAL_API_KEY=... # this is required only if you want to use local LLM
export LOCAL_API_URL=... # this is required only if you want to use local LLM
  1. Set your client and model name
    For Anthropic:
python -m factcheck --modal string --input "MBZUAI is the first AI university in the world" --model claude-3-opus-20240229 --prompt claude_prompt

For local hosted models

python -m factcheck --modal string --input "MBZUAI is the first AI university in the world" --client local_openai --model anyModel --prompt pathToPrompt.yaml

However, the prompt can be model-specific, especially if we ask the model to output a JSON format response. We have yet to have a chance to support all models, so you will have to adopt your own prompts when using models other than openai.

from openfactverification.

shuther avatar shuther commented on September 22, 2024

not sure if it is expected but LOCAL_API_URL needs to finish with a / (slash); it does not need to be the case usually, not sure why.

from openfactverification.

shuther avatar shuther commented on September 22, 2024

in the local_openai_client.py, I would recommend to apply 2 changes to support slower calls:
max_requests_per_minute=2,

and

         model=self.model,
            messages=messages,
           # temperature=0.3,
            timeout=90,

from openfactverification.

haonan-li avatar haonan-li commented on September 22, 2024

Thank you for your suggestion and we believe use max_requests_per_minute to do the traffic control is effective.

For personalized model or API, the arguments will be variant a lot. We will leave comment here to note users.

from openfactverification.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.