DeepFellow DOCS

Start coding with DeepFellow

DeepFellow is a lightweight framework for your AI apps. It provides a seamless integration with large language models (LLMs) through familiar APIs. The integration with e.g., OpenAI's models and LangChain's tools is straightforward. Whether you're building chatbots, intelligent agents, or retrieval-augmented generation (RAG) pipelines, DeepFellow helps you get started in minutes.

To use examples in this tutorial, you need to have DeepFellow installed. You also need to install at least one model - learn how do it using DeepFellow Infra Web Panel.

OpenAI API Integration

The most straightforward way to interact with LLMs through DeepFellow is using the OpenAI-compatible API. This allows you to leverage existing OpenAI knowledge while benefiting from DeepFellow's enhanced privacy features.

from openai import OpenAI

client = OpenAI(
    api_key="DEEPFELLOW-PROJECT-API-KEY",
    base_url="https://deepfellow-server-host/v1",
)


completion = client.chat.completions.create(
    model="llama3-70b", # here enter your installed model name
    messages=[
        {"role": "assistant", "content": "You are a helpful assistant."},
        {"role": "user", "content": "Hello, how are you?!"},
    ],
)

print(completion.choices[0].message.content)
import OpenAI from 'openai';

const openai = new OpenAI({
    apiKey: 'DEEPFELLOW-PROJECT-API-KEY',
    baseURL: 'https://deepfellow-server-host/v1'
});

async function main() {
    const completion = await openai.chat.completions.create({
        messages: [
            { role: 'assistant', content: 'You are a helpful assistant.' },
            { role: 'user', content: 'Hello, how are you?' }
        ],
        model: 'llama3-70b' // here enter your installed model name
    });

    console.log(completion.choices[0].message.content);
}

main();

LangChain

DeepFellow integrates seamlessly with LangChain, allowing you to leverage LangChain's tools and abstractions while using DeepFellow's privacy features on your own infrastructure.

from langchain_openai import ChatOpenAI

llm = ChatOpenAI(
    api_key="DEEPFELLOW-PROJECT-API-KEY",
    base_url="https://deepfellow-server-host/v1",
    model="llama3-70b", # here enter your installed model name
)

response = llm.invoke("Hello, how are you?")
print(response.content)
import { ChatOpenAI } from '@langchain/openai';

const llm = new ChatOpenAI({
    configuration: {
        baseURL: 'https://deepfellow-server-host/v1',
        defaultHeaders: {
            Authorization: `Bearer DEEPFELLOW-PROJECT-API-KEY`
        }
    },
    model: 'llama3-70b' // here enter your installed model name
});

async function main() {
    const completion = await llm.invoke([
        {
            role: 'assistant',
            content: 'You are a helpful assistant.'
        },
        {
            role: 'user',
            content: 'Hello, how are you?'
        }
    ]);
    console.log(completion.content);
}

main();

We use cookies on our website. We use them to ensure proper functioning of the site and, if you agree, for purposes such as analytics, marketing, and targeting ads.