PackagePackagetypeA library you install and call yourself.See every one →What this type is →independently maintainedindependently maintainedoriginPublished by one person or a small company outside SAP. Says nothing about quality; the readings say that.See every one →

abap_btocs_ollama

An ABAP plugin, built on the B-Tocs ABAP SDK, that calls models served by Ollama through an SM59 RFC destination, implementing four of its API endpoints: generate, tags, show and embeddings.

Calling a locally or centrally hosted Ollama model from ABAP means wiring up the calls to its API by hand. This plugin does that through an SM59 RFC destination, implementing four of Ollama's API endpoints as ABAP programs and a connector class: generate, tags (the list of installed models), show (model info) and embeddings. It stops at those four: further Ollama API features are listed among its known issues as not yet implemented. The B-Tocs ABAP SDK has to be installed first, and the Ollama container with the models loaded is the other half of the setup.

Facts

Last pushLicenceMIT

Where it sits

Lives in
Provides
LLM integrationABAPLLM integrationcapabilityCalling a language model from application code with the tenant, destination and credential handling already solved instead using an SDK call with a hand-rolled key.

Who is behind it

B-Tocs.org CommunityB-Tocs.org CommunityPersonMaintains this
In the atlas: maintains 6, contributes to 5
@b-tocs
maintainer

Before choosing this

Signals

ActivityQuietNo published releases; repository quiet for 28 months

It publishes no releases, and its repository has been quiet for at least 24 full months. This may be normal for stable software; check whether its current state still fits your use.

What it declares

Every artifact

Type
Package
Origin
Independently maintained

As a package

Where it runs
Inside its host
Distributed through
abapGit

Connections1

README

quoted from b-tocs/abap_btocs_ollama under MIT, read
b-tocs/abap_btocs_ollama/README.mdOn GitHub

B-Tocs ABAP Plugin - OLLAMA Connector

Bride To Other Cool Stuff

Summary

This plugin is based on the B-Tocs ABAP SDK and enables the SAP ABAP Server to use Large Language Models provided by the OLLAMA infrastructure services. Most of the Large Language Models can be tested from the ABAP server. For more information about the models and their licences see the OLLAMA Library or the referenced Hugging Face model page.

The plugin is free at your own risk. MIT License.

Architecture

SAP ABAP System B-Tocs SDK Cloud Native World Data Center On-Prem Data Center HyperScaler SAP BTP SaaS plugin-- SAP Business Functions sap_bf-- B-Tocs SDK Plugin OLLAMA sdkcore-- service1 service2 service3 service4 service5

Screenshots

LLAMA2 prompt

LLAMA2 Prompt

LLAMA2 result

LLAMA2 Result

MIXTRAL prompt

MIXTRAL Prompt

MIXTRAL result

MIXTRAL Result

Server Load

Server Load

Installation & Configuration

1. Prepare the AI backend
  1. Configure the OLLAMA docker container
    1. locally with Docker Desktop - see doc
    2. container stack within B-Tocs container farm - see doc
    3. in an existing docker host or kubernetes cluster - install and configure the OLLAMA container as described here
  2. Load your required models, e.g. "llama2", "mistral", "mixtral", ...
  3. Test the models from command line within the container
  4. check webservice port 11434 is available
2. Prepare your SAP ABAP Backend
  1. An installed B-Tocs ABAP SDK is required. Check for Updates.
  2. Install this plugin with abapGit.
  3. Use Package ZBTOCS_OLLAMA or $BTOCS_OLLAMA (local only)
  4. Configure SM59 RFC Destination to your service
  5. Test the connection
  6. Execute program ZBTOCS_OLLAMA_GUI_RWS_DEMO for a demo
3. Use the OLLAMA Connector
  1. Try model 'llama2' with a simple prompt
  2. Try the system prompt feature
  3. Try other models with same prompts
Example ABAP Code:
DATA lo_response TYPE REF TO zif_btocs_rws_response.
DATA(ls_result) = VALUE zbtocs_ollama_s_generate_res( ).
DATA(lo_connector) = zcl_btocs_ollama_connector=>create( ).

IF lo_connector->set_endpoint(
    iv_rfc     = p_rfc
    iv_profile = p_prf
  ) EQ abap_true.

    lo_response = lo_connector->api_generate(
      EXPORTING
        is_params = VALUE zbtocs_ollama_s_generate_par(
          model       = 'llama2'
          role        = 'user'
          prompt      = 'Wie ist SAP zu einem Weltmarktführer für ERP Systeme geworden?'
          sys_prompt  = 'Antworte in Deutsch und in max. 5 Stichpunkten.'
          template    = ||
          context     = ||
        )
        iv_parse = abap_true
      IMPORTING
        es_result = ls_result
    ).

    IF ls_result IS NOT INITIAL.
      cl_demo_output=>write_text( text = |Response: { ls_result-response }| ).
      cl_demo_output=>display( ).
    ENDIF.
ENDIF.

lo_connector->destroy( ).

Check report ZBTOCS_OLLAMA_GUI_RWS_DEMO for more.

API implementation

The Ollama API is documented here. Not all these API endpoints are implemented in ABAP.

ProgramDescriptionAPI endpoint
ZBTOCS_OLLAMA_GUI_RWS_DEMODefault usage generation/api/generate
ZBTOCS_OLLAMA_GUI_API_TAGSList of installed models/api/tags
ZBTOCS_OLLAMA_GUI_API_SHOWModel info/api/show
ZBTOCS_OLLAMA_GUI_API_EMBEDGenerate embedding/api/embeddings

History

  • 0.2.0 2024/02/20
    • api endpoint /api/tags
    • api endpoint /api/show
    • api endpoint /api/embeddings
    • added support for images in /api/generate
    • additional information in result popup for /api/generate
    • connector refactoring: parse* methods
  • 0.1.0 2024/01/22
    • initial release
    • connector
    • api endpoint /api/generate

Known Issues

  1. Some Ollama API features are not implemented yet
  2. The performance of the webservice depends on your AI backend. In local environment the performance is bad...
  3. There is currently no data center experience for optimal conditions for the container and parallel requests
  4. Known issues with backward compatibility. Will be fixed soon...

FAQ

I want to use it as a SAP customer

This plugin is free to use at your own risk (MIT licence).

I want to use it as a SAP partner

It is free for you too. But sharing of ideas and code is expected: Contribute code, docs, ideas, ... to the project via pull requests, blogs, ...

I need support

Support for individual issues is not available. Ask a good developer, partner or the community.

I want to contribute

Fork this repository and contribute through pull requests. More extensive participation in this repository is possible after positive experiences.

MIT, read
LLM integration
  1. llm_clientABAP client with one interface to chat-completion LLM APIs
  2. abap-agent-runtimeABAP-native MCP endpoint that drives opted-in abap2UI5 apps
  3. SAP AI CoreAI runtime on BTP with the Generative AI Hub
  4. abap-sdk-nwas-xABAP client library for IBM watsonx.ai APIs
  5. Microsoft AI SDK for SAPABAP library for calling Azure OpenAI and OpenAI
  6. zllmABAP framework for chaining and orchestrating LLM calls
  7. ABAP AI SDKSAP reuse library for calling large language models from ABAP
  8. abap-sdk-nwasAn ABAP client library for IBM Watson's Discovery, Language Translator, Natural Language Understanding, Speech to Text, Text to Speech and Assistant services, installed through abapGit.

Details

Sources3
Added by handdiscovered herechecked
github.com/b-tocs/abap_btocs_ollamatree, pushes, contributors, CIchecked
README.mdquoted, and what the entry declareschecked

Sources are graph entities: the same page may back several entries, and an unreachable source flags every row that rests on it.

Compatibility and provenance
discovered viaAdded by hand
first seen in the atlas
ecosystem and domainabap, ai-and-agents
abaplint
issues under its own abaplint configuration453
lines1,359
statements917
objects14
files14
analysed, main
abaplint version2.120.84
Flavors1
Standard ABAP
“Configure SM59 RFC Destination to your service” — b-tocs/abap_btocs_ollama — README, Installation & Configurationchecked
History in the atlas1
  1. First seen.
For your agent
Ref
artifact:b-tocs-abap-btocs-ollama
JSON
/artifacts/b-tocs-abap-btocs-ollama.json
MCP
Connecting an agent