Git Product home page Git Product logo

Comments (4)

collindutter avatar collindutter commented on June 12, 2024

Hi @s-m-palmier, can you please share a minimal reproducible example of the OpenAiChatPromptDriver not using base_url correctly? We have used it with success on services like TogetherAi.

from griptape.

s-m-palmier avatar s-m-palmier commented on June 12, 2024

@collindutter I'm working on an endpoint that I can't send out, but basically - it's not an OpenAI endpoint. The LLM is hosted internally and was setup to run using TGI, but now it's moved to vLLM and i'm wondering if any of your prompt drivers can handle something more generic, like an inference endpoint, model_name, tuning parameters, and an api_token. The OpenAiPromptDriver seems close, but it fails to look outside of OpenAI servers.

import os
from griptape.structures import Agent
from griptape.drivers import OpenAiChatPromptDriver
from griptape.rules import Rule
from griptape.config import StructureConfig, StructureGlobalDriversConfig
from dotenv import load_dotenv

load_dotenv()

agent = Agent(
    config=StructureConfig(
        global_drivers=StructureGlobalDriversConfig(
            prompt_driver=OpenAiChatPromptDriver(
                base_url="https://[my_model_endpoint]",
                api_key=os.getenv('[API_TOKEN]'),
                temperature=0.1,
                max_tokens=2048,
                model="Mixtral-8x7B-Instruct-v0.1",
                seed=42,
            )
        )
    ),
    input_template="You will be provided with a sentence, please provide a one word classification of the sentiment. Sentence: {{ args[0] }}",
    rules=[
        Rule(
            value='Write your output in all caps'
        )
    ],
)

agent.run("I really hate it here.")

renders the following error:

WARNING:root:model not found. Using cl100k_base encoding.
failed (SSLError HTTPSConnectionPool(host='openaipublic.blob.core.windows.net')

I don't want it to look on that host, I'm trying to reach my host at my url. how can I do that?

from griptape.

collindutter avatar collindutter commented on June 12, 2024

Ah, that is coming from the OpenAiTokenizer which is trying to look up the Mixtral-8x7B-Instruct-v0.1 model. You should be able to resolve by giving OpenAiChatPromptDriver a Tokenizer that is built for Mixtral (from HuggingFace, for instance). You can also use SimpleTokenizer as a quick workaround.

from griptape.

collindutter avatar collindutter commented on June 12, 2024

Also going to point to this comment which may assist. I am going to close this issue for now but please feel free to re-open if you still face issues!

from griptape.

Related Issues (20)

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.