Coder Social home page Coder Social logo

gha3mi / foropenai Goto Github PK

View Code? Open in Web Editor NEW
15.0 15.0 2.0 7.36 MB

ForOpenAI - A Fortran library for OpenAI API.

Home Page: https://gha3mi.github.io/foropenai/

License: MIT License

Fortran 100.00%
api chatgpt dall-e fortran fortran-package-manager gpt openai openai-api whisper

foropenai's Introduction

My Fortran Projects

GitHub Fortran fpm

All projects listed here are designed to be used as fpm (Fortran package manager) packages. Each library provides specific functionality and can be easily integrated into your Fortran projects using fpm.

Below is a brief overview of each project:

ForCAD

GitHub Version Documentation License Build

ForCAD is A Fortran library for Geometric Modeling using NURBS (Non-Uniform Rational B-Splines).

fpm Dependency:

[dependencies]
forcad = { git = "https://github.com/gha3mi/forcad.git" }

ForCompile

GitHub Version Documentation License Build

ForCompile is a Fortran library to access the Compile Explorer API.

fpm Dependency:

[dependencies]
forcompile = { git = "https://github.com/gha3mi/forcompile.git" }

ForMatmul

GitHub Version Documentation License Build

ForMatmul is a Fortran library that overloads the matmul function to enable efficient matrix multiplication with coarray.

fpm Dependency:

[dependencies]
formatmul = { git = "https://github.com/gha3mi/formatmul.git" }

ForDot

GitHub Version Documentation License Build

ForDot is a Fortran library that overloads the dot_product function to enable efficient dot product with/without coarray.

fpm Dependency:

[dependencies]
fordot = { git = "https://github.com/gha3mi/fordot.git" }

ForOpenAI

GitHub Version Documentation License Build

ForOpenAI is a Fortran library for OpenAI API.

fpm Dependency:

[dependencies]
foropenai = { git = "https://github.com/gha3mi/foropenai.git" }

ForSVD

GitHub Version Documentation License Build

ForSVD is a Fortran library for singular value decomposition (SVD) calculation, low-rank approximation, and image compression.

fpm Dependency:

[dependencies]
forsvd = { git = "https://github.com/gha3mi/forsvd.git" }

ForPCA

GitHub Version Documentation License Build

ForPCA is a Fortran library for principal component analysis (PCA).

fpm Dependency:

[dependencies]
forpca = { git = "https://github.com/gha3mi/forpca.git" }

ForEig

GitHub Version Documentation License Build

ForEig is a Fortran library for eigenvalue and eigenvector calculations.

fpm Dependency:

[dependencies]
foreig = { git = "https://github.com/gha3mi/foreig.git" }

ForClust

GitHub Version Documentation License Build

ForClust allows you to manage and control a Linux system, such as adjusting the settings of the CPU and other components.

fpm Dependency:

[dependencies]
forclust = { git = "https://github.com/gha3mi/forclust.git" }

ForSolver

GitHub Version Documentation License Build

ForSolver provides linear and nonlinear solvers.

fpm Dependency:

[dependencies]
forsolver = { git = "https://github.com/gha3mi/forsolver.git" }

ForDiff

GitHub Version Documentation License Build

ForDiff is a Fortran library for numerical differentiation.

fpm Dependency:

[dependencies]
fordiff = { git = "https://github.com/gha3mi/fordiff.git" }

ForTime

GitHub Version Documentation License Build

ForTime is a Fortran library for measuring elapsed time, CPU time, OMP time, and MPI time.

fpm Dependency:

[dependencies]
fortime = { git = "https://github.com/gha3mi/fortime.git" }

ForLapack

GitHub Version Documentation License Build

ForLAPACK is a Fortran library for LAPACK-related operations.

fpm Dependency:

[dependencies]
forlapack = { git = "https://github.com/gha3mi/forlapack.git" }

ForBlas

GitHub Version Documentation License Build

ForBLAS is a Fortran library for BLAS-related operations.

fpm Dependency:

[dependencies]
forblas = { git = "https://github.com/gha3mi/forblas.git" }

ForImage

GitHub Version Documentation License Build

ForImage is a Fortran library for PNM file processing and image editing.

fpm Dependency:

[dependencies]
forimage = { git = "https://github.com/gha3mi/forimage.git" }

ForInv

GitHub Version Documentation License Build

ForInv is a Fortran library for calculating pseudoinverse using various methods.

fpm Dependency:

[dependencies]
forinv = { git = "https://github.com/gha3mi/forinv.git" }

ForDebug

GitHub Version Documentation License Build

ForDebug is a Fortran library designed for debugging Fortran code, especially within pure procedures.

fpm Dependency:

[dependencies]
fordebug = { git = "https://github.com/gha3mi/fordebug.git" }

ForBenchmark

GitHub Version Documentation License Build

ForBenchmark is a Fortran library for benchmarking (with support for coarrays).

fpm Dependency:

[dependencies]
forbenchmark = { git = "https://github.com/gha3mi/forbenchmark.git" }

ForUnitTest

GitHub Version Documentation License Build

ForUnitTest is a Fortran library for unit testing.

fpm Dependency:

[dependencies]
forunittest = { git = "https://github.com/gha3mi/forunittest.git" }

foropenai's People

Contributors

gha3mi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

wangvei

foropenai's Issues

Problem with http-client using multipart/form-data

In test5 for translation:

This curl command functions correctly:

curl https://api.openai.com/v1/audio/translations \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "Content-Type: multipart/form-data" \
  -F file="@test/audio_de.mp3" \
  -F model="whisper-1" \
  -F prompt="" \
  -F response_format="json" \
  -F temperature=0.0

The equivalent HTTP request using http-client doesn't work when there is a temperature parameter:

program test_translation

   use http, only: response_type, request, HTTP_POST, pair_type

   type(pair_type),    allocatable :: req_header(:), form_data(:), file_data
   character(len=:),   allocatable :: api_key
   type(response_type)             :: response

   api_key = 'OPENAI_API_KEY'

   req_header = [&
      pair_type('Authorization', 'Bearer '//trim(api_key)),&
      pair_type('Content-Type', 'multipart/form-data')&
      ]

   form_data = [&
      pair_type('model'          , "whisper-1"),&
      pair_type('prompt'         , ""),&
      pair_type('response_format', "json"),&
      pair_type('temperature'    , "0.0")&
      ]

   file_data = pair_type('file', 'test/audio_de.mp3')

   response = request(&
      url    = "https://api.openai.com/v1/audio/translations",&
      method = HTTP_POST,&
      header = req_header,&
      form   = form_data,&
      file   = file_data)

   print*, response%content

end program test_translation

Edit: Updated test program.

Bug in request function of http-client package

There is a bug with the request function of http-client when working with multipart/form-data in subroutine create_transcription.

The issue arises when there are no spaces before the "name" attribute in the form variable for the second and following pairs. Here's an example:

response = request(url=this%url, method=HTTP_POST , header=req_header, form=form_data, file=file_data)

And here's the problematic form definition:

form_data = [&
   pair_type('model', trim(this%model)),&
   pair_type(' language', trim(this%language)),&
   pair_type(' response_format', trim(this%response_format)),&
   pair_type(' prompt', trim(this%prompt)),&
   pair_type(' temperature', trim(tempereture_str))&
   ]

functionality to add

Hello, this is a comment, not an "issue".

I have a project https://github.com/Beliavsky/ChatGPT-Fortran-generator that may interest you. One thing it can do is ask ChatGPT to create a Fortran program to solve a task, compile the supplied code, and feed the compiler error messages back to ChatGPT if there are any, so that it can produce code that compiles. My project is in Python, but it could be done in Fortran as well.

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.